Hi all,

When cross compile elfutils for arm64 on x86_x64 platform, it fails as follows when executing "make":

 Making all in libcpu
  CC       i386_gendis.o
  CC       i386_lex.o
  GEN      i386_defs
  GEN      i386.mnemonics
  CC       i386_parse.o
  CCLD     i386_gendis
  GEN      i386_dis.h
/bin/bash: line 1: ./i386_gendis: cannot execute binary file: Exec format error
make[2]: *** [Makefile:794: i386_dis.h] Error 126
rm i386_defs
make[1]: *** [Makefile:532: all-recursive] Error 1
make: *** [Makefile:448: all] Error 2

I tried elfutils of latest version and elfutils-0.185, and the issue is the same.

My compile steps is as follows, and please refer to attachment if you want to know more detailed log:

 autoreconf -i -f
./configure --build=x86_64-linux-gnu --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ --enable-maintainer-mode --prefix=/local/mnt/workspace/bin/elflib/ --with-zlib LDFLAGS='-mcpu=cortex-a53 -L/usr/lib/gcc-cross/aarch64-linux-gnu/13/ -lz' CFLAGS='-I/usr/lib/gcc-cross/aarch64-linux-gnu/13/include -fPIC -O2 -D_GNU_SOURCE' --disable-nls --disable-rpath --disable-libdebuginfod --disable-debuginfod

make

Appreciate it if you have any comments or idea on it.


Thanks,

Xiang


autopoint: using AM_GNU_GETTEXT_REQUIRE_VERSION instead of 
AM_GNU_GETTEXT_VERSION
configure.ac:93: warning: AC_PROG_LEX without either yywrap or noyywrap is 
obsolete
./lib/autoconf/programs.m4:716: _AC_PROG_LEX is expanded from...
./lib/autoconf/programs.m4:709: AC_PROG_LEX is expanded from...
aclocal.m4:1072: AM_PROG_LEX is expanded from...
configure.ac:93: the top level
configure.ac:399: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:399: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
m4/zip.m4:5: eu_ZIPLIB is expanded from...
configure.ac:399: the top level
configure.ac:407: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:407: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
m4/zip.m4:5: eu_ZIPLIB is expanded from...
configure.ac:407: the top level
configure.ac:411: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:411: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
m4/zip.m4:5: eu_ZIPLIB is expanded from...
configure.ac:411: the top level
configure.ac:414: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:414: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
m4/zip.m4:5: eu_ZIPLIB is expanded from...
configure.ac:414: the top level
configure.ac:698: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:698: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
m4/biarch.m4:28: utrace_BIARCH is expanded from...
configure.ac:698: the top level
configure.ac:735: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:735: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:735: the top level
configure.ac:762: warning: The macro `AC_HELP_STRING' is obsolete.
configure.ac:762: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
configure.ac:762: the top level
xianche@xianche-gv:/local/mnt/workspace/tools/elfutils-0.185/elfutils-0.185$
xianche@xianche-gv:/local/mnt/workspace/tools/elfutils-0.185/elfutils-0.185$
xianche@xianche-gv:/local/mnt/workspace/tools/elfutils-0.185/elfutils-0.185$
xianche@xianche-gv:/local/mnt/workspace/tools/elfutils-0.185/elfutils-0.185$
xianche@xianche-gv:/local/mnt/workspace/tools/elfutils-0.185/elfutils-0.185$ 
./configure --build=x86_64-linux-gnu --host=aarch64-linux-gnu     
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ --enable-maintainer-mode 
--prefix=/local/mnt/workspace/bin/elflib/ --with-zlib LDFLAGS='-mcpu=cortex-a53 
-L/usr/lib/gcc-cross/aarch64-linux-gnu/13/ -lz' 
CFLAGS='-I/usr/lib/gcc-cross/aarch64-linux-gnu/13/include -fPIC -O2 
-D_GNU_SOURCE' --disable-nls --disable-rpath --disable-libdebuginfod 
--disable-debuginfod
configure: No --program-prefix given, using "eu-"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for aarch64-linux-gnu-strip... aarch64-linux-gnu-strip
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether aarch64-linux-gnu-gcc accepts -g... yes
checking for aarch64-linux-gnu-gcc option to enable C11 features... none needed
checking whether aarch64-linux-gnu-gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of aarch64-linux-gnu-gcc... gcc3
checking for aarch64-linux-gnu-ranlib... aarch64-linux-gnu-ranlib
checking for bison... bison -y
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... none needed
checking for library containing yywrap... no
checking whether yytext is a pointer... yes
checking for aarch64-linux-gnu-ar... aarch64-linux-gnu-ar
checking the archiver (aarch64-linux-gnu-ar) interface... ar
checking for aarch64-linux-gnu-readelf... aarch64-linux-gnu-readelf
checking for aarch64-linux-gnu-nm... aarch64-linux-gnu-nm
checking for gcc with GNU99 support... yes
checking whether gcc supports __attribute__((visibility()))... yes
checking whether gcc supports __attribute__((gcc_struct))... no
checking whether gcc supports -fPIC... yes
checking whether gcc supports -fPIE... yes
checking whether gcc supports -Wl,-z,defs... yes
checking whether the compiler generates build-ids... yes
checking whether gcc supports -Wl,-z,relro... yes
checking for __thread support... yes
checking whether gcc provides stdatomic.h... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether fts.h is bad when included (with LFS)... no
checking whether to add -D_FORTIFY_SOURCE=2 to CFLAGS... yes
checking for library containing gzdirect... none required
checking for library containing BZ2_bzdopen... no
checking for library containing lzma_auto_decoder... no
checking for library containing ZSTD_decompress... no
checking for aarch64-linux-gnu-gcc options needed to detect all undeclared 
functions... none needed
checking whether memrchr is declared... yes
checking whether rawmemchr is declared... yes
checking whether powerof2 is declared... yes
checking whether mempcpy is declared... yes
checking for process_vm_readv... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking whether strerror_r is declared... yes
checking whether strerror_r returns char *... yes
checking for __cxa_demangle in -lstdc++... yes
checking whether symbol versioning is supported... yes
checking whether gcc accepts -Wstack-usage... yes
checking whether gcc has a sane -Wlogical-op... yes
checking whether gcc accepts -Wduplicated-cond... yes
checking whether gcc accepts -Wnull-dereference... yes
checking whether gcc accepts -Wimplicit-fallthrough... yes
checking whether the compiler accepts -Wimplicit-fallthrough=5... yes
checking whether the compiler accepts -Wtrampolines... yes
checking whether the compiler accepts -Wno-packed-not-aligned... yes
checking for library containing argp_parse... none required
checking for library containing fts_close... none required
checking for library containing _obstack_free... none required
checking for a sed that does not truncate output... /usr/bin/sed
checking whether NLS is requested... no
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for ld used by aarch64-linux-gnu-gcc... 
/local/mnt/workspace/tools/gcc-linaro-cross-compile/gcc-linaro-14.0.0-2023.06-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/bin/ld
checking if the linker 
(/local/mnt/workspace/tools/gcc-linaro-cross-compile/gcc-linaro-14.0.0-2023.06-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/bin/ld)
 is GNU ld... yes
checking for shared library run path origin... done
checking 32-bit host C ABI... no
checking how to run the C preprocessor... aarch64-linux-gnu-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ELF binary format... yes
checking for the common suffixes of directories in the library search path... 
lib,lib,lib64
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyPreferredLanguages... no
checking whether to use NLS... no
checking size of long... 8
checking for struct user_regs_struct... yes
checking aarch64-linux-gnu-gcc option for 32-bit word size... none
configure: WARNING: not running biarch tests,  does not work
checking for flex... yes
checking for bison... yes
checking for gawk... yes
checking for bunzip2... yes
checking for zstd... yes
checking for pthread_setname_np in -lpthread... yes
checking whether the compiler supports GNU C++... yes
checking whether aarch64-linux-gnu-g++ accepts -g... yes
checking for aarch64-linux-gnu-g++ option to enable C++11 features... none 
needed
checking dependency style of aarch64-linux-gnu-g++... gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating config/Makefile
config.status: creating Makefile
config.status: creating elfutils.spec
config.status: creating debuginfod/Makefile
config.status: creating debuginfod/debuginfod.h
config.status: creating doc/Makefile
config.status: creating lib/Makefile
config.status: creating libelf/Makefile
config.status: creating libebl/Makefile
config.status: creating libdwelf/Makefile
config.status: creating libdw/Makefile
config.status: creating libdwfl/Makefile
config.status: creating libcpu/Makefile
config.status: creating libasm/Makefile
config.status: creating backends/Makefile
config.status: creating src/Makefile
config.status: creating po/Makefile.in
config.status: creating tests/Makefile
config.status: creating config/libelf.pc
config.status: creating config/libdw.pc
config.status: creating config/libdebuginfod.pc
config.status: creating version.h
config.status: creating config/profile.sh
config.status: creating config/profile.csh
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
configure:
=====================================================================
        elfutils: 0.185 (eu_version: 185)
=====================================================================

    Prefix                             : /local/mnt/workspace/bin/elflib
    Program prefix ("eu-" recommended) : eu-
    Source code location               : .
    Maintainer mode                    : yes
    build arch                         : x86_64-pc-linux-gnu

  RECOMMENDED FEATURES (should all be yes)
    gzip support                       : yes
    bzip2 support                      : no
    lzma/xz support                    : no
    zstd support                       : no
    libstdc++ demangle support         : yes
    File textrel check                 : yes
    Symbol versioning                  : yes

  NOT RECOMMENDED FEATURES (should all be no)
    Experimental thread safety         : no
    install elf.h                      : no

  OTHER FEATURES
    Deterministic archives by default  : false
    Native language support            : no
    Extra Valgrind annotations         : no
    libdebuginfod client support       : no
    Debuginfod server support          : no
    Default DEBUGINFOD_URLS            :

  EXTRA TEST FEATURES (used with make check)
    have bunzip2 installed (required)  : yes
    have zstd installed                : yes
    debug branch prediction            : no
    gprof support                      : no
    gcov support                       : no
    run all tests under valgrind       : no
    gcc undefined behaviour sanitizer  : no
    use rpath in tests                 : no
    test biarch                        : no

xianche@xianche-gv:/local/mnt/workspace/tools/elfutils-0.185/elfutils-0.185$ 
make
make --no-print-directory all-recursive
Making all in config
make[2]: Nothing to be done for 'all'.
Making all in lib
  CC       xstrdup.o
  CC       xstrndup.o
  CC       xmalloc.o
  CC       next_prime.o
  CC       crc32.o
  CC       crc32_file.o
  CC       color.o
  CC       printversion.o
  AR       libeu.a
Making all in libelf
  CC       elf_version.o
  CC       elf_hash.o
  CC       elf_error.o
  CC       elf_fill.o
  CC       elf_begin.o
  CC       elf_next.o
  CC       elf_rand.o
  CC       elf_end.o
  CC       elf_kind.o
  CC       gelf_getclass.o
  CC       elf_getbase.o
  CC       elf_getident.o
  CC       elf32_fsize.o
  CC       elf64_fsize.o
  CC       gelf_fsize.o
  CC       elf32_xlatetof.o
  CC       elf32_xlatetom.o
  CC       elf64_xlatetof.o
  CC       elf64_xlatetom.o
  CC       gelf_xlate.o
  CC       elf32_getehdr.o
  CC       elf64_getehdr.o
  CC       gelf_getehdr.o
  CC       elf32_newehdr.o
  CC       elf64_newehdr.o
  CC       gelf_newehdr.o
  CC       gelf_update_ehdr.o
  CC       elf32_getphdr.o
  CC       elf64_getphdr.o
  CC       gelf_getphdr.o
  CC       elf32_newphdr.o
  CC       elf64_newphdr.o
  CC       gelf_newphdr.o
  CC       gelf_update_phdr.o
  CC       elf_getarhdr.o
  CC       elf_getarsym.o
  CC       elf_rawfile.o
  CC       elf_readall.o
  CC       elf_cntl.o
  CC       elf_getscn.o
  CC       elf_nextscn.o
  CC       elf_ndxscn.o
  CC       elf_newscn.o
  CC       elf32_getshdr.o
  CC       elf64_getshdr.o
  CC       gelf_getshdr.o
  CC       gelf_update_shdr.o
  CC       elf_strptr.o
  CC       elf_rawdata.o
  CC       elf_getdata.o
  CC       elf_newdata.o
  CC       elf_getdata_rawchunk.o
  CC       elf_flagelf.o
  CC       elf_flagehdr.o
  CC       elf_flagphdr.o
  CC       elf_flagscn.o
  CC       elf_flagshdr.o
  CC       elf_flagdata.o
  CC       elf_memory.o
  CC       elf_update.o
  CC       elf32_updatenull.o
  CC       elf64_updatenull.o
  CC       elf32_updatefile.o
  CC       elf64_updatefile.o
  CC       gelf_getsym.o
  CC       gelf_update_sym.o
  CC       gelf_getversym.o
  CC       gelf_getverneed.o
  CC       gelf_getvernaux.o
  CC       gelf_getverdef.o
  CC       gelf_getverdaux.o
  CC       gelf_getrel.o
  CC       gelf_getrela.o
  CC       gelf_update_rel.o
  CC       gelf_update_rela.o
  CC       gelf_getdyn.o
  CC       gelf_update_dyn.o
  CC       gelf_getmove.o
  CC       gelf_update_move.o
  CC       gelf_getsyminfo.o
  CC       gelf_update_syminfo.o
  CC       gelf_getauxv.o
  CC       gelf_update_auxv.o
  CC       gelf_getnote.o
  CC       gelf_xlatetof.o
  CC       gelf_xlatetom.o
  CC       nlist.o
  CC       gelf_getsymshndx.o
  CC       gelf_update_symshndx.o
  CC       gelf_update_versym.o
  CC       gelf_update_verneed.o
  CC       gelf_update_vernaux.o
  CC       gelf_update_verdef.o
  CC       gelf_update_verdaux.o
  CC       elf_getphdrnum.o
  CC       elf_getshdrnum.o
  CC       elf_getshdrstrndx.o
  CC       gelf_checksum.o
  CC       elf32_checksum.o
  CC       elf64_checksum.o
  CC       libelf_crc32.o
  CC       libelf_next_prime.o
  CC       elf_clone.o
  CC       gelf_getlib.o
  CC       gelf_update_lib.o
  CC       elf32_offscn.o
  CC       elf64_offscn.o
  CC       gelf_offscn.o
  CC       elf_getaroff.o
  CC       elf_gnu_hash.o
  CC       elf_scnshndx.o
  CC       elf32_getchdr.o
  CC       elf64_getchdr.o
  CC       gelf_getchdr.o
  CC       elf_compress.o
  CC       elf_compress_gnu.o
  AR       libelf.a
  CC       elf_version.os
  CC       elf_hash.os
  CC       elf_error.os
  CC       elf_fill.os
  CC       elf_begin.os
  CC       elf_next.os
  CC       elf_rand.os
  CC       elf_end.os
  CC       elf_kind.os
  CC       gelf_getclass.os
  CC       elf_getbase.os
  CC       elf_getident.os
  CC       elf32_fsize.os
  CC       elf64_fsize.os
  CC       gelf_fsize.os
  CC       elf32_xlatetof.os
  CC       elf32_xlatetom.os
  CC       elf64_xlatetof.os
  CC       elf64_xlatetom.os
  CC       gelf_xlate.os
  CC       elf32_getehdr.os
  CC       elf64_getehdr.os
  CC       gelf_getehdr.os
  CC       elf32_newehdr.os
  CC       elf64_newehdr.os
  CC       gelf_newehdr.os
  CC       gelf_update_ehdr.os
  CC       elf32_getphdr.os
  CC       elf64_getphdr.os
  CC       gelf_getphdr.os
  CC       elf32_newphdr.os
  CC       elf64_newphdr.os
  CC       gelf_newphdr.os
  CC       gelf_update_phdr.os
  CC       elf_getarhdr.os
  CC       elf_getarsym.os
  CC       elf_rawfile.os
  CC       elf_readall.os
  CC       elf_cntl.os
  CC       elf_getscn.os
  CC       elf_nextscn.os
  CC       elf_ndxscn.os
  CC       elf_newscn.os
  CC       elf32_getshdr.os
  CC       elf64_getshdr.os
  CC       gelf_getshdr.os
  CC       gelf_update_shdr.os
  CC       elf_strptr.os
  CC       elf_rawdata.os
  CC       elf_getdata.os
  CC       elf_newdata.os
  CC       elf_getdata_rawchunk.os
  CC       elf_flagelf.os
  CC       elf_flagehdr.os
  CC       elf_flagphdr.os
  CC       elf_flagscn.os
  CC       elf_flagshdr.os
  CC       elf_flagdata.os
  CC       elf_memory.os
  CC       elf_update.os
  CC       elf32_updatenull.os
  CC       elf64_updatenull.os
  CC       elf32_updatefile.os
  CC       elf64_updatefile.os
  CC       gelf_getsym.os
  CC       gelf_update_sym.os
  CC       gelf_getversym.os
  CC       gelf_getverneed.os
  CC       gelf_getvernaux.os
  CC       gelf_getverdef.os
  CC       gelf_getverdaux.os
  CC       gelf_getrel.os
  CC       gelf_getrela.os
  CC       gelf_update_rel.os
  CC       gelf_update_rela.os
  CC       gelf_getdyn.os
  CC       gelf_update_dyn.os
  CC       gelf_getmove.os
  CC       gelf_update_move.os
  CC       gelf_getsyminfo.os
  CC       gelf_update_syminfo.os
  CC       gelf_getauxv.os
  CC       gelf_update_auxv.os
  CC       gelf_getnote.os
  CC       gelf_xlatetof.os
  CC       gelf_xlatetom.os
  CC       nlist.os
  CC       gelf_getsymshndx.os
  CC       gelf_update_symshndx.os
  CC       gelf_update_versym.os
  CC       gelf_update_verneed.os
  CC       gelf_update_vernaux.os
  CC       gelf_update_verdef.os
  CC       gelf_update_verdaux.os
  CC       elf_getphdrnum.os
  CC       elf_getshdrnum.os
  CC       elf_getshdrstrndx.os
  CC       gelf_checksum.os
  CC       elf32_checksum.os
  CC       elf64_checksum.os
  CC       libelf_crc32.os
  CC       libelf_next_prime.os
  CC       elf_clone.os
  CC       gelf_getlib.os
  CC       gelf_update_lib.os
  CC       elf32_offscn.os
  CC       elf64_offscn.os
  CC       gelf_offscn.os
  CC       elf_getaroff.os
  CC       elf_gnu_hash.os
  CC       elf_scnshndx.os
  CC       elf32_getchdr.os
  CC       elf64_getchdr.os
  CC       gelf_getchdr.os
  CC       elf_compress.os
  CC       elf_compress_gnu.os
  AR       libelf_pic.a
  CCLD     libelf.so
Making all in libcpu
  CC       i386_gendis.o
  CC       i386_lex.o
  GEN      i386_defs
  GEN      i386.mnemonics
  CC       i386_parse.o
  CCLD     i386_gendis
  GEN      i386_dis.h
/bin/bash: line 1: ./i386_gendis: cannot execute binary file: Exec format error
make[2]: *** [Makefile:794: i386_dis.h] Error 126
rm i386_defs
make[1]: *** [Makefile:532: all-recursive] Error 1
make: *** [Makefile:448: all] Error 2
xianche@xianche-gv:/local/mnt/workspace/tools/elfutils-0.185/elfutils-0.185$

Reply via email to