Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 558406 - dev-libs/libaio: libaio.so link fails when using various compiler settings due to use of -nostdlib -nostartfiles
Summary: dev-libs/libaio: libaio.so link fails when using various compiler settings du...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: Normal minor
Assignee: Göktürk Yüksek
URL: https://bugs.debian.org/cgi-bin/bugre...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-22 09:02 UTC by Marek Paśnikowski
Modified: 2015-12-05 22:00 UTC (History)
4 users (show)

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


Attachments
Complete failed build log. (build.log,7.12 KB, text/plain)
2015-08-23 09:39 UTC, Marek Paśnikowski
Details
emerge --info (emerge-info.txt,6.05 KB, text/plain)
2015-08-23 17:44 UTC, Marek Paśnikowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Paśnikowski 2015-08-22 09:02:38 UTC
The library fails to compile with 32-bit ABI enabled on an AMD64 system.
If I switch the flag off for this package only, it compiles correctly.

Reproducible: Always

Steps to Reproduce:
1. Enable ABI_X86="32" for the package.
Actual Results:  
The compilation fails.

Expected Results:  
Compilation succeeds.

make[1]: Entering directory '/var/tmp/portage/dev-libs/libaio-0.3.110/work/libaio-0.3.110-abi_x86_32.x86/src'
x86_64-pc-linux-gnu-gcc [...snip out successfully compiled files...]
x86_64-pc-linux-gnu-gcc -m32 -shared -march=k8-sse3 -mmmx -m3dnow -msse -msse2 -msse3 -mcx16 -msahf -mprfchw -mfxsr --param l1-cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=k8 -fstack-protector-strong -O3 -pipe -nostdlib -nostartfiles -Wall -I. -fPIC  -Wl,--version-script=libaio.map -Wl,-soname=libaio.so.1 -o libaio.so.1.0.1 io_queue_init.os io_queue_release.os io_queue_wait.os io_queue_run.os io_getevents.os io_submit.os io_cancel.os io_setup.os io_destroy.os raw_syscall.os compat-0_1.os  -Wl,-O1 -Wl,--as-needed
io_queue_run.os: In function `io_queue_run':
io_queue_run.c:(.text+0x8a): undefined reference to `__stack_chk_fail_local'
io_getevents.os: In function `__io_getevents_0_4':
io_getevents.c:(.text+0x51): undefined reference to `__stack_chk_fail_local'
compat-0_1.os: In function `compat0_1_io_cancel':
compat-0_1.c:(.text+0x4a): undefined reference to `__stack_chk_fail_local'
compat-0_1.os: In function `compat0_1_io_queue_wait':
compat-0_1.c:(.text+0xdd): undefined reference to `__stack_chk_fail_local'
compat-0_1.os: In function `compat0_1_io_getevents':
compat-0_1.c:(.text+0x17d): undefined reference to `__stack_chk_fail_local'
collect2: error: ld returned 1 exit status
Makefile:55: recipe for target 'libaio.so.1.0.1' failed
make[1]: *** [libaio.so.1.0.1] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-libs/libaio-0.3.110/work/libaio-0.3.110-abi_x86_32.x86/src'
Makefile:15: recipe for target 'all' failed
make: *** [all] Error 2
Comment 1 Rafał Mużyło 2015-08-22 10:35:53 UTC
Attach full build log.
Comment 2 Marek Paśnikowski 2015-08-23 09:39:34 UTC
Created attachment 409910 [details]
Complete failed build log.

As requested, I attach hereby the build log of the failed emerge.
Comment 3 Rafał Mużyło 2015-08-23 14:49:24 UTC
OK, 'emerge --info' might help too.
Comment 4 Marek Paśnikowski 2015-08-23 17:44:27 UTC
Created attachment 409956 [details]
emerge --info

Should I always post the build log and emerge info when reporting a compilation fail, no matter what I think about usefulness of this information? I am still not fully aware of the good practices in this bugzilla.
Comment 5 Göktürk Yüksek archtester gentoo-dev 2015-08-25 03:18:35 UTC
(In reply to Marek Paśnikowski from comment #4)
> Created attachment 409956 [details]
> emerge --info
> 
> Should I always post the build log and emerge info when reporting a
> compilation fail, no matter what I think about usefulness of this
> information? I am still not fully aware of the good practices in this
> bugzilla.

It's especially useful in compilation errors as it lets us see the compiler configuration etc.
Comment 6 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2015-08-25 04:54:12 UTC
test email to gokturk
Comment 7 Göktürk Yüksek archtester gentoo-dev 2015-09-13 21:37:58 UTC
I see that you are compiling with '-O3'. Can you try with '-O2' and see if it helps?
Comment 8 SpanKY gentoo-dev 2015-09-18 19:16:36 UTC
please try upgrading to binutils-2.25.1-r1
Comment 9 Marek Paśnikowski 2015-09-18 19:51:42 UTC
I apologise for forgetting to reply to the comment about test of -O2.
I am extremely busy right now and made the mistake of reading the email during break at work, so it slipped my mind pretty fast.
Anyway I have a day off this next sunday, so I will post the result then. But I doubt this will have any effect as I actually kept rebuilding the @world from -O0 to -O1 to -O3 during the span of last couple of months; It never had compiled successfully with with the 32 ABI.
As for binutils is concerned I have the newest keyworded version installed: 2.25.1-r1
But I just realised that it may have been updated after my last test of libaio, so I will give it a go this Sunday.
Comment 10 Marek Paśnikowski 2015-09-21 04:15:44 UTC
I am a bit late because I got a new laptop and got busy with with making design decisions for the new system. One of those decision was to go with simple march=native instead of output of "gcc -march=native -E -v - </dev/null 2>&1 | grep cc1" that I found in the CFLAGS wiki page. Now that I took a look apparently I also had decided to remove some of the switches. I think this the trigger, from the same page: "Note that the -mno-XXX options should not be used globally as they will cause build failures for some packages."
Anyway, just now I decided to change the big string back to the simple "-march=native" and got a positive result. It builds on both -O2 and -O3 level.
So it seems that even though I tried to avoid it, I managed to "rice" my system just a little bit and libaio was the victim here. You have my apologies for that.
Comment 11 Alexander Tsoy 2015-09-21 18:03:18 UTC
I reproduced this bug after adding '-fstack-protector-strong' to CFLAGS (it also present in attached `emerge --info`). Upgrade to binutils-2.25.1-r1 didn't help.
Comment 12 SpanKY gentoo-dev 2015-09-21 18:36:22 UTC
the libaio.so link uses -nostdlib -nostartfiles which means it does not link in any C library or gcc libs.  this in turn causes problems like this.  it comes up with SSP, but can probably be seen with other optimizations.  not a bug in the toolchain at all.

probably easiest thing would be to remove the use of those two flags.  upstream does it because they want to be slim/lightweight and minimize ABI dependencies.  none of that is really relevant to us.
Comment 13 Göktürk Yüksek archtester gentoo-dev 2015-11-29 01:34:33 UTC
Pull request submitted: https://github.com/gentoo/gentoo/pull/414