Search code examples
windowseclipsemakefileautotoolsmsys2

Whats the difference between calling "make" in eclipse and calling "make" in terminal?


I'm trying to build a makefile project in eclipse under windows but the build fails (Project > Build Project). However, if I navigate to the build directory in the msys2 terminal and call "make" everything runs just fine. To figure out why building in eclipse does not work I am now trying to find the difference between using make in terminal and in eclipse. Up to the point where the build fails the console output of eclipse is the same as the output in msys2 terminal:

This is the console output in eclipse:

make 
Making all in i386-rtems5/c
make[1]: Entering directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c'
Making all in .
make[2]: Entering directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c'
Configuring RTEMS_BSP=pc686
checking for gmake... no
checking for make... make
checking build system type... x86_64-w64-mingw32
checking host system type... i386-pc-rtems5
checking rtems target cpu... i386
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i386-rtems5-strip... i386-rtems5-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for RTEMS_BSP... pc686
checking whether CPU supports libposix... yes
configure: setting up make/custom
configure: creating make/pc686.cache
make[3]: Entering directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c/pc686'
make[3]: Leaving directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c/pc686'
checking for RTEMS_CPU_MODEL... 
checking for RTEMS_BSP_FAMILY... pc386
checking for CPU_CFLAGS... (cached) -mtune=pentiumpro -march=pentium
checking for CFLAGS_OPTIMIZE_V... (cached) -O2 -g -ffunction-sections -fdata-sections
checking for style of include used by make... GNU
checking for i386-rtems5-gcc... i386-rtems5-gcc
checking for i386-rtems5-gcc... (cached) i386-rtems5-gcc
checking whether the C compiler works... no
configure: error: in `/c/rt5/rtems/kernel/pc/i386-rtems5/c/pc686':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[2]: *** [Makefile:731: pc686] Error 1
make[2]: Leaving directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c'
make[1]: *** [Makefile:289: all-recursive] Error 1
make[1]: Leaving directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c'
make: *** [Makefile:410: all-recursive] Error 1
"make" terminated with exit code 2. Build might be incomplete.

This is the output in the msys2 terminal:

$ make
Making all in i386-rtems5/c
make[1]: Verzeichnis „/c/rt5/rtems/kernel/pc/i386-rtems5/c“ wird betreten
Making all in .
make[2]: Verzeichnis „/c/rt5/rtems/kernel/pc/i386-rtems5/c“ wird betreten
Configuring RTEMS_BSP=pc686
configure: loading site script /mingw64/etc/config.site
checking for gmake... no
checking for make... make
checking build system type... x86_64-w64-mingw32
checking host system type... i386-pc-rtems5
checking rtems target cpu... i386
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i386-rtems5-strip... i386-rtems5-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for RTEMS_BSP... pc686
checking whether CPU supports libposix... yes
configure: setting up make/custom
configure: creating make/pc686.cache
make[3]: Entering directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c/pc686'
make[3]: Leaving directory '/c/rt5/rtems/kernel/pc/i386-rtems5/c/pc686'
checking for RTEMS_CPU_MODEL...
checking for RTEMS_BSP_FAMILY... pc386
checking for CPU_CFLAGS... (cached) -mtune=pentiumpro -march=pentium
checking for CFLAGS_OPTIMIZE_V... (cached) -O2 -g -ffunction-sections -fdata-sections
checking for style of include used by make... GNU
checking for i386-rtems5-gcc... i386-rtems5-gcc
checking for i386-rtems5-gcc... (cached) i386-rtems5-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
[...]

As far as I can see in both cases make is called but with different results. The Makefile is also the same in both cases. What could cause this?


Solution

  • The difference between invoking make in eclipse and in msys2 terminal is that it is run in different environments. To ensure that I get the same result with both methods I had to make sure that my windows PATH contained the right entries. To find out what entries I had to add to PATH i examined the config.log for the failing case as well as for the successful case.

    Additionally I had to run eclipse as administrator as it had no privileges to create temporary files.