https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: sys-process/iotop-c-1.17-r1 fails to compile. Discovered on: amd64 (internal ref: guru_tinderbox) NOTE: This machine uses a clang/LLVM toolchain. If you think that this issue is strictly related to clang/LLVM please block bug 408963.
Created attachment 702354 [details] build.log build log and emerge --info
Possible context of error(s): /usr/bin/x86_64-pc-linux-gnu-ld: /usr/lib/llvm/12/bin/../lib64/LLVMgold.so: error loading plugin: /usr/lib/llvm/12/bin/../lib64/LLVMgold.so: cannot open shared object file: No such file or directory clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks for the report. Maybe the error by clang is misleading, but it speaks about gold plugin (which I know is a linker, like bfd or lld). Just to be sure, I checked the source of the package, and the only linker flag it adds is "-flto -fPIE -pie", which I don't think should raise this error. This error also looks like it tries to load LLVMgold.so from llvm side, so maybe it is a problem with LLVM? I tried locally to compile iotop with LLVM, and it worked fine for me (I'm using version 11). But maybe my setup isn't the same as was tested here, so I'm not sure.
Compiling using clang with LTO requires either the Gold linker, Gold plugin for BFD, or LLD It probably worked fine for you because you have `sys-devel/llvm[gold]` USE or `sys-devel/llvmgold` installed
Thank you very much for the fast reply. What is the appropriate check for "if using clang, depend on gold"? I tried to find a similar ebuild in gentoo tree, haven't found.
The proper fix would be to remove the -flto flags from being present by default(In reply to Arthur Zamarin from comment #5) > What is the appropriate check for "if using clang, depend on gold"? > I tried to find a similar ebuild in gentoo tree, haven't found. The proper fix is to remove the lto flags (it wouldn't be good to introduce dependencies for a compiler flag). I'm a fan of lto so it's a shame to have to do it but at the moment with default clang/llvm use flags lto doesn't work when using the default (bfd) linker. Personally I think clang[default-lld] should be enabled but it still has some issues. Though you won't see any more gold issues like this from the tinderbox as it now uses the LLD linker. I see the iotop makefile mentions NO_FLTO=1 which can just be added to your emake command
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=a89e7f4a5d8af8c009cac6b47b29d6a1edfea0a2 commit a89e7f4a5d8af8c009cac6b47b29d6a1edfea0a2 Author: Zamarin Arthur <arthurzam@gmail.com> AuthorDate: 2021-05-03 14:47:14 +0000 Commit: Zamarin Arthur <arthurzam@gmail.com> CommitDate: 2021-05-03 14:47:14 +0000 sys-process/iotop-c: fix compilation with llvm[-gold] The makefile adds LTO by default, resulting in failed compilation when using llvm without gold. By Adding `NO_FLTO=1` we disable LTO and it compiles. Closes: https://bugs.gentoo.org/785538 Signed-off-by: Zamarin Arthur <arthurzam@gmail.com> sys-process/iotop-c/iotop-c-1.17-r1.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)