Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc with -isysroot creates include path that starts with equal sign "=" and compile fails

I am cross-compiling using the CodeSourcery toolchain for arm (arm-none-linux-gnueabi). I use -isysroot to point at the /usr/include folder on a rootfs folder, but run into trouble when compiling. I have verified that the include folder is accessible.

Below is the gcc call and the output. Some of the output was removed because I don't think it is relevant.

The preprocessor comes up with an include path that is correct except for the "=" character that it starts with, and indicates that the path does not exist. It then fails to find the header files.

How can I make this work?

willem@jacta:~/Projects/button/Debug$ arm-none-linux-gnueabi-gcc -isysroot=/home/willem/Projects/rootfs -nostdinc -I=/usr/include -O0 -g3 -Wall -c -fmessage-length=0 -v -o src/smd/button/button.o ../src/smd/button/button.c -H
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: [ ... stuff omitted ... ]
Thread model: posix
gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) 
COLLECT_GCC_OPTIONS='-isysroot=/home/willem/Projects/rootfs' '-nostdinc' '-I' '=/usr/include' '-O0' '-g3' '-Wall' '-c' '-fmessage-length=0' '-v' '-o' 'src/smd/button/button.o' '-H' '-march=armv5te' '-funwind-tables'
 /home/willem/Tools/CodeSourcery/Sourcery_G++_Lite/bin/../libexec/gcc/arm-none-linux-gnueabi/4.4.1/cc1 -quiet -nostdinc -v -I =/usr/include -iprefix /home/willem/Tools/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/ -isysroot /home/willem/Tools/CodeSourcery/Sourcery_G++_Lite/bin/../arm-none-linux-gnueabi/libc -dD -H -isysroot=/home/willem/Projects/rootfs ../src/smd/button/button.c -quiet -dumpbase button.c -march=armv5te -auxbase-strip src/smd/button/button.o -g3 -O0 -Wall -version -fmessage-length=0 -funwind-tables -o /tmp/ccWnd3Xk.s
ignoring nonexistent directory "=/home/willem/Projects/rootfs/usr/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
GNU C (Sourcery G++ Lite 2010q1-202) version 4.4.1 (arm-none-linux-gnueabi)
    compiled by GNU C version 4.3.2, GMP version 4.3.1, MPFR version 2.4.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 250bf78701f747da89e730786c466148
. ../src/smd/button/button.h
../src/smd/button/button.c:2: error: no include path in which to search for pthread.h
[ ... etc. ... ]

Thanks!

W

like image 533
lightmatter Avatar asked Aug 23 '13 18:08

lightmatter


People also ask

Which gcc flag is used to enable all compiler warnings?

gcc -Wall enables all compiler's warning messages. This option should always be used, in order to generate better code.


1 Answers

The answer is that the -isysroot option does not need/want an "=" in the path specification, so the correct command is:

arm-none-linux-gnueabi-gcc -isysroot /home/willem/Projects/rootfs -nostdinc -I=/usr/include -O0 -g3 -Wall -c -fmessage-length=0 -v -o src/smd/button/button.o ../src/smd/button/button.c -H

Cheers,

W

like image 117
lightmatter Avatar answered Sep 20 '22 14:09

lightmatter