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.
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.