Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 785538 - [guru] sys-process/iotop-c-1.17-r1 fails to compile
Summary: [guru] sys-process/iotop-c-1.17-r1 fails to compile
Status: RESOLVED FIXED
Alias: None
Product: GURU
Classification: Unclassified
Component: Package issues (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Arthur Zamarin
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-25 08:56 UTC by Agostino Sarubbo
Modified: 2021-05-03 16:57 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,30.14 KB, text/plain)
2021-04-25 08:56 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2021-04-25 08:56:24 UTC
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.
Comment 1 Agostino Sarubbo gentoo-dev 2021-04-25 08:56:26 UTC
Created attachment 702354 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2021-04-25 08:56:27 UTC
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)
Comment 3 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2021-04-25 12:53:04 UTC
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.
Comment 4 James Beddek 2021-04-25 13:10:58 UTC
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
Comment 5 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2021-04-25 13:16:44 UTC
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.
Comment 6 James Beddek 2021-04-25 13:32:43 UTC
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
Comment 7 Larry the Git Cow gentoo-dev 2021-05-03 16:57:08 UTC
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(-)