-
Notifications
You must be signed in to change notification settings - Fork 118
Linux: avoid using gold as the linker #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Ah, I just noticed this comment: rust-lang/rust#141750 (comment). So, we're likely encountering the same issue. |
|
Great, thanks, I've been investigating this too. Here's the stack trace I get when running on a ARM64 device, which kind of suggests the libvips type system hasn't been set up properly: If this is the cause then this would also explain why I couldn't get gcc 10 to work with rust nightly on x64. (It failed at compile time, whereas we're seeing the ARM64 build fail at runtime.) |
|
That's an interesting stack trace. To catch issues like this earlier, we could consider adding a smoke test to CI for targets we don't cross-compile, something like: Details/* compile with:
* libdir=node_modules/@img/sharp-libvips-linux-arm64/lib
* includedir=node_modules/@img/sharp-libvips-dev/include
* g++ -O2 -g1 -I$includedir -I$includedir/glib-2.0 -I$libdir/glib-2.0/include -D_GLIBCXX_USE_CXX11_ABI=0 -L$libdir -l:libvips-cpp.so.8.17.1 test.cpp -Wl,-rpath,$libdir
* run with:
* ./a.out
*/
#include <vips/vips8>
using namespace vips;
int main(int argc, char **argv) {
if (VIPS_INIT(argv[0]))
vips_error_exit(NULL);
VImage in = VImage::black(100, 100);
g_assert(in.avg() == 0.0);
vips_shutdown();
return 0;
}Though, we're not shipping binaries to end users anyway if they can't pass the test suite in sharp.
FWIW, I've still been unable to get this working with: Details--- a/platforms/linux-x64/Dockerfile
+++ b/platforms/linux-x64/Dockerfile
@@ -47,8 +47,9 @@ RUN \
curl https://sh.rustup.rs -sSf | sh -s -- -y \
--no-modify-path \
--profile minimal \
+ --default-toolchain nightly \
&& \
- cargo install cargo-c --locked && \
+ RUSTFLAGS="-Clink-arg=-fuse-ld=bfd" cargo install cargo-c --locked && \
ln -s /usr/bin/cmake3 /usr/bin/cmake && \
pip3 install meson==1.7.2 ninja packaging tomli
@@ -57,7 +58,7 @@ ENV \
PKG_CONFIG="pkg-config --static" \
PLATFORM="linux-x64" \
FLAGS="-march=nehalem -fuse-ld=bfd" \
- RUSTFLAGS="-Clink-arg=-fuse-ld=bfd" \
+ RUSTFLAGS="-Clink-arg=-fuse-ld=bfd -Zlocation-detail=none -Zfmt-debug=none" \
MESON="--cross-file=/root/meson.ini"
COPY Toolchain.cmake /root/I'm not sure why. 🤷♂️ |
I suspect this might be the reason of the SEGV in lovell/sharp@2cd2f84 on linux-arm64v8. It looks like multiple
.init_arraysections are included in the final binary, which probably won't work.v1.2.0-rc.4:
v1.2.0-rc.3:
This PR:
See also: rust-lang/rust#141748.