Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22151

How to change GCC's default sysroot?

$
0
0

If you run gcc -print-sysroot it will print out the location default sysroot. This also works for cross compilers, for example:

docker_user@8d9f484fffc7:/build_env$ /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -print-sysroot
/opt/poky/1.7/sysroots/armv7a-vfp-neon-poky-linux-gnueabi

I'm aware that you can specify a different sysroot by passing gcc --sysroot=dir, but my question is:

  • How can I change the location of gcc default sysroot?

For some context, I'm upgrading the compiler of our system. I've downloaded a pre-made linaro cross compiler here. The problem is, I need it to use our target's sysroot so it knows about all of the libraries available at runtime. The previous toolchain had the correct sysroot baked in because we used Yocto (Poky). For this toolchain we are using a precompiled linaro one.

I tried searching for a configuration file that contains the default sysroot path and I couldn't find one. I did find the path baked into the gcc binary via strings which makes me afraid the default sysroot is baked into at gcc compile time and therefore immutable.

Does anyone know if what I'm trying to accomplish is possible? Passing --sysroot to every compiler and linker statement is going to be an onerous task for the legacy code base I am working with due to the way the build system is setup. My life would be much easier if GCC had a way of permanently setting the default sysroot.


Viewing all articles
Browse latest Browse all 22151

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>