Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 697544 - sys-devel/crossdev glibc Makefile stripping out Machine information from libc_nonshared.a ELF header, causes incompatible error when linking in gcc stage2
Summary: sys-devel/crossdev glibc Makefile stripping out Machine information from libc...
Status: RESOLVED DUPLICATE of bug 697428
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-12 09:12 UTC by Allan
Modified: 2019-10-12 09:54 UTC (History)
0 users

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


Attachments
error output from each build phase (error_output.tar.gz,586.62 KB, application/gzip)
2019-10-12 09:12 UTC, Allan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Allan 2019-10-12 09:12:39 UTC
Created attachment 592558 [details]
error output from each build phase

This is about crossdev on Gentoo, system is amd64, Intel i7-9700
I have spent the last day trying to figure out why I could not get toolchains to complete installing, they would fail on the last stage.... gcc stage2 with the following error as pasted below.  I am including all the output files as attachment.  I believe I have found the source of the error and not sure it is because of a recent sync/emerge but it is a high possibility.

We are talking about the glibc stage, the stage failing is gcc stage2, but the file libc_nonshared.a is created in the glibc stage... and I believe is missing some ELF header information, stripped out unintentionally by the Makefile at the end of the compile.  Below is some more detail.

I executed the following commands on two different similar toolchains that are working and have noticed that the outputs are slightly different... I don't want to copy paste too much so I will truncate the output....
I hope I have provided enough detail that this bug can be investigated, I am not sure if it is specific to my Gentoo installation, or something else.

This is the command I am using to install the toolchain
crossdev --stable \
-t armv7a-unknown-linux-gnueabihf \
--binutils =2.32-r1 \
--gcc =8.3.0-r1 \
--kernel =5.2 \
--libc =2.29-r2 \
-oO /usr/local/portage-crossdev


Crossdev version is sys-devel/crossdev-20190712::gentoo (installed from emerge)


Please see output below.
If I copy the file out of the build folder before compile completes, then copy it into the final destination by hand it works fine, the "Machine" data is not lost.
If I let the Makefile do it, "Machine" is stripped out... and I think I know why.

Finally just before copy these lines are executed...
x86_64-pc-linux-gnu-strip: Unable to recognise the format of the input file `/var/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/glibc-2.29-r2/image/usr/armv7a-unknown-linux-gnueabihf/usr/lib/libm.a(s_nextafterf.o)'
   /usr/armv7a-unknown-linux-gnueabihf/usr/lib/libc_nonshared.a
   /usr/armv7a-unknown-linux-gnueabihf/usr/lib/libc.a
x86_64-pc-linux-gnu-strip: Unable to recognise the format of the input file `/var/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/glibc-2.29-r2/image/usr/armv7a-unknown-linux-gnueabihf/usr/lib/libm.a(s_nexttowardf.o)'

This appears to strip out necessary information.

*** this is from the glibc library that works correctly, a successfully installed toolchain ***
*** notice Machine is "ARM" ***

readelf -h libc_nonshared.a
File: libc_nonshared.a(elf-init.oS)
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          956 (bytes into file)
  Flags:                             0x5000000, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         11
  Section header string table index: 10



*** this is from the glibc library that won't work right ***
*** notice Machine is "None" ***

readelf -h /usr/armv7a-unknown-linux-gnueabihf/usr/lib/libc_nonshared.a 

File: /usr/armv7a-unknown-linux-gnueabihf/usr/lib/libc_nonshared.a(elf-init.oS)
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           None
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          1004 (bytes into file)
  Flags:                             0x5000000
  Size of this header:               52 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           40 (bytes)
  Number of section headers:         11
  Section header string table index: 10




# @multilib_dir@ is not really necessary, but sometimes it has
# more uses than just a directory name.
/bin/bash /var/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/gcc-8.3.0-r1/work/gcc-8.3.0/libgcc/../mkinstalldirs .
/var/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/gcc-8.3.0-r1/work/build/./gcc/xgcc -B/var/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/gcc-8.3.0-r1/work/build/./gcc/ -B/usr/armv7a-unknown-linux-gnueabihf/bin/ -B/usr/armv7a-unknown-linux-gnueabihf/lib/ -isystem /usr/armv7a-unknown-linux-gnueabihf/include -isystem /usr/armv7a-unknown-linux-gnueabihf/sys-include    -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fno-stack-clash-protection  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -O2 -B./ _thumb1_case_sqi_s.o _thumb1_case_uqi_s.o _thumb1_case_shi_s.o _thumb1_case_uhi_s.o _thumb1_case_si_s.o _udivsi3_s.o _divsi3_s.o _umodsi3_s.o _modsi3_s.o _bb_init_func_s.o _call_via_rX_s.o _interwork_call_via_rX_s.o _lshrdi3_s.o _ashrdi3_s.o _ashldi3_s.o _arm_negdf2_s.o _arm_addsubdf3_s.o _arm_muldivdf3_s.o _arm_cmpdf2_s.o _arm_unorddf2_s.o _arm_fixdfsi_s.o _arm_fixunsdfsi_s.o _arm_truncdfsf2_s.o _arm_negsf2_s.o _arm_addsubsf3_s.o _arm_muldivsf3_s.o _arm_cmpsf2_s.o _arm_unordsf2_s.o _arm_fixsfsi_s.o _arm_fixunssfsi_s.o _arm_floatdidf_s.o _arm_floatdisf_s.o _arm_floatundidf_s.o _arm_floatundisf_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _aeabi_lcmp_s.o _aeabi_ulcmp_s.o _aeabi_ldivmod_s.o _aeabi_uldivmod_s.o _dvmd_lnx_s.o _clear_cache_s.o _muldi3_s.o _negdi2_s.o _cmpdi2_s.o _ucmpdi2_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulhc3_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divhc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o _umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o bpabi_s.o unaligned-funcs_s.o addsf3_s.o divsf3_s.o eqsf2_s.o gesf2_s.o lesf2_s.o mulsf3_s.o negsf2_s.o subsf3_s.o unordsf2_s.o fixsfsi_s.o floatsisf_s.o floatunsisf_s.o adddf3_s.o divdf3_s.o eqdf2_s.o gedf2_s.o ledf2_s.o muldf3_s.o negdf2_s.o subdf3_s.o unorddf2_s.o fixdfsi_s.o floatsidf_s.o floatunsidf_s.o extendsfdf2_s.o truncdfsf2_s.o enable-execute-stack_s.o unwind-arm_s.o libunwind_s.o pr-support_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared library, but some functions are only in"; echo "   the static library.  */"; echo "GROUP ( libgcc_s.so.1 -lgcc )" ) > ./libgcc_s.so
/usr/libexec/gcc/armv7a-unknown-linux-gnueabihf/ld: skipping incompatible /usr/armv7a-unknown-linux-gnueabihf/usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a
/usr/libexec/gcc/armv7a-unknown-linux-gnueabihf/ld: cannot find /usr/lib/libc_nonshared.a inside /usr/armv7a-unknown-linux-gnueabihf
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:985: libgcc_s.so] Error 1
make[2]: Leaving directory '/var/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/gcc-8.3.0-r1/work/build/armv7a-unknown-linux-gnueabihf/libgcc'
make[1]: *** [Makefile:12434: all-target-libgcc] Error 2
make[1]: Leaving directory '/var/tmp/portage/cross-armv7a-unknown-linux-gnueabihf/gcc-8.3.0-r1/work/build'
make: *** [Makefile:907: all] Error 2
 * ERROR: cross-armv7a-unknown-linux-gnueabihf/gcc-8.3.0-r1::crossdev failed (compile phase):
 *   emake failed
 * 



Output from emerge --info

Portage 2.3.76 (python 3.6.9-final-0, default/linux/amd64/17.1, gcc-8.3.0, glibc-2.29-r2, 5.2.14-gentoo x86_64)
=================================================================
System uname: Linux-5.2.14-gentoo-x86_64-Intel-R-_Core-TM-_i7-9700K_CPU_@_3.60GHz-with-gentoo-2.6
KiB Mem:    15946400 total,   8960740 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Fri, 11 Oct 2019 11:30:01 +0000
Head commit of repository gentoo: 472fd84cb424747e7666a31c5ea7f7fd9b62001d
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
distcc 3.3.3 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.4_p23-r1::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo
dev-util/cmake:           3.14.6::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1

crossdev
    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="https://ftp.jaist.ac.jp/pub/Linux/Gentoo/"
LANG="ja_JP.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="ja"
MAKEOPTS="-j9"
PKGDIR="/var/cache/binpkgs"
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 --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X acl alsa amd64 berkdb bzip2 cli crypt cups cxx dbus dri elogind fortran gdbm iconv ipv6 libtirpc multilib ncurses networkmanager nls nptl openmp pam pcre pulseaudio readline seccomp split-usr sqlite ssl tcpd udev unicode xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel" 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="karbon sheets words" 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 greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="intel i965 i915 fbdev vesa" 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:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2019-10-12 09:54:59 UTC

*** This bug has been marked as a duplicate of bug 697428 ***