Summary: | dev-libs/libtommath-0.42.0 cross compilation fix | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Bertrand Jacquin <bertrand> |
Component: | Current packages | Assignee: | Thomas Sachau <tommy> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | chewi, dmbohdan, dustin, embedded, hrubi, jer, jlec, lannocc, luca.postregna, prefix, swapon, vapier, ztcoils |
Priority: | Normal | Keywords: | InVCS, PATCH |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | http://groups.google.com/group/libtom/browse_thread/thread/86a140fff35568b6/01315200ebf2f72e?lnk=gst&q=libtool#01315200ebf2f72e | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
dev-libs/libtommath-BJA-LT.diff
handle LT in makefile.shared |
Description
Bertrand Jacquin
2011-07-27 18:46:08 UTC
Created attachment 281187 [details, diff]
dev-libs/libtommath-BJA-LT.diff
Created attachment 281189 [details, diff]
handle LT in makefile.shared
*** Bug 328289 has been marked as a duplicate of this bug. *** Looks interesting. You could report this upstream at [1]. [1] http://groups.google.com/group/libtom Is this still valid for libtommath-0.42-r1? (In reply to comment #5) > Is this still valid for libtommath-0.42-r1? It is ! And reported upstream as http://groups.google.com/group/libtom/browse_thread/thread/86a140fff35568b6/01315200ebf2f72e?lnk=gst&q=libtool#01315200ebf2f72e I've got the same error with arm cross compiler libtool --mode=link --tag=CC armv6z-rpi-linux-uclibceabi-gcc -L/usr/armv6z-rpi-linux-uclibceabi/lib -L/usr/armv6z-rpi-linux-uclibceabi/usr/lib *.lo -o libtommath.la -rpath /usr/lib -version-info 0:41 libtool: link: x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/bncore.o .libs/bn_error.o .libs/bn_fast_mp_invmod.o .libs/bn_fast_mp_montgomery_reduce.o .libs/bn_fast_s_mp_mul_digs.o .libs/bn_fast_s_mp_mul_high_digs.o .libs/bn_fast_s_mp_sqr.o .libs/bn_mp_2expt.o .libs/bn_mp_abs.o .libs/bn_mp_add_d.o .libs/bn_mp_add.o .libs/bn_mp_addmod.o .libs/bn_mp_and.o .libs/bn_mp_clamp.o .libs/bn_mp_clear.o .libs/bn_mp_clear_multi.o .libs/bn_mp_cmp_d.o .libs/bn_mp_cmp.o .libs/bn_mp_cmp_mag.o .libs/bn_mp_cnt_lsb.o .libs/bn_mp_copy.o .libs/bn_mp_count_bits.o .libs/bn_mp_div_2d.o .libs/bn_mp_div_2.o .libs/bn_mp_div_3.o .libs/bn_mp_div_d.o .libs/bn_mp_div.o .libs/bn_mp_dr_is_modulus.o .libs/bn_mp_dr_reduce.o .libs/bn_mp_dr_setup.o .libs/bn_mp_exch.o .libs/bn_mp_expt_d.o .libs/bn_mp_exptmod_fast.o .libs/bn_mp_exptmod.o .libs/bn_mp_exteuclid.o .libs/bn_mp_fread.o .libs/bn_mp_fwrite.o .libs/bn_mp_gcd.o .libs/bn_mp_get_int.o .libs/bn_mp_grow.o .libs/bn_mp_init_copy.o .libs/bn_mp_init.o .libs/bn_mp_init_multi.o .libs/bn_mp_init_set_int.o .libs/bn_mp_init_set.o .libs/bn_mp_init_size.o .libs/bn_mp_invmod.o .libs/bn_mp_invmod_slow.o .libs/bn_mp_is_square.o .libs/bn_mp_jacobi.o .libs/bn_mp_karatsuba_mul.o .libs/bn_mp_karatsuba_sqr.o .libs/bn_mp_lcm.o .libs/bn_mp_lshd.o .libs/bn_mp_mod_2d.o .libs/bn_mp_mod_d.o .libs/bn_mp_mod.o .libs/bn_mp_montgomery_calc_normalization.o .libs/bn_mp_montgomery_reduce.o .libs/bn_mp_montgomery_setup.o .libs/bn_mp_mul_2d.o .libs/bn_mp_mul_2.o .libs/bn_mp_mul_d.o .libs/bn_mp_mul.o .libs/bn_mp_mulmod.o .libs/bn_mp_neg.o .libs/bn_mp_n_root.o .libs/bn_mp_or.o .libs/bn_mp_prime_fermat.o .libs/bn_mp_prime_is_divisible.o .libs/bn_mp_prime_is_prime.o .libs/bn_mp_prime_miller_rabin.o .libs/bn_mp_prime_next_prime.o .libs/bn_mp_prime_rabin_miller_trials.o .libs/bn_mp_prime_random_ex.o .libs/bn_mp_radix_size.o .libs/bn_mp_radix_smap.o .libs/bn_mp_rand.o .libs/bn_mp_read_radix.o .libs/bn_mp_read_signed_bin.o .libs/bn_mp_read_unsigned_bin.o .libs/bn_mp_reduce_2k_l.o .libs/bn_mp_reduce_2k.o .libs/bn_mp_reduce_2k_setup_l.o .libs/bn_mp_reduce_2k_setup.o .libs/bn_mp_reduce_is_2k_l.o .libs/bn_mp_reduce_is_2k.o .libs/bn_mp_reduce.o .libs/bn_mp_reduce_setup.o .libs/bn_mp_rshd.o .libs/bn_mp_set_int.o .libs/bn_mp_set.o .libs/bn_mp_shrink.o .libs/bn_mp_signed_bin_size.o .libs/bn_mp_sqr.o .libs/bn_mp_sqrmod.o .libs/bn_mp_sqrt.o .libs/bn_mp_sub_d.o .libs/bn_mp_sub.o .libs/bn_mp_submod.o .libs/bn_mp_toom_mul.o .libs/bn_mp_toom_sqr.o .libs/bn_mp_toradix.o .libs/bn_mp_toradix_n.o .libs/bn_mp_to_signed_bin.o .libs/bn_mp_to_signed_bin_n.o .libs/bn_mp_to_unsigned_bin.o .libs/bn_mp_to_unsigned_bin_n.o .libs/bn_mp_unsigned_bin_size.o .libs/bn_mp_xor.o .libs/bn_mp_zero.o .libs/bn_prime_tab.o .libs/bn_reverse.o .libs/bn_s_mp_add.o .libs/bn_s_mp_exptmod.o .libs/bn_s_mp_mul_digs.o .libs/bn_s_mp_mul_high_digs.o .libs/bn_s_mp_sqr.o .libs/bn_s_mp_sub.o -L/usr/armv6z-rpi-linux-uclibceabi/lib -L/usr/armv6z-rpi-linux-uclibceabi/usr/lib -Wl,-soname -Wl,libtommath.so.0 -o .libs/libtommath.so.0.0.41 /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/bn_error.o: Relocations in generic ELF (EM: 40) /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/bn_error.o: Relocations in generic ELF (EM: 40) .libs/bn_error.o: could not read symbols: File in wrong format collect2: ld returned 1 exit status Same problem when cross-compiling for ARM. Please do not CC arch teams. Comment on attachment 281187 [details, diff]
dev-libs/libtommath-BJA-LT.diff
ROOT should never be used in src_* steps
this also doesn't make much sense upstream. really upstream should be bundling+generating libtool as part of the normal autotool process, but i can't see that happening anytime soon.
The patch alone did not work for me. I too am cross-compiling for ARM (on x86). Here's what I had to do to get a successful compile: 1. Build libtool for ARM: $ armv6j-hardfloat-linux-gnueabi-emerge libtool -va 2. Download the patch supplied here 3. Edit LT definition in patch to use the ARM libtool: +LT = /usr/armv6j-hardfloat-linux-gnueabi/usr/bin/libtool Obviously #3 is a hack specific to my system and use. Somebody more in the know can fix it to auto-detect the right libtool to use. With these steps done (in a local portage overlay) I was able to successfully compile libtommath for ARM. -shawn (In reply to comment #11) > The patch alone did not work for me. I too am cross-compiling for ARM (on > x86). Here's what I had to do to get a successful compile: > > 1. Build libtool for ARM: $ armv6j-hardfloat-linux-gnueabi-emerge libtool -va > 2. Download the patch supplied here > 3. Edit LT definition in patch to use the ARM libtool: +LT = > /usr/armv6j-hardfloat-linux-gnueabi/usr/bin/libtool > > Obviously #3 is a hack specific to my system and use. Somebody more in the > know can fix it to auto-detect the right libtool to use. With these steps > done (in a local portage overlay) I was able to successfully compile > libtommath for ARM. You don't need #3 if you also use patch that have invalidated in https://bugs.gentoo.org/show_bug.cgi?id=376643#c10 Patch is here https://bugs.gentoo.org/attachment.cgi?id=281187 Ran into this bug when cross compiling for armv7a-hardfloat-linux-gnueabi, the attached patch and one mentioned below solved the problem for me. The overlay ebuilds I used are available here: http://digitalbytes.net/gentoo/lostwoods/dev-libs/libtommath/ Note: I modified both ebuilds but only tested version 0.42.0 *** Bug 460030 has been marked as a duplicate of this bug. *** (In reply to comment #10) > Comment on attachment 281187 [details, diff] [details, diff] > dev-libs/libtommath-BJA-LT.diff > > ROOT should never be used in src_* steps > > this also doesn't make much sense upstream. really upstream should be > bundling+generating libtool as part of the normal autotool process, but i > can't see that happening anytime soon. upstream does not seem to care about this so we need to carry this patch ourselves. I think the ebuild diff you invalidated would be fine if you replace ROOT with EPREFIX wouldn't it? I will do some more tests and if they work for me I will commit it as this breaks every cross-compilation out there (In reply to comment #15) > (In reply to comment #10) > > Comment on attachment 281187 [details, diff] [details, diff] [details, diff] > > dev-libs/libtommath-BJA-LT.diff > > > > ROOT should never be used in src_* steps > > > > this also doesn't make much sense upstream. really upstream should be > > bundling+generating libtool as part of the normal autotool process, but i > > can't see that happening anytime soon. > > upstream does not seem to care about this so we need to carry this patch > ourselves. I think the ebuild diff you invalidated would be fine if you > replace ROOT with EPREFIX wouldn't it? > > I will do some more tests and if they work for me I will commit it as this > breaks every cross-compilation out there Thanks to take care of it markos :) How about this one? Index: libtommath-0.42.0-r1.ebuild =================================================================== RCS file: /var/cvsroot/gentoo-x86/dev-libs/libtommath/libtommath-0.42.0-r1.ebuild,v retrieving revision 1.5 diff -u -B -u -r1.5 libtommath-0.42.0-r1.ebuild --- libtommath-0.42.0-r1.ebuild 28 Mar 2013 15:43:01 -0000 1.5 +++ libtommath-0.42.0-r1.ebuild 21 Apr 2013 15:06:06 -0000 @@ -25,7 +25,10 @@ } src_compile() { - emake CC=$(tc-getCC) -f makefile.shared IGNORE_SPEED=1 LIBPATH="${EPREFIX}/usr/$(get_libdir)" + local sysroot="$(tc-getCC) -print-sysroot" + emake CC=$(tc-getCC) -f makefile.shared \ + IGNORE_SPEED=1 LIBPATH="${EPREFIX}/usr/$(get_libdir)" \ + LT="$(eval $sysroot)/usr/bin/libtool" } src_install() { (In reply to comment #17) > How about this one? > > src_compile() { > - emake CC=$(tc-getCC) -f makefile.shared IGNORE_SPEED=1 > LIBPATH="${EPREFIX}/usr/$(get_libdir)" > + local sysroot="$(tc-getCC) -print-sysroot" > + emake CC=$(tc-getCC) -f makefile.shared \ > + IGNORE_SPEED=1 LIBPATH="${EPREFIX}/usr/$(get_libdir)" \ > + LT="$(eval $sysroot)/usr/bin/libtool" Why eval() should be needed ? Also, GCC sysroot may not be the same as gentoo SYSROOT. EPREFIX can't do the trick for LT here ? I'm not a gentoo dev so I don't really known if using gcc -print-sysroot is better than using SYSROOT. Not sure (In reply to comment #18) > (In reply to comment #17) > > How about this one? > > > > src_compile() { > > - emake CC=$(tc-getCC) -f makefile.shared IGNORE_SPEED=1 > > LIBPATH="${EPREFIX}/usr/$(get_libdir)" > > + local sysroot="$(tc-getCC) -print-sysroot" > > + emake CC=$(tc-getCC) -f makefile.shared \ > > + IGNORE_SPEED=1 LIBPATH="${EPREFIX}/usr/$(get_libdir)" \ > > + LT="$(eval $sysroot)/usr/bin/libtool" > > Why eval() should be needed ? because you want to run the $sysroot as command > Also, GCC sysroot may not be the same as > gentoo SYSROOT. what does that mean? > > I'm not a gentoo dev so I don't really known if using gcc -print-sysroot is > better than using SYSROOT. Not sure SYSROOT is not a Gentoo/Portage exported variable. -print-sysroot should print the --with-sysroot command executed when you built your cross-compile. EPREFIX is empty on my system (In reply to comment #19) > (In reply to comment #18) > > (In reply to comment #17) > > > How about this one? > > > > > > src_compile() { > > > - emake CC=$(tc-getCC) -f makefile.shared IGNORE_SPEED=1 > > > LIBPATH="${EPREFIX}/usr/$(get_libdir)" > > > + local sysroot="$(tc-getCC) -print-sysroot" > > > + emake CC=$(tc-getCC) -f makefile.shared \ > > > + IGNORE_SPEED=1 LIBPATH="${EPREFIX}/usr/$(get_libdir)" \ > > > + LT="$(eval $sysroot)/usr/bin/libtool" > > > > Why eval() should be needed ? > > because you want to run the $sysroot as command True, misread, sorry. > > Also, GCC sysroot may not be the same as > > gentoo SYSROOT. > > what does that mean? $ROOT not always = $SYSROOT when cross compiling, and generally is not. > > I'm not a gentoo dev so I don't really known if using gcc -print-sysroot is > > better than using SYSROOT. Not sure > SYSROOT is not a Gentoo/Portage exported variable. -print-sysroot should > print the --with-sysroot command executed when you built your cross-compile. > > EPREFIX is empty on my system Maybe we need to approach someone closer to x-compile issue like this (vapier) ? I really don't known what is better here. (In reply to comment #20) > > $ROOT not always = $SYSROOT when cross compiling, and generally is not. True. > > Maybe we need to approach someone closer to x-compile issue like this > (vapier) ? I really don't known what is better here. Would it be preferred for libtommath ebuild to download and build libtool if a cross-compiler is detected? (In reply to comment #21) > > > > Maybe we need to approach someone closer to x-compile issue like this > > (vapier) ? I really don't known what is better here. > > Would it be preferred for libtommath ebuild to download and build libtool if > a cross-compiler is detected? Mike would you be happy with this ^^^ ? (In reply to comment #22) no, don't do that. you could create a small configure.ac that sets up libtool for you and then gen autotools as part of the build. cat <<-EOF > configure.ac AC_INIT(libtommath, 0) AM_INIT_AUTOMAKE LT_INIT AC_CONFIG_FILES(Makefile) AC_OUTPUT EOF touch NEWS README AUTHORS ChangeLog Makefile.am eautoreconf then you can use $S/libtool at build time (In reply to comment #23) > (In reply to comment #22) Thanks. I committed the following patch. I am also cc'ing the prefix people so they can tell me if everything is still ok for them + 23 Apr 2013; Markos Chandras <hwoarang@gentoo.org> + libtommath-0.42.0-r1.ebuild, files/libtommath-0.42.0-makefile.patch: + Create a minimal configure.ac file to build libtool. Fixes cross compilation + problems reported in bug #376643. Thanks to Bertrand Jacquin + <beber@meleeweb.net> for the upstream patch and Mike Frysinger + <vapier@gentoo.org> for the suggestions. + http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libtommath/libtommath-0.42.0-r1.ebuild?r1=1.5&r2=1.6 http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libtommath/files/libtommath-0.42.0-makefile.patch?r1=1.2&r2=1.3 (In reply to comment #24) i don't think we need the darwin code path. it can do the same thing as the non-darwin code. this is how most packages in the tree build. i've made that change and some other random cleanups. if other packages want this behavior, we might consider moving the code to autotools eclass. i know apache packages have a history of problems here. http://sources.gentoo.org/dev-libs/libtommath/libtommath-0.42.0-r1.ebuild?r1=1.6&r2=1.7 http://sources.gentoo.org/dev-libs/libtommath/files/libtommath-0.42.0-makefile.patch?r1=1.3&r2=1.4 |