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 trying to build a simple "Hello World" with LTO, I get the following error:
$ ldmd2 -flto=full hello.d
/usr/bin/ld.gold: error: /snap/ldc2/158/lib/LLVMgold-ldc.so: could not load plugin library: /snap/core/current/lib/x86_64-linux-gnu/librt.so.1: undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
/usr/bin/ld.gold: error: hello.o:1:3: invalid character
/usr/bin/ld.gold: error: hello.o:1:3: syntax error, unexpected $end
/usr/bin/ld.gold: error: hello.o: not an object or archive
/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
Error: /usr/bin/cc failed with status: 1
The same underlying upstream package (1.21.0) does not reproduce the problem when unzipped and run directly on the host Ubuntu 20.04 system. The snap packages themselves work fine with LTO on Ubuntu 18.04.
In the 1.20 package the LLVMgold-ldc.so library links to the following shared libs:
The libraries concerned are all present in the core snap, so I presume this is a clash between the ld.gold in use (external to the snap) and the librt inside the core snap.
The text was updated successfully, but these errors were encountered:
WebDrake
added a commit
to WebDrake/ldc2.snap
that referenced
this issue
Mar 25, 2021
By default snapcraft will rewrite the RPATH of binaries to link against
libraries in the core snap. However, the prebuilt binaries used in the
LDC package are designed and expected to link against host system libs.
To allow them to do this we need to explicitly instruct snapcraft using
the `no-patchelf` build attribute.
For background see:
https://forum.snapcraft.io/t/librt-so-1-undefined-symbol-clock-nanosleep/16246/2
This should allow LTO builds with LDC >= 1.21.0 to work on more recent
systems (e.g. Ubuntu 20.04+).
Fixesldc-developers#121
When trying to build a simple "Hello World" with LTO, I get the following error:
The same underlying upstream package (1.21.0) does not reproduce the problem when unzipped and run directly on the host Ubuntu 20.04 system. The snap packages themselves work fine with LTO on Ubuntu 18.04.
In the 1.20 package the
LLVMgold-ldc.so
library links to the following shared libs:From 1.21 onward
librt
is also required:The libraries concerned are all present in the core snap, so I presume this is a clash between the
ld.gold
in use (external to the snap) and thelibrt
inside the core snap.The text was updated successfully, but these errors were encountered: