Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 738948

Summary: dev-util/codeblocks-20.03-r1 fails to link with LLD because of /usr/lib in the link command line
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Sergey Torokhov <torokhov-s-a>
Status: RESOLVED FIXED    
Severity: normal CC: wxwidgets
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/17606
https://bugs.gentoo.org/show_bug.cgi?id=783705
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 731004    
Attachments: build.log
1-autoconf.out

Description Agostino Sarubbo gentoo-dev 2020-08-25 12:41:30 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-util/codeblocks-20.03-r1 fails to link with LLD because of /usr/lib in the link command line.
Discovered on: amd64 (internal ref: tinderbox)

NOTE:
This PR gives an idea about a fix: https://github.com/PhotoFlare/photoflare/pull/248/files.
Comment 1 Agostino Sarubbo gentoo-dev 2020-08-25 12:41:33 UTC
Created attachment 656608 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2020-08-25 12:41:34 UTC
Created attachment 656610 [details]
1-autoconf.out

1-autoconf.out
Comment 3 Sergey Torokhov 2020-08-25 14:16:01 UTC
(In reply to Agostino Sarubbo from comment #0)
> 
> NOTE:
> This PR gives an idea about a fix:
> https://github.com/PhotoFlare/photoflare/pull/248/files.

Maybe conditional patching with `get_libdir` function to use correct library path is worth to use?
Comment 4 Sergey Torokhov 2020-09-19 16:03:41 UTC
(In reply to Agostino Sarubbo from comment #0)
> https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/
> 
> Issue: dev-util/codeblocks-20.03-r1 fails to link with LLD because of
> /usr/lib in the link command line.
> Discovered on: amd64 (internal ref: tinderbox)
> 
> NOTE:
> This PR gives an idea about a fix:
> https://github.com/PhotoFlare/photoflare/pull/248/files.

The clang and llvm linker (lld) are used :) I didn't see at first.

I confirm that I can reproduce this issue by command:
> LDFLAGS="${LDFLAGS} -fuse-ld=lld" FEATURES="-ccache" USE="-contrib -fortran -pch" CC="clang" CXX="clang++" ebuild codeblocks-20.03-r1.ebuild clean compile


It's seems the problem with tinyxml.pc file provided by dev-lib/tinyxml.
When lld is used then pkgconfig tries to set variables directly from tinyxml.pc and  add them to LDFLAGS, i.e. -L/usr/lib -ltinyxml.

Could check if issue resolved if you replace in /usr/share/pkgconfig/tinyxml.pc
/lib with /lib64 ? It fix it for me with lld. 

It seems this is onny package where /lib is used instead of /lib64 for ~amd64 arch. If this is resolved issue then dev-libs/tinyxml could be updated with patching of tinyxml.pc with appropriate arch by (get_libdir). Sorry,  it's my early fault.
Comment 5 Larry the Git Cow gentoo-dev 2020-09-23 09:00:13 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f4675fd1036e0a31215bac7e994b5d26d7e1cd5

commit 4f4675fd1036e0a31215bac7e994b5d26d7e1cd5
Author:     Sergey Torokhov <torokhov-s-a@yandex.ru>
AuthorDate: 2020-09-19 23:01:28 +0000
Commit:     Bernard Cafarelli <voyageur@gentoo.org>
CommitDate: 2020-09-23 09:00:09 +0000

    dev-libs/tinyxml: fix libdir path in tinyxml.pc file
    
    While using clang/llvm/lld env the on configuration phase
    the information about library directory is taken from tinyxml.pc file.
    
    On the amd64 arch system the use of lld linker instead of ldd
    results in linking error as LDFLAGS is additionally filled with
    `-L/usr/lib -ltinyxml` instead of `-L/usr/lib64 -ltinyxml`.
    
    I.e. it causes linking error for dev-util/codeblocks package
    on clang/llvm/lld systems.
    
    Closes: https://bugs.gentoo.org/738948
    
    Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
    Closes: https://github.com/gentoo/gentoo/pull/17606
    Signed-off-by: Bernard Cafarelli <voyageur@gentoo.org>

 dev-libs/tinyxml/tinyxml-2.6.2-r4.ebuild | 67 ++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)