You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting LDFLAGS in init-compiler, we do the escaping of "$ORIGIN" in rpath incorrectly - if you look at the output of a build you'll see rpath being set to something of the form 'RIGIN/../lib', when it should be '$ORIGIN/../lib'
I played around with it for awhile and unfortunately was not able to come up with an escaping that seems to actually work.
One possible solution would be to use a tool like chrpath or patchelf to update the rpath after everything is done, as I've done here: https://github.com/twmarshall/native-toolchain/tree/rpath, but this adds a dependency on a non-standard package, which isn't ideal.
The text was updated successfully, but these errors were encountered:
I went down a similar rabbit hole a while ago while looking into something else. IIRC one of CMake or autotools handles escaping differently so there's no way to specify $ORIGIN that works for all projects. The hacky solution I came up with was to just include both versions in every RPATH. That way you get a working rpath and a bogus one.
- # Upgrade rpath variable to catch current library location and possible future location
+ # Add rpath to all binaries we produce that points to the ../lib/ subdirectory relative
+ # to the output binaries or libraries. Need to include versions with both $ORIGIN and
+ # $$ORIGIN to work around autotools and CMake projects inconsistently escaping LDFLAGS
+ # values. We always get the expected "$ORIGIN/" rpaths in produced binaries, but we also
+ # get a bad rpath in each binary: either starting with "$$ORIGIN/" or "RIGIN/". The bad
+ # rpaths are ignored by the linker and are harmless.
if [[ "$OSTYPE" == "darwin"* ]]; then
- FULL_RPATH="-Wl,-rpath,$BUILD_DIR/gcc-$GCC_VERSION/lib,-rpath,'\$ORIGIN/../lib'"
+ FULL_RPATH="-Wl,-rpath,'\$ORIGIN/../lib',-rpath,'\$\$ORIGIN/../lib'"
else
- FULL_RPATH="-Wl,-rpath,$BUILD_DIR/gcc-$GCC_VERSION/lib64,-rpath,'\$ORIGIN/../lib64'"
+ FULL_RPATH="-Wl,-rpath,'\$ORIGIN/../lib64',-rpath,'\$\$ORIGIN/../lib64'"
fi
- FULL_RPATH="${FULL_RPATH},-rpath,'\$ORIGIN/../lib'"
+ FULL_RPATH="${FULL_RPATH},-rpath,'\$ORIGIN/../lib',-rpath,'\$\$ORIGIN/../lib'"
When setting LDFLAGS in init-compiler, we do the escaping of "$ORIGIN" in rpath incorrectly - if you look at the output of a build you'll see rpath being set to something of the form 'RIGIN/../lib', when it should be '$ORIGIN/../lib'
I played around with it for awhile and unfortunately was not able to come up with an escaping that seems to actually work.
One possible solution would be to use a tool like chrpath or patchelf to update the rpath after everything is done, as I've done here: https://github.com/twmarshall/native-toolchain/tree/rpath, but this adds a dependency on a non-standard package, which isn't ideal.
The text was updated successfully, but these errors were encountered: