Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341379

Summary: Eclipse PATH environment variable in 64-bit on Win7 not working
Product: [Tools] CDT Reporter: Loaden <loaden>
Component: cdt-buildAssignee: cdt-build-inbox <cdt-build-inbox>
Status: CLOSED DUPLICATE QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3 CC: aleherb+eclipse, cdtdoug, jamesblackburn+eclipse, loaden
Version: 7.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Loaden CLA 2011-03-30 11:22:49 EDT
Build Identifier: M20110210-1200

I have the 64-bit version of Eclipse Helios SR1 with CDT on Windows 7 64-bit. I am using MinGW as my toolset. I have an environment variable set under Project > Properties > C/C++ Build > Environment for PATH that points to "c:\mingw\bin". Eclipse is set to Append these environment variables.

When I try and build with this configuration, I get:


Internal Builder: Cannot run program "gcc" (in directory "C:\Users\<me>\workspace\test\Release"): CreateProcess error=2, The system cannot find the file specified
Build error occurred, build is stopped

When I quit out of Eclipse and manually set my PATH environment variable in Windows to include "c:\mingw\bin" (through System > Advanced System Settings... > Environment Variables...) everything compiles fine without changing any of the options in Eclipse.

TLDR: The only way I can get my project to build is by setting my environment PATH variable manually through Windows -- the Eclipse-set environment variables aren't taking. 

More Information:
VM Arguments:
jvm_args: -Xverify:none -XX:PermSize=128m -XX:+UseParallelGC -Xms512m -Xmx512m -XX:MaxPermSize=256m 
java_command: <unknown>
Launcher Type: generic

Environment Variables:
PATH=D:/DengYC/LoveDEV/jre/bin/server;D:/DengYC/LoveDEV/jre/bin;D:/DengYC/LoveDEV/jre/lib/amd64;D:\DengYC\LoveDEV\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;D:\DengYC\LoveDEV;
USERNAME=qpsoft
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 Build 7601 Service Pack 1

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1

Memory: 4k page, physical 2091280k(943256k free), swap 4182560k(2341268k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (19.1-b02) for windows-amd64 JRE (1.6.0_24-b07), built on Feb  2 2011 16:25:45 by "java_re" with MS VC++ 8.0 (VS2005)

time: Wed Mar 30 22:40:09 2011
elapsed time: 1891 seconds


Reproducible: Always
Comment 1 DJ Houghton CLA 2011-03-30 16:50:45 EDT
Moving to Debug for comment. Not sure if this is CDT specific?
Comment 2 James Blackburn CLA 2011-03-30 17:25:30 EDT
Moving to cdt, we have our own spawner.
Comment 3 Andrew Gvozdev CLA 2011-03-30 20:05:07 EDT
How exactly do you set your path in eclipse? Is it "c:\mingw\bin;$PATH"?
Comment 4 Loaden CLA 2011-03-31 00:38:27 EDT
(In reply to comment #3)
> How exactly do you set your path in eclipse? Is it "c:\mingw\bin;$PATH"?

 My environment setting is:
----
C/C++ > Build > Environment
   PATH=${eclipse_home}/bin
   INCLUDE=${eclipse_home}/include
   LIB=${eclipse_home}/lib
----
I am using CMake for build, the error log:
(Cannot run program "cmake" (in directory "D:\DengYC\LoveDEV\share\workspace\TestGUI"): CreateProcess error=2, ?????????)

Then I am created a BAT file, here is the content:
@echo off
set PATH=%CD%\bin;%PATH%
set INCLUDE=%CD%\include
set LIB=%CD%\lib
start eclipse.exe

If start eclipse by the BAT file, then all works fine!
And, this issue only happens in 64-bit Win7, In x86 win7 and with the same configure, there not have this issue.
Comment 5 Andrew Gvozdev CLA 2011-03-31 12:18:32 EDT
One of the issues that could be there is that ${eclipse_home} ends with a backslash. So you end with something like "eclipse\path\/bin".
I'd suggest to use recent CDT 8 build from http://download.eclipse.org/tools/cdt/builds/ to troubleshoot path issues. It prints the path in the console if make not found.
Comment 6 Anton Leherbauer CLA 2011-04-01 03:54:02 EDT
I think this is a dup of bug 236330.  There is no spawner for x86_64, therefore Runtime.exec is used which does not search for the executable in the provided environment, but only in the current process env.
Comment 7 Loaden CLA 2011-04-03 11:15:48 EDT
(In reply to comment #5)
> One of the issues that could be there is that ${eclipse_home} ends with a
> backslash. So you end with something like "eclipse\path\/bin".
> I'd suggest to use recent CDT 8 build from
> http://download.eclipse.org/tools/cdt/builds/ to troubleshoot path issues. It
> prints the path in the console if make not found.

I don't think this is backslash question.
Because if I changed the value to "${eclipse_home}bin", It still won't work.
I will try CDT 8 late and will feedback here.
Comment 8 Loaden CLA 2011-04-03 12:28:35 EDT
(In reply to comment #7)
> (In reply to comment #5)
> > One of the issues that could be there is that ${eclipse_home} ends with a
> > backslash. So you end with something like "eclipse\path\/bin".
> > I'd suggest to use recent CDT 8 build from
> > http://download.eclipse.org/tools/cdt/builds/ to troubleshoot path issues. It
> > prints the path in the console if make not found.
> I don't think this is backslash question.
> Because if I changed the value to "${eclipse_home}bin", It still won't work.
> I will try CDT 8 late and will feedback here.

Here is CDT 8.0 test log, I am using VC Compiler now.
----
**** Rebuild of configuration Debug for project test ****

**** Internal Builder is used for build               ****
cl /c /EHs /MD /Zi /nologo /Fo:main.obj ..\main.cpp
Error: Cannot run program "cl" (in directory "D:\DengYC\LoveDEV\workspace\test\Debug"): CreateProcess error=2, ?????????
Build error occurred, build is stopped
Time consumed: 31  ms.  
-----
It's can't run "cl", The meaning is CDT can't find the PATH of cl.

After add the VC's bin directory to system PATH.
Now the log like this:
**** Internal Builder is used for build               ****
cl /c /EHs /MD /Zi /ID:\DengYC\LoveDEV\include /nologo /Fo:main.obj ..\main.cpp
main.cpp
link /debug /nologo /OUT:good.exe main.obj
LINK : fatal error LNK1181: cannot open input file 'main.obj'
Build error occurred, build is stopped
Time consumed: 656  ms.  

CDT can't build too, but we can sure CDT can find the cl.exe now.
Comment 9 Loaden CLA 2011-04-03 12:30:16 EDT
(In reply to comment #6)
> I think this is a dup of bug 236330.  There is no spawner for x86_64, therefore
> Runtime.exec is used which does not search for the executable in the provided
> environment, but only in the current process env.

I am now sure this is dup issue.
But if using x86, works well with the SAME setting.
Comment 10 Anton Leherbauer CLA 2011-04-04 02:57:59 EDT

*** This bug has been marked as a duplicate of bug 236330 ***
Comment 11 Loaden CLA 2011-04-05 00:13:27 EDT
Hi, CDT Term!
I found a new information, If I use "cmd /C cmake .." command, It should works well!!