Handling of sysroot-relative search-paths without explicit --sysroot parameter

Heiko Lewin via Gcc <[email protected]> Wed, 17 Jun 2026 10:54:01 +0000
Newsgroups gmane.comp.gcc.devel
Message-ID <[email protected]>
Hello!

I have a question regarding sysroot-relative search paths. It seems that gcc will only substitute the = or $SYSROOT prefix if a “—sysroot” parameter was given on the command line. Is this intentional? To me it would seem that omitting a —sysroot parameter would imply using “/“. But this is not the case. Without a —sysroot parameter the = or $SYSROOT prefix is interpreted literally. Compare:


> echo | g++ -I=/tmp  -v -E -
...
ignoring nonexistent directory "=/tmp”
…

> echo | aarch64-elf-g++ -I=/tmp  --sysroot=/ -v -E -
...
#include <...> search starts here:
 //tmp
…



I am unsure if I should file a bug report for this or not.



Kind regards
Heiko Lewin
Software Engineer

worldiety GmbH
Nordseestraße 2, 26131 Oldenburg, Deutschland

Telefon +49 441 559 770 0
Web www.worldiety.de

Keine News rund um worldiety verpassen?
Hier Newsletter abonnieren!<https://www.worldiety.de/newsletter-anmeldung>

Facebook<https://www.facebook.com/worldiety/> | Xing<https://www.xing.com/companies/worldietygmbh> | LinkedIn<https://de.linkedin.com/company/worldiety-gmbh> | GitHub<https://github.com/worldiety>

Alleinvertretungsberechtigte Gesellschafter: Adrian Macha, Torben Schinke
Handelsniederlassung: Oldenburg i.O. | Amtsgericht Oldenburg i.O. HRB 20 84 28