Problem with eclipse


When I do tutorial Debug Using Eclipse I got this error can you help me :

Building target: hello world
Invoking: Cross GCC Linker
arm-angstrom-linux-gnueabi-g++  -march=armv7-a -mthumb -mfpu=neon  -mfloat-abi=hard --sysroot=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o "hello world"  ./src/hello\ world.o   
/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/6.2.1/real-ld: error: ./src/hello world.o: incompatible target
../sysdeps/arm/start.S:119: error: undefined reference to 'main'
makefile:30: recipe for target 'hello world' failed


Which tutorial? Do you follow the instructions as per Getting Started or here?

Hello, I know I’m reviving an old thread, but I had the exact same problem as outlined in the original post, however with a i.MX7 Dual module. Here are details of my setup, the cause of the problem, and resolution:

Hardware: Colibri iMX7 Dual (1GB) module with Aster Carrier Board

Development system: Ubuntu 16.04 virtual machine, Eclipse Neon-3 (clean install)

I worked through the Getting Started guide. In “Module 2: My first Hello World in C” I’m able to complete part 2 “Build from Command-line” and successfully cross-compile the hello world program, transfer to the iMX7, and run the program. No problems at all.

In part 3, “Configure Eclipse”, its the very last step (step 17) for build that fails. There is the console output:

12:28:45 **** Build of configuration Release for project hello-world ****
make all 
Building file: ../src/hello-world.c
Invoking: Cross GCC Compiler
gcc -O3 -Wall -O2 -pipe -g -feliminate-unused-debug-types  -c -MMD -MP -MF"src/hello-world.d" -MT"src/hello-world.o" -o "src/hello-world.o" "../src/hello-world.c"
Finished building: ../src/hello-world.c
Building target: hello-world
Invoking: Cross GCC Linker
arm-angstrom-linux-gnueabi-g++  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/opt/angstrom-v2017.12/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o "hello-world"  ./src/hello-world.o   
/opt/angstrom-v2017.12/sysroots/x86_64-angstromsdk-linux/usr/libexec/arm-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/7.3.0/real-ld: error: ./src/hello-world.o: incompatible target
../sysdeps/arm/start.S:119: error: undefined reference to 'main'
makefile:30: recipe for target 'hello-world' failed
collect2: error: ld returned 1 exit status
make: *** [hello-world] Error 1

12:28:45 Build Finished (took 498ms)

The compile step completes successfully, but the linking step fails with the error “incompatible target”. For some reason the compile step did not used the options given by ${CC}, yet when I checked the Eclipse project properties, the command was correct and when I run “echo ${CC}” in a shell I get the output expected:

sparky@Ubuntu-16:~$ echo ${CC}
arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/opt/angstrom-v2017.12/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi

I was certain I had selected “[All configurations]” to ensure both Release and Debug builds had the compiler command set as ${CC}. But after exiting Eclipse, and running the command below to change my shell to bash (I might have forgotten to this step earlier) and then re-starting Eclipse, I discovered the compile command was set as ‘gcc’ and not ${CC}, which explains the output above.

sudo update-alternatives --install /bin/sh sh /bin/bash 100

I’m unsure if/how changing the shell had anything to do with the problem… It seems unlikely…and perhaps it was more the exciting and restarting Eclipse or something, but somehow the compile command setting had not “taken effect” and reverted to ‘gcc’.

Long story short: Change the shell to bash, restart Eclipse and check the compiler command in Step 12 is set correctly.

Hi @SoCalSparky, Thanks for the feedback.