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

Bug 568320

Summary: dev-libs/gmp[pgo] fails to build on arm with error: unknown type name 'clock_gettime'
Product: Gentoo Linux Reporter: tt_1 <herrtimson>
Component: [OLD] UnspecifiedAssignee: Gentoo Toolchain Maintainers <toolchain>
Severity: normal CC: arm, conikost
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: compressed build.log
output of emerge --info

Description tt_1 2015-12-15 10:02:01 UTC
Created attachment 419264 [details]
compressed build.log

see attached build.log for further details.
Comment 1 tt_1 2015-12-15 10:03:48 UTC
Created attachment 419266 [details]
output of emerge --info
Comment 2 Conrad Kostecki gentoo-dev 2016-01-03 22:37:37 UTC
+1 same problem here
Comment 3 Conrad Kostecki gentoo-dev 2016-01-05 18:58:46 UTC
That error is caused by LDFLAGS="-Wl,--as-needed".

When "-Wl,--as-needed" is not set, this error is gone. But after that, I am still unable to compile dev-libs/gmp[pgo], because I am hitting a new error:

libtool: compile:  armv7a-hardfloat-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-libs/gmp-6.1.0/work/gmp-6.1.0/mpz -I.. -D__GMP_WITHIN_GMP -I/var/tmp/portage/dev-libs/gmp-6.1.0/work/gmp-6.1.0 -march=armv7ve -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mtune=cortex-a7 -O3 -mfloat-abi=hard -mthumb -pipe -fomit-frame-pointer -c /var/tmp/portage/dev-libs/gmp-6.1.0/work/gmp-6.1.0/mpz/bin_uiui.c  -fPIC -DPIC -o .libs/bin_uiui.o
In file included from /var/tmp/portage/dev-libs/gmp-6.1.0/work/gmp-6.1.0/mpz/array_init.c:32:0:
/var/tmp/portage/dev-libs/gmp-6.1.0/work/gmp-6.1.0/gmp-impl.h:1384:34: error: unknown type name ‘mp_srcptv’
 __GMP_DECLSPEC void      mpn_toom44_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
Comment 4 . 2016-07-09 12:16:13 UTC
fails for armv6 too
Comment 5 Conrad Kostecki gentoo-dev 2016-11-17 23:07:25 UTC
Created attachment 453690 [details, diff]

Placing that patch fixed this for me.

The cause is simple.
When USE="pgo" is set, the eBuild runs:
./tune/tuneup | tee

Apparently, something does wrong and the string "clock_gettime is 1.000ns accurate" is beeing written to (which is later moved to gmp-mparam.h)
Comment 6 tt_1 2016-11-18 19:09:31 UTC
Problem solved, thanks a lot! 

This is a bit off the topic, but are there any speedtests to see wether the use of pgo speeds up something in the end?
Comment 7 . 2016-11-19 15:07:52 UTC
(In reply to tt_1 from comment #6)
> This is a bit off the topic, but are there any speedtests to see wether the
> use of pgo speeds up something in the end?

It definitely does not. Which is also the reason why every major compiler includes this technology.
Comment 8 SpanKY gentoo-dev 2016-11-26 21:54:22 UTC
thanks guys.  i've sent a patch upstream for the issue.  let's see what they have to say about it.
Comment 9 SpanKY gentoo-dev 2016-11-27 01:07:34 UTC
upstream has merged the fix, so pushed on our side: