https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80836
Bug ID: 80836 Summary: final binaries missing rpath despite configure with LDFLAGS=-Wl,-rpath=$prefix/lib Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: rjvbertin at gmail dot com Target Milestone: --- I'm building GCC 7.1.0 on Linux for installation into a separate prefix (/opt/local) that is not declared via ldconfig. I thus need to store rpath information in my binaries because I do not want to set LD_LIBRARY_PATH systematically (that would defeat my purposes). It's unclear how to set up GCC to build that way, or I overlooked any specific options other than adding `-Wl,-rpath=/opt/local/lib` to LDFLAGS when running configure. When I do that (and add LD_LIBRARY_PATH=/opt/local/lib to the environment during the build and `make install`), the build terminates OK. Just to be certain I repeated the install with LDFLAGS set too as shown (because I notice relinking during the step) but that doesn't change anything. This affects all libraries from /opt/local/lib that the GCC executables link to, meaning some won't be found and for some an older version from the host will be used at runtime. This looks like such a serious oversight that I cannot imagine nothing has been foreseen to avoid the issue at hand. Also, is there anything I can do to fix this without doing a full rebuild from scratch (I used the bootstrap-lean target)