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

Bug 556692

Summary: dev-lang/ruby-2.1.6-r1 on armv6 - bignum.o: In function `bary_pack': bignum.c:(.text+0x4198): undefined reference to `__builtin_bswap16'
Product: Gentoo Linux Reporter: Michael Gorbach <michael>
Component: [OLD] DevelopmentAssignee: Gentoo Ruby Team <ruby>
Status: RESOLVED TEST-REQUEST    
Severity: normal CC: arm
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
emerge --info

Description Michael Gorbach 2015-08-04 20:04:01 UTC
The newly-stable ruby-2.1 fails to compile on my Raspberry Pi (Linux ansiblePiPrime 3.12.19+ #1 PREEMPT Sat May 10 11:38:35 EDT 2014 armv6l BCM2708 GNU/Linux).

armv6j-hardfloat-linux-gnueabi-gcc -O2 -pipe -march=armv6j -mfpu=vfp -mfloat-abi=hard -fno-strict-aliasing -fPIC  -L. -Wl,-O1 -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic -Wl,--no-undefined -fstack-protector -Wl,-O1 -Wl,--as-needed main.o dmydln.o miniinit.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.
o dln_find.o encoding.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o node.o numeric.o object.o pack.o parse.o process
.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time
.o transcode.o util.o variable.o version.o compile.o debug.o iseq.o vm.o vm_dump.o vm_backtrace.o vm_trace.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.
o strlcpy.o strlcat.o setproctitle.o addr2line.o  dmyext.o   -lpthread -lgmp -ldl -lcrypt -lm   -o miniruby
bignum.o: In function `bary_pack':
bignum.c:(.text+0x4198): undefined reference to `__builtin_bswap16'
bignum.c:(.text+0x427c): undefined reference to `__builtin_bswap16'
bignum.o: In function `bary_unpack_internal':
bignum.c:(.text+0x48a4): undefined reference to `__builtin_bswap16'
collect2: error: ld returned 1 exit status
Makefile:203: recipe for target 'miniruby' failed
make: *** [miniruby] Error 1
 * ERROR: dev-lang/ruby-2.1.6-r1::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=dev-lang/ruby-2.1.6-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/ruby-2.1.6-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-lang/ruby-2.1.6-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/ruby-2.1.6-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-lang/ruby-2.1.6-r1/work/ruby-2.1.6'
 * S: '/var/tmp/portage/dev-lang/ruby-2.1.6-r1/work/ruby-2.1.6'
Comment 1 Michael Gorbach 2015-08-04 20:04:33 UTC
Created attachment 408310 [details]
build.log
Comment 2 Michael Gorbach 2015-08-04 20:04:54 UTC
Created attachment 408312 [details]
emerge --info
Comment 3 Michael Gorbach 2015-08-04 20:07:14 UTC
Note that this emerge --info was taken after I removed the ruby21 value in RUBY_TARGETS and re-masked ruby21 (to work around this build failure).
Comment 4 Hans de Graaff gentoo-dev Security 2016-06-08 11:09:31 UTC
@arm: any advice on how to handle this?
Comment 5 Anthony Basile gentoo-dev 2016-06-08 11:46:51 UTC
(In reply to Hans de Graaff from comment #4)
> @arm: any advice on how to handle this?

I don't have armv6 only armv7.  __builtin_bswap16() should be provided by <linux/swab.h>.  make sure that file is included in bignum.c and that __HAVE_BUILTIN_BSWAP16__ gets defined somewhere.
Comment 6 Anthony Basile gentoo-dev 2016-06-08 11:49:09 UTC
(In reply to Anthony Basile from comment #5)
> (In reply to Hans de Graaff from comment #4)
> > @arm: any advice on how to handle this?
> 
> I don't have armv6 only armv7.  __builtin_bswap16() should be provided by
> <linux/swab.h>.  make sure that file is included in bignum.c and that
> __HAVE_BUILTIN_BSWAP16__ gets defined somewhere.

I should add that I'm assuming this is a glibc system from your toolchain tuple in comment #0.  but just in case, if you're using uclibc, note that swab.h has problems in uclibc.  I sent the fix upstream and it was accepted by uclibc-ng.  the original uclibc is somewhat dead these days.
Comment 7 Hans de Graaff gentoo-dev Security 2016-06-11 06:46:29 UTC
Could you try with ruby 2.1.9 instead? 2.1.6-r1 is no longer available and this problem may have been fixed in the meantime.