Created attachment 401340 [details] Complete build log for dev-libs/glib-2.40.2 Cross-compiling dev-libs/glib-2.40.2 for ARM fails during the install phase with the known error "File format not recognized". emerge --info Portage 2.2.14 (python 3.3.5-final-0, default/linux/amd64/13.0, gcc-4.8.4, glibc-2.20-r2, 3.11.0-12-generic x86_64) ================================================================= System uname: Linux-3.11.0-12-generic-x86_64-Intel-R-_Core-TM-_i5-3230M_CPU_@_2.60GHz-with-gentoo-2.2 KiB Mem: 8117664 total, 2080272 free KiB Swap: 8703996 total, 8703924 free Timestamp of tree: Tue, 14 Apr 2015 13:30:01 +0000 ld GNU ld (Gentoo 2.24 p1.4) 2.24 ccache version 3.1.9 [disabled] app-shells/bash: 4.2_p53 dev-lang/perl: 5.20.2 dev-lang/python: 2.7.9-r1, 3.3.5-r1 dev-util/ccache: 3.1.9-r4 dev-util/pkgconfig: 0.28-r2 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.13.11 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.69 sys-devel/automake: 1.13.4 sys-devel/binutils: 2.24-r3 sys-devel/gcc: 4.8.4 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4.6 sys-devel/make: 4.1-r1 sys-kernel/linux-headers: 3.18 (virtual/os-headers) sys-libs/glibc: 2.20-r2 Repositories: gentoo local crossdev ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=native -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe -march=native -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="fr_FR.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage/local /usr/local/portage/crossdev" USE="acl amd64 berkdb bindist bzip2 cli cracklib crypt cxx dri fortran gdbm iconv ipv6 libav mmx mmxext modules multilib ncurses nls nptl openmp pam pcre readline session sse sse2 ssl tcpd unicode zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON armv7a-hardfloat-linux-gnueabi-emerge --info Portage 2.2.14 (python 3.3.5-final-0, default/linux/arm/13.0/armv7a, gcc-4.8.3, glibc-2.19-r1, 3.11.0-12-generic x86_64) ================================================================= System uname: Linux-3.11.0-12-generic-x86_64-Intel-R-_Core-TM-_i5-3230M_CPU_@_2.60GHz-with-gentoo-2.2 KiB Mem: 8117664 total, 2180812 free KiB Swap: 8703996 total, 8703924 free Timestamp of tree: Tue, 14 Apr 2015 13:30:01 +0000 ld GNU ld (Gentoo 2.24 p1.4) 2.24 ccache version 3.1.9 [disabled] app-shells/bash: 4.2_p53 dev-lang/python: 2.7.9-r1, 3.3.5-r1 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.13.11 sys-apps/sandbox: 2.6-r1 sys-devel/binutils: 2.24-r3 sys-devel/gcc: 4.8.3, 4.9.2 sys-devel/gcc-config: 1.7.3 sys-devel/make: 4.1-r1 sys-kernel/linux-headers: 3.18 (virtual/os-headers) sys-libs/glibc: 2.19-r1 Repositories: gentoo local Installed sets: @orangepi ACCEPT_KEYWORDS="arm" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -fomit-frame-pointer" CHOST="armv7a-hardfloat-linux-gnueabi" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe -march=armv7-a" FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news nodoc noinfo noman parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O2 -pipe -march=armv7-a" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="fr_FR.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" PKGDIR="/usr/armv7a-hardfloat-linux-gnueabi/packages/" PORTAGE_CONFIGROOT="/usr/armv7a-hardfloat-linux-gnueabi/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/usr/armv7a-hardfloat-linux-gnueabi/tmp/" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage/local" USE="arm armv5te armv6 armv6t2 berkdb bluetooth bzip2 cli cracklib crypt cxx dri fortran gdbm iconv libav modules ncurses nls nptl openmp pcre readline session ssl tcpd unicode zlib" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="exynos fbdev omap omapfb dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Been wasting my time for two days, still have no clue how to solve it even by hand :(.
Well, here is the problem: > libtool: install: (cd /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/gmodule; /bin/sh "/usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/libtool" --tag CC --mode=relink armv7a-hardfloat-linux-gnueabi-gcc -fvisibility=hidden -O2 -pipe -fomit-frame-pointer -Wl,-Bsymbolic-functions -Wl,--export-dynamic -version-info 4002:0:4002 -export-dynamic -Wl,-O1 -Wl,--as-needed -o libgmodule-2.0.la -rpath /usr/lib libgmodule_2_0_la-gmodule.lo -ldl ../glib/libglib-2.0.la -inst-prefix-dir /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/image/) > libtool: relink: armv7a-hardfloat-linux-gnueabi-gcc -shared -fPIC -DPIC .libs/libgmodule_2_0_la-gmodule.o -ldl -L/usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/image//usr/lib -L/usr/lib -lglib-2.0 -lpthread -O2 -Wl,-Bsymbolic-functions -Wl,--export-dynamic -Wl,-O1 -Wl,--as-needed -Wl,-soname -Wl,libgmodule-2.0.so.0 -o .libs/libgmodule-2.0.so.0.4002.0 It looks like libtool is inserting -L/usr/lib (which is probably coming from libglib-2.0.la) at the beginning of the linker's argument list, so the linker reads libdl.so from your build system /usr/lib, and fails because amd64 libdl cannot be linked to arm libgmodule. Presumably, crossdev magic is supposed to take care of this somehow, but in this case it didn't work right. Assigning to crossdev maintainers.
Also, for reference, please attach /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/glib/libglib-2.0.la
if you don't enable static-libs, most things should just work because they won't produce .la files in the first place *** This bug has been marked as a duplicate of bug 521184 ***
(In reply to SpanKY from comment #4) > if you don't enable static-libs, most things should just work because they > won't produce .la files in the first place Erm... I am *not* using static-libs, as you can see from the USE flags in both emerge --info...
Indeed, build log shows static-libs is not used.
(In reply to SpanKY from comment #4) > if you don't enable static-libs, most things should just work because they > won't produce .la files in the first place > > *** This bug has been marked as a duplicate of bug 521184 *** It's not so simple; dev-libs/glib actually consists of 5 libraries - libglib, libgmodule, libgthread, libgobject, and libgio. At build time, the latter 4 (libgmodule, libgthread, libgobject, libgio) are linked using libglib-2.0.la, which is deleted later, at install time. So even if USE=-static-libs, temporary .la files are still being used while building.
it doesn't change the duplicate status *** This bug has been marked as a duplicate of bug 521184 ***
(In reply to SpanKY from comment #8) > it doesn't change the duplicate status > > *** This bug has been marked as a duplicate of bug 521184 *** @vapier, Is there something we could do in "glib side" to workaround the issue? :/ Thanks for the info
(In reply to Pacho Ramos from comment #9) not really ... elibtoolize is already being called
(In reply to Alexandre Rostovtsev from comment #2) > It looks like libtool is inserting -L/usr/lib (which is probably coming from > libglib-2.0.la) at the beginning of the linker's argument list, so the > linker reads libdl.so from your build system /usr/lib, and fails because > amd64 libdl cannot be linked to arm libgmodule. > > Presumably, crossdev magic is supposed to take care of this somehow, but in > this case it didn't work right. Assigning to crossdev maintainers. I too a look at bug #456256 and tried some variation of nikarul's trick (https://bugs.gentoo.org/show_bug.cgi?id=456256#c4) in the beginning of glib ebuild multilib_src_install(): find "${S}" -iname \*.la | xargs sed -i~ -e "s;/usr;${S}/usr;" It didn't work. I eventually found out the directory where *.la are is not ${S} (.../work/glib-2.40.2/) but a variation of it (../work/glib-2.40.2-.arm/) so I changed the line as follows: find "${WORKDIR}" -iname \*.la | xargs sed -i~ -e "s;/usr;${ROOT}/usr;" The *.la files were indeed changed but then I got another error message saying libraries could only be installed in directories ending with /usr/armv7a-hardfloat-linux-gnueabi//usr/lib: libtool: error: error: cannot install 'libgmodule-2.0.la' to a directory not ending in /usr/armv7a-hardfloat-linux-gnueabi//usr/lib I then saw many *.la files like libgmodule-2.0.la contain relink instructions with hardcoded paths so I deduced one cannot simply change all the occurrences of /usr/ in paths blindly. I gave up there.
Created attachment 401654 [details] /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/glib/libglib-2.0.la (In reply to Alexandre Rostovtsev from comment #3) > Also, for reference, please attach > /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/ > glib-2.40.2-.arm/glib/libglib-2.0.la Here it is. I'm also attaching libgmodule-2.0.la just in case.
Created attachment 401656 [details] /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/gmodule/libgmodule-2.0.la
(In reply to Alexandre Rostovtsev from comment #2) > Well, here is the problem: > > > libtool: install: (cd /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/gmodule; /bin/sh "/usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/libtool" --tag CC --mode=relink armv7a-hardfloat-linux-gnueabi-gcc -fvisibility=hidden -O2 -pipe -fomit-frame-pointer -Wl,-Bsymbolic-functions -Wl,--export-dynamic -version-info 4002:0:4002 -export-dynamic -Wl,-O1 -Wl,--as-needed -o libgmodule-2.0.la -rpath /usr/lib libgmodule_2_0_la-gmodule.lo -ldl ../glib/libglib-2.0.la -inst-prefix-dir /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/image/) > > libtool: relink: armv7a-hardfloat-linux-gnueabi-gcc -shared -fPIC -DPIC .libs/libgmodule_2_0_la-gmodule.o -ldl -L/usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/image//usr/lib -L/usr/lib -lglib-2.0 -lpthread -O2 -Wl,-Bsymbolic-functions -Wl,--export-dynamic -Wl,-O1 -Wl,--as-needed -Wl,-soname -Wl,libgmodule-2.0.so.0 -o .libs/libgmodule-2.0.so.0.4002.0 > > It looks like libtool is inserting -L/usr/lib (which is probably coming from > libglib-2.0.la) at the beginning of the linker's argument list, so the > linker reads libdl.so from your build system /usr/lib, and fails because > amd64 libdl cannot be linked to arm libgmodule. > > Presumably, crossdev magic is supposed to take care of this somehow, but in > this case it didn't work right. Assigning to crossdev maintainers. I have been trying to understand this for a while. Let me guess: some *.la files have a blank libdir clause (i.e. libdir=''). Shall I assume clearing the libdir clause for every *.la file where it is non-blank will do? Does the extra -L/usr/lib actually come from the libdir= clause in the la file?
(In reply to Vince C. from comment #14) > Shall I assume clearing the libdir clause for every *.la file where it is > non-blank will do? Turns out no, it won't do. Blanking libdir clauses produces this error with libglib-2.0: libtool: error: cannot find name of link library for 'libglib-2.0.la
Can anyone help/guide me through fixing or working around this issue on my own, please?
Created attachment 402714 [details, diff] Quick'n'dirty fix for glib-specific libtool, built inside glib sources I finally compiled that bitch! A trick I found is to prevent libtool from adding the path pointed to by *.la files "libdir" clause to the library search path. I first tried to modify /usr/bin/libtool but it looks like glib comes with its own version of libtool so the only possible choice left to me was to edit /usr/armv7a-hardfloat-linux-gnueabi/tmp/portage/dev-libs/glib-2.40.2/work/glib-2.40.2-.arm/libtool and start the install process again using a script for "ebuild" such as "armv7...-emerge". My only issue is I know no Gentoo standard idiom to make up a patched ebuild for glib because the libtool file to patch resides in "${S}-.arm" and I know no such ebuild variable for that location. I'm submitting a fix for libtool just in case it helps anyone.