I recently downloaded the latest version of the SDK for the AM335x processor and it came with a newer version of the compiler it uses: arm-linux-gnueabihf replaces the old arm-arago-linux-gnueabi.
What changed is that now I have to inform the gcc where the headers and libraries are with the option --sysroot=<directory>. The Makefile I use first generate all the objects with -c option and then it links them. The thing is, in the last step of the build process, when I use
$(CC) -Wl,--sysroot=$(SDK_PATH_TARGET) -o $(OBJDIR)/$(TARGET) $(ALLOBJ)
the linker complains it does not find some libraries, but if I change the command to the one below the linker finds everything:
$(CC) --sysroot=$(SDK_PATH_TARGET) -o $(OBJDIR)/$(TARGET) $(ALLOBJ)
So I was wondering why the heck -Wl doesn't works as I think it should. Does that mean the option --sysroot differs from the gcc and the ld programs? The help of the commands weren't clear enough:
$ ./arm-linux-gnueabihf-gcc --help | grep "sysroot="
--sysroot=<directory> Use <directory> as the root directory for headers and libraries
$ ./arm-linux-gnueabihf-ld --help | grep "sysroot="
--sysroot=<DIRECTORY> Override the default sysroot location
So I thought someone here would explain when to use -Wl,--sysroot=<directory> and when to use --sysroot=<directory> as options to the gcc!
Thanks.
DAVI