Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 657184 - Sandbox does not build with slibtool on x86 hardware
Summary: Sandbox does not build with slibtool on x86 hardware
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Sandbox (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Sandbox Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-03 00:34 UTC by orbea
Modified: 2019-05-11 17:00 UTC (History)
2 users (show)

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


Attachments
dlibtool build log (sandbox.dlibtool.log,81.68 KB, text/x-log)
2018-06-03 00:34 UTC, orbea
Details
Patch to fix the build with slibtool. (slibtool.patch,454 bytes, patch)
2018-06-03 00:36 UTC, orbea
Details | Diff
Alternative slibtool patch. (slibtool2.patch,445 bytes, patch)
2018-06-03 13:02 UTC, orbea
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description orbea 2018-06-03 00:34:52 UTC
Created attachment 534602 [details]
dlibtool build log

When building sandbox with slibtool instead of libtool on a 32-bit linux install I encounter a build issues with undefined for '__umoddi3' and '__udivdi3'. From some research these appear to caused by 64-bit arithmetic functions where libgcc.a is required on 32-bit platforms. This can be fixed by explicitly added as a dependency for libsbutil and has been tested on 32-bit and 64-bit installs with libtool and slibtool using gcc and clang.

My presumption is that libtool is secretly adding this dependency and does not fail as a result.

I've attached a full build log with dlibtool and a patch that resolves this.

Additionally the following issue is similar, but not the same.

https://bugs.gentoo.org/show_bug.cgi?id=656184
Comment 1 orbea 2018-06-03 00:36:25 UTC
Created attachment 534604 [details, diff]
Patch to fix the build with slibtool.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-06-03 06:42:16 UTC
Comment on attachment 534604 [details, diff]
Patch to fix the build with slibtool.

Thank you for your patch.  However, adding '-lgcc' is clearly wrong for users of compilers other than GCC, in particular clang with compiler-rt.
Comment 3 orbea 2018-06-03 13:01:19 UTC
Thanks for the reply. Yes I was told in #midipix where slibtool development is discussed that this is wrong after I made this.

00:29 <@midipix> orbea: the problem is that sandbox passes -nodefaultlibs
00:30 <@midipix> (and then manually passes -lc, which surely defeats the purpose of -nodefaultlibs)

Removing -nodefaultlibs from libsandbox/Makefile.am also seems to work and I've attached another example patch.

Of course if a better solution can be found that is preferred.
Comment 4 orbea 2018-06-03 13:02:06 UTC
Created attachment 534634 [details, diff]
Alternative slibtool patch.
Comment 5 orbea 2018-07-16 14:32:53 UTC
The slibtool dev took a closer look at this issue and the problem is that libtool has a list of "known" linker flags and will swallow any which are not on this list. Its possible to grep the generated libtool in the build directory for any linker flags and since 'nodefaultlibs' does not return any output its not on this list. The result is that libtool swallows '-nodefaultlibs' and it is never passed to the compiler driver (gcc), it has no effect with builds using GNU libtool.

On the other hand slibtool does not have this behavior and will pass '-nodefaultlibs' to the compiler even if this is not correct.

The second patch which removes '-nodefaultlibs' from libsandbox/Makefile.am should be the correct and portable solution.
Comment 6 Larry the Git Cow gentoo-dev 2018-07-19 11:50:30 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=8bb9e5e7607ff12f8119729077d3d420e999f7ee

commit 8bb9e5e7607ff12f8119729077d3d420e999f7ee
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-07-19 11:27:09 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-07-19 11:27:09 +0000

    libsandbox: Remove meaningless/broken -nodefaultlibs
    
    Remove '-nodefaultlibs' from linking flags for libsandbox as it is
    apparently meaningless and broken at the same time.  When regular
    libtool is used, it silently strips the option, making it meaningless.
    When slibtool is used instead, it passes the option which causes linking
    to fail due to undefined symbols.
    
    Thanks to the bug reporter and slibtool devs from researching
    the problem in detail.
    
    Bug: https://bugs.gentoo.org/657184

 libsandbox/Makefile.am | 1 -
 1 file changed, 1 deletion(-)
Comment 7 orbea 2019-05-11 17:00:50 UTC
Forgot to set this as fixed.