Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 732026 - dev-libs/ustr fails to compile
Summary: dev-libs/ustr fails to compile
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sven Eden
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2020-07-10 08:04 UTC by Agostino Sarubbo
Modified: 2020-11-13 21:31 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,19.74 KB, text/plain)
2020-07-10 08:05 UTC, Agostino Sarubbo
Details
Proposed patch (0001-dev-libs-ustr-Fix-compilation-using-clang-LLVM.patch,2.10 KB, patch)
2020-09-24 08:12 UTC, Fergus Dall
Details | Diff
Proposed patch (with ebuild update) (0001-dev-libs-ustr-Fix-compilation-using-clang-LLVM.patch,4.51 KB, patch)
2020-09-24 08:17 UTC, Fergus Dall
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2020-07-10 08:04:58 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-libs/ustr fails to compile.
Discovered on: amd64  (internal ref: 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. If you think that this issue isstrictly related to the LLD linker, please block bug 731004.
Comment 1 Agostino Sarubbo gentoo-dev 2020-07-10 08:05:04 UTC
Created attachment 648722 [details]
build.log

build log and emerge --info
Comment 2 Sven Eden 2020-08-23 15:12:51 UTC
Sorry for the late reply!

I'll look into it during the next week!
Comment 3 Fergus Dall 2020-09-24 08:12:08 UTC
Created attachment 662260 [details, diff]
Proposed patch

I ran into this myself today and did some investigating.

The library depends on the old/traditional GCC inline semantics. The gcc_5-check patch in files fixes this for GCC specifically by defining "inline" to mean "inline __attribute__ ((gnu_inline))" which restores this behaviour, but it detects this by specifically looking for a particular version of GCC and STDC, so it breaks on gcc-compatible compilers.

I believe changing this check to look for __GNUC_STDC_INLINE__ will fix this for clang.

See the compiler documentation here: 
https://clang.llvm.org/docs/AttributeReference.html#gnu-inline
https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Inline.html

I've attached a proposed patch, which appears to fix this issue.
Comment 4 Fergus Dall 2020-09-24 08:17:50 UTC
Created attachment 662263 [details, diff]
Proposed patch (with ebuild update)
Comment 5 Agostino Sarubbo gentoo-dev 2020-09-24 08:21:20 UTC
Hello, thanks for the patch. I believe you can speed up the process by making a pull-request via Github.
Comment 6 Sven Eden 2020-11-07 14:35:18 UTC
This is only relevant for clang/LLVM
But I assume the linker used is irrelevant.
Comment 7 Sven Eden 2020-11-07 15:02:34 UTC
@Agostino : Something is not right with your patch.

With gcc-9.3.0 I now get the "multiple definitions" errors here.
Comment 8 Agostino Sarubbo gentoo-dev 2020-11-07 15:11:40 UTC
(In reply to Sven Eden from comment #7)
> @Agostino : Something is not right with your patch.
> 
> With gcc-9.3.0 I now get the "multiple definitions" errors here.

Patch comes from Fergus
Comment 9 Sven Eden 2020-11-07 15:22:56 UTC
(In reply to Sven Eden from comment #7)
> @Agostino : Something is not right with your patch.
> 
> With gcc-9.3.0 I now get the "multiple definitions" errors here.

My fault. I also want to uplift the ebuild to EAPI 7 and forgot that the patches have to go into PATCHES array. Sorry!

And the patch is made by Fergus Dall, and not Agostino Sarubbo, of course.
Comment 10 Larry the Git Cow gentoo-dev 2020-11-13 21:31:30 UTC
The bug has been closed via the following commit(s):

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

commit a13790eb155f9c5740fb0c11b56ab2d81dd7f591
Author:     Fergus Dall <sidereal@google.com>
AuthorDate: 2020-09-24 08:08:39 +0000
Commit:     Aaron Bauman <bman@gentoo.org>
CommitDate: 2020-11-13 21:31:15 +0000

    dev-libs/ustr: Fix compilation using clang/LLVM
    
    This package depends on old-style GCC inline functions, but the
    patch to maintain this behaviour on newer compilers only works
    for GCC specifically. Replace this with a check for
    __GNUC_STDC_INLINE__, which is documented to work with both GCC
    and clang.
    
    Bug: https://bugs.gentoo.org/732026
    Closes: https://bugs.gentoo.org/732026
    Signed-off-by: Fergus Dall <sidereal@google.com>
    Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
    Signed-off-by: Aaron Bauman <bman@gentoo.org>

 dev-libs/ustr/files/ustr-1.0.4-inline-check.patch | 27 ++++++++
 dev-libs/ustr/ustr-1.0.4-r9.ebuild                | 83 +++++++++++++++++++++++
 2 files changed, 110 insertions(+)

Additionally, it has been referenced in the following commit(s):

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

commit a13790eb155f9c5740fb0c11b56ab2d81dd7f591
Author:     Fergus Dall <sidereal@google.com>
AuthorDate: 2020-09-24 08:08:39 +0000
Commit:     Aaron Bauman <bman@gentoo.org>
CommitDate: 2020-11-13 21:31:15 +0000

    dev-libs/ustr: Fix compilation using clang/LLVM
    
    This package depends on old-style GCC inline functions, but the
    patch to maintain this behaviour on newer compilers only works
    for GCC specifically. Replace this with a check for
    __GNUC_STDC_INLINE__, which is documented to work with both GCC
    and clang.
    
    Bug: https://bugs.gentoo.org/732026
    Closes: https://bugs.gentoo.org/732026
    Signed-off-by: Fergus Dall <sidereal@google.com>
    Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
    Signed-off-by: Aaron Bauman <bman@gentoo.org>

 dev-libs/ustr/files/ustr-1.0.4-inline-check.patch | 27 ++++++++
 dev-libs/ustr/ustr-1.0.4-r9.ebuild                | 83 +++++++++++++++++++++++
 2 files changed, 110 insertions(+)