Currently, rake-compiler-dock sets -s in LDFLAGS when installing rubies for cross-compilation (done in
|
export LDFLAGS='-pipe <%= strip %>' && \ |
).
I want to say this logic was carried over from rake-compiler/rake-compiler#165.
Speaking for the grpc gem, when shipping release gems, this -s flag is normally OK because we want to strip symbols anyways.
But it's become apparent that we need to make debug symbols for our pre-compiled binaries available (otherwise, it can be hard to deal with bugs in the wild).
I came up with an approach in grpc/grpc#34632, the idea is:
-
build an unstripped native library
-
save debug symbols off to the side
-
strip the native library, and include this in a release gem
-
publish debug symbols from 2) in a separate auxiliary package
Problem:
Because we have -s in LDFLAGS, in order to do step 1) we need to manually find and remove -s from $LDFLAGS in our extconf.rb.
Finding and removing -s seems fragile long term. For example, if the flag was renamed to --strip-all, our logic would break.
I'm wondering if we can create more explicit way to prevent automatic stripping on the rake-compiler/rake-compiler-dock side.
Currently, rake-compiler-dock sets
-sinLDFLAGSwhen installing rubies for cross-compilation (done inrake-compiler-dock/Dockerfile.mri.erb
Line 165 in 9e840c4
I want to say this logic was carried over from rake-compiler/rake-compiler#165.
Speaking for the grpc gem, when shipping release gems, this -s flag is normally OK because we want to strip symbols anyways.
But it's become apparent that we need to make debug symbols for our pre-compiled binaries available (otherwise, it can be hard to deal with bugs in the wild).
I came up with an approach in grpc/grpc#34632, the idea is:
build an unstripped native library
save debug symbols off to the side
strip the native library, and include this in a release gem
publish debug symbols from 2) in a separate auxiliary package
Problem:
Because we have
-sinLDFLAGS, in order to do step 1) we need to manually find and remove -s from$LDFLAGSin ourextconf.rb.Finding and removing
-sseems fragile long term. For example, if the flag was renamed to--strip-all, our logic would break.I'm wondering if we can create more explicit way to prevent automatic stripping on the rake-compiler/rake-compiler-dock side.