Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crosscompiling for aarch64 fails #186

Closed
phodina opened this issue Nov 17, 2021 · 1 comment
Closed

Crosscompiling for aarch64 fails #186

phodina opened this issue Nov 17, 2021 · 1 comment

Comments

@phodina
Copy link

phodina commented Nov 17, 2021

Hi,

I'm attempting to crosscompile the project for aarch64 (Raspberry Pi 3) on my x86_64 machine.

The main issue from the build log seems to be that we first compile the executable makeguids and we then immediately run it.

However, since it's compiled by the same compiler (GCC for aarch64) the kernel refuses to execute it.

The proper solution would be to define 2 compilers in the Makefile and compile those executables with the host toolchain rather than the target.

FIY I'm compiling the efivar on Guix.

The issue is on line with ./makeguids: ./makeguids: cannot execute binary file

$file makeguids
makeguids: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/2kx23wwq4xb674qfj3pf9mnlpzbvs0q6-glibc-cross-aarch64-linux-gnu-2.33/lib/ld-linux-aarch64.so.1, BuildID[sha1]=26c37139c0d469c4c57fe691e5dd7e216e72cf5d, for GNU/Linux 2.6.32, with debug_info, not stripped
$ uname -a
Linux asgard 5.14.15 #1 SMP 1 x86_64 GNU/Linux

Build log:

./pre-inst-env guix build --target=aarch64-linux-gnu efivar -K
substitute: updating substitutes from 'https://mirror.brielmaier.nsubstitute: updating substitutes from 'https://mirror.brielmaier.net'... 100.0%
substitute: updating substitutes from 'https://ci.guix.gnu.org'...substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.osubstitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
The following derivation will be built:
   /gnu/store/gzsd4s1v7yddlmzby8jpjvxvviszaqrk-efivar-37.drv
building /gnu/store/gzsd4s1v7yddlmzby8jpjvxvviszaqrk-efivar-37.drv...
WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete'
starting phase `set-SOURCE-DATE-EPOCH'
phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds
starting phase `set-paths'
environment variable `PATH' set to `/gnu/store/y5jnbh6k0dsw8b80jgzpfpbkxlyay0q9-pkg-config-aarch64-linux-gnu-0.29.2/bin:/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/bin:/gnu/store/yxgv2mbxx12mgpr92fqdhxz72iasr1i5-binutils-cross-aarch64-linux-gnu-2.37/bin:/gnu/store/7y8v1flngnxp3w5sadrwy68mfvkih49g-tar-1.34/bin:/gnu/store/jki1vpppvbippm02nsq2n351rs4dpyad-gzip-1.10/bin:/gnu/store/m83pbbqy0x4a5lq1ql7di9k67akshyha-bzip2-1.0.8/bin:/gnu/store/lysa4ndj5cmavcq6nzy08jw8xy9wv1jg-xz-5.2.5/bin:/gnu/store/0637zn7anp72cdlnlk5c9ycm0s6aj2zp-file-5.39/bin:/gnu/store/fiikbf8jj8bkvf1aqwr6zvgcliyvlqjc-diffutils-3.7/bin:/gnu/store/ymbsa0p0hw7ldkmmr7kq536dsfkwzbic-patch-2.7.6/bin:/gnu/store/dnm741zx77dfjh3pn5anfry1xv51qylb-findutils-4.8.0/bin:/gnu/store/ai633lwgp3qw82z2zvyv5xcjlfhv4pwz-gawk-5.1.0/bin:/gnu/store/f3w7xwiqfdd646dzvyw1s4xviym7xi2a-sed-4.8/bin:/gnu/store/8q1712hjqca75rifbd0sv749j79da9mg-grep-3.6/bin:/gnu/store/ns1j1v51dvxq52cvch0p5q9i26zx0wq8-coreutils-8.32/bin:/gnu/store/15frcrwfb1chasz0ydlmpsdki45k4k65-make-4.3/bin:/gnu/store/yl0xbcs20wjm7015zwvwxhydnf6clc47-bash-minimal-5.1.8/bin:/gnu/store/51sp0457wgh8i7kcpgx8y6hfw5pyg1xn-ld-wrapper-0/bin:/gnu/store/q8d3ak8lw428rsgsvhrh7s6aah0i8krq-binutils-2.37/bin:/gnu/store/3f123m0g3ls3lnnq11kgh1p2j15vd53j-gcc-10.3.0/bin:/gnu/store/ghxv5p2jqsn2ij5nsdzsxqqf739m98r6-glibc-2.33/bin:/gnu/store/ghxv5p2jqsn2ij5nsdzsxqqf739m98r6-glibc-2.33/sbin'
environment variable `PKG_CONFIG_PATH' set to `/gnu/store/2n7bqw64hnk32n547888kjlhid2kgmzh-popt-1.18/lib/pkgconfig'
environment variable `CROSS_LIBRARY_PATH' set to `/gnu/store/2n7bqw64hnk32n547888kjlhid2kgmzh-popt-1.18/lib:/gnu/store/2kx23wwq4xb674qfj3pf9mnlpzbvs0q6-glibc-cross-aarch64-linux-gnu-2.33/lib:/gnu/store/glvn2x13mnfnlqk017i3qa4qr49z019n-glibc-cross-aarch64-linux-gnu-2.33-static/lib'
environment variable `CROSS_C_INCLUDE_PATH' set to `/gnu/store/2n7bqw64hnk32n547888kjlhid2kgmzh-popt-1.18/include:/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include:/gnu/store/2kx23wwq4xb674qfj3pf9mnlpzbvs0q6-glibc-cross-aarch64-linux-gnu-2.33/include:/gnu/store/yv2zgynvj67bzajafw9qlcy98pyb30i1-linux-libre-headers-cross-aarch64-linux-gnu-5.10.35/include'
environment variable `CROSS_CPLUS_INCLUDE_PATH' set to `/gnu/store/2n7bqw64hnk32n547888kjlhid2kgmzh-popt-1.18/include:/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include/c++:/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include:/gnu/store/2kx23wwq4xb674qfj3pf9mnlpzbvs0q6-glibc-cross-aarch64-linux-gnu-2.33/include:/gnu/store/yv2zgynvj67bzajafw9qlcy98pyb30i1-linux-libre-headers-cross-aarch64-linux-gnu-5.10.35/include'
environment variable `CROSS_OBJC_INCLUDE_PATH' set to `/gnu/store/2n7bqw64hnk32n547888kjlhid2kgmzh-popt-1.18/include:/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include:/gnu/store/2kx23wwq4xb674qfj3pf9mnlpzbvs0q6-glibc-cross-aarch64-linux-gnu-2.33/include:/gnu/store/yv2zgynvj67bzajafw9qlcy98pyb30i1-linux-libre-headers-cross-aarch64-linux-gnu-5.10.35/include'
environment variable `CROSS_OBJCPLUS_INCLUDE_PATH' set to `/gnu/store/2n7bqw64hnk32n547888kjlhid2kgmzh-popt-1.18/include:/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include:/gnu/store/2kx23wwq4xb674qfj3pf9mnlpzbvs0q6-glibc-cross-aarch64-linux-gnu-2.33/include:/gnu/store/yv2zgynvj67bzajafw9qlcy98pyb30i1-linux-libre-headers-cross-aarch64-linux-gnu-5.10.35/include'
environment variable `BASH_LOADABLES_PATH' unset
environment variable `C_INCLUDE_PATH' set to `/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include:/gnu/store/yxgv2mbxx12mgpr92fqdhxz72iasr1i5-binutils-cross-aarch64-linux-gnu-2.37/include:/gnu/store/m83pbbqy0x4a5lq1ql7di9k67akshyha-bzip2-1.0.8/include:/gnu/store/lysa4ndj5cmavcq6nzy08jw8xy9wv1jg-xz-5.2.5/include:/gnu/store/0637zn7anp72cdlnlk5c9ycm0s6aj2zp-file-5.39/include:/gnu/store/ai633lwgp3qw82z2zvyv5xcjlfhv4pwz-gawk-5.1.0/include:/gnu/store/15frcrwfb1chasz0ydlmpsdki45k4k65-make-4.3/include:/gnu/store/q8d3ak8lw428rsgsvhrh7s6aah0i8krq-binutils-2.37/include:/gnu/store/3f123m0g3ls3lnnq11kgh1p2j15vd53j-gcc-10.3.0/include:/gnu/store/ghxv5p2jqsn2ij5nsdzsxqqf739m98r6-glibc-2.33/include:/gnu/store/yg777mdkdrh7zn8qrz111k4ajzl9shl8-linux-libre-headers-5.10.35/include'
environment variable `CPLUS_INCLUDE_PATH' set to `/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include/c++:/gnu/store/mzwc9jrbxydiqhz9i3568b0hmfvjjxl7-gcc-cross-aarch64-linux-gnu-10.3.0/include:/gnu/store/yxgv2mbxx12mgpr92fqdhxz72iasr1i5-binutils-cross-aarch64-linux-gnu-2.37/include:/gnu/store/m83pbbqy0x4a5lq1ql7di9k67akshyha-bzip2-1.0.8/include:/gnu/store/lysa4ndj5cmavcq6nzy08jw8xy9wv1jg-xz-5.2.5/include:/gnu/store/0637zn7anp72cdlnlk5c9ycm0s6aj2zp-file-5.39/include:/gnu/store/ai633lwgp3qw82z2zvyv5xcjlfhv4pwz-gawk-5.1.0/include:/gnu/store/15frcrwfb1chasz0ydlmpsdki45k4k65-make-4.3/include:/gnu/store/q8d3ak8lw428rsgsvhrh7s6aah0i8krq-binutils-2.37/include:/gnu/store/3f123m0g3ls3lnnq11kgh1p2j15vd53j-gcc-10.3.0/include/c++:/gnu/store/3f123m0g3ls3lnnq11kgh1p2j15vd53j-gcc-10.3.0/include:/gnu/store/ghxv5p2jqsn2ij5nsdzsxqqf739m98r6-glibc-2.33/include:/gnu/store/yg777mdkdrh7zn8qrz111k4ajzl9shl8-linux-libre-headers-5.10.35/include'
environment variable `LIBRARY_PATH' set to `/gnu/store/yxgv2mbxx12mgpr92fqdhxz72iasr1i5-binutils-cross-aarch64-linux-gnu-2.37/lib:/gnu/store/m83pbbqy0x4a5lq1ql7di9k67akshyha-bzip2-1.0.8/lib:/gnu/store/lysa4ndj5cmavcq6nzy08jw8xy9wv1jg-xz-5.2.5/lib:/gnu/store/0637zn7anp72cdlnlk5c9ycm0s6aj2zp-file-5.39/lib:/gnu/store/ai633lwgp3qw82z2zvyv5xcjlfhv4pwz-gawk-5.1.0/lib:/gnu/store/q8d3ak8lw428rsgsvhrh7s6aah0i8krq-binutils-2.37/lib:/gnu/store/ghxv5p2jqsn2ij5nsdzsxqqf739m98r6-glibc-2.33/lib:/gnu/store/izfq7wwyjvx3zrh99c00h3wzm81d9hrx-glibc-2.33-static/lib:/gnu/store/0r4yd9z5jq1wk6hvf7cljbdhr32jr1a3-glibc-utf8-locales-2.33/lib'
environment variable `GUIX_LOCPATH' set to `/gnu/store/0r4yd9z5jq1wk6hvf7cljbdhr32jr1a3-glibc-utf8-locales-2.33/lib/locale'
phase `set-paths' succeeded after 0.0 seconds
starting phase `install-locale'
using 'en_US.utf8' locale for category "LC_ALL"
phase `install-locale' succeeded after 0.0 seconds
starting phase `unpack'
efivar-37/
efivar-37/.gitignore
efivar-37/.travis.yml
efivar-37/COPYING
efivar-37/Make.coverity
efivar-37/Make.defaults
efivar-37/Make.deprecated
efivar-37/Make.rules
efivar-37/Make.scan-build
efivar-37/Make.version
efivar-37/Makefile
efivar-37/README.md
efivar-37/TODO
efivar-37/docs/
efivar-37/docs/Makefile
efivar-37/docs/efi_append_variable.3
efivar-37/docs/efi_del_variable.3
efivar-37/docs/efi_get_next_variable_name.3
efivar-37/docs/efi_get_variable.3
efivar-37/docs/efi_get_variable_attributes.3
efivar-37/docs/efi_get_variable_size.3
efivar-37/docs/efi_guid_to_id_guid.3
efivar-37/docs/efi_guid_to_name.3
efivar-37/docs/efi_guid_to_str.3
efivar-37/docs/efi_guid_to_symbol.3
efivar-37/docs/efi_id_guid_to_guid.3
efivar-37/docs/efi_name_to_guid.3
efivar-37/docs/efi_set_variable.3
efivar-37/docs/efi_str_to_guid.3
efivar-37/docs/efi_symbol_to_guid.3
efivar-37/docs/efi_variable_alloc.3
efivar-37/docs/efi_variable_export.3
efivar-37/docs/efi_variable_free.3
efivar-37/docs/efi_variable_get_attributes.3
efivar-37/docs/efi_variable_get_data.3
efivar-37/docs/efi_variable_get_guid.3
efivar-37/docs/efi_variable_get_name.3
efivar-37/docs/efi_variable_import.3
efivar-37/docs/efi_variable_realize.3
efivar-37/docs/efi_variable_set_attributes.3
efivar-37/docs/efi_variable_set_data.3
efivar-37/docs/efi_variable_set_guid.3
efivar-37/docs/efi_variable_set_name.3
efivar-37/docs/efi_variable_t.3
efivar-37/docs/efi_variables_supported.3
efivar-37/docs/efidp_make_generic.3
efivar-37/docs/efivar.1
efivar-37/efivar.spec
efivar-37/efivar.spec.in
efivar-37/gcc.specs
efivar-37/src/
efivar-37/src/.gitignore
efivar-37/src/Make.deps
efivar-37/src/Makefile
efivar-37/src/abignore
efivar-37/src/crc32.c
efivar-37/src/crc32.h
efivar-37/src/creator.c
efivar-37/src/disk.c
efivar-37/src/disk.h
efivar-37/src/dp-acpi.c
efivar-37/src/dp-hw.c
efivar-37/src/dp-media.c
efivar-37/src/dp-message.c
efivar-37/src/dp.c
efivar-37/src/dp.h
efivar-37/src/efiboot.h
efivar-37/src/efiboot.pc.in
efivar-37/src/efivar.c
efivar-37/src/efivar.h
efivar-37/src/efivar.pc.in
efivar-37/src/efivar_endian.h
efivar-37/src/efivarfs.c
efivar-37/src/error.c
efivar-37/src/export.c
efivar-37/src/fix_coverity.h
efivar-37/src/generics.h
efivar-37/src/gpt.c
efivar-37/src/gpt.h
efivar-37/src/guid.c
efivar-37/src/guid.h
efivar-37/src/guids.S
efivar-37/src/guids.txt
efivar-37/src/hexdump.h
efivar-37/src/include/
efivar-37/src/include/efivar/
efivar-37/src/include/efivar/efiboot-creator.h
efivar-37/src/include/efivar/efiboot-loadopt.h
efivar-37/src/include/efivar/efiboot.h
efivar-37/src/include/efivar/efivar-dp.h
efivar-37/src/include/efivar/efivar.h
efivar-37/src/lib.c
efivar-37/src/lib.h
efivar-37/src/libefiboot.abixml
efivar-37/src/libefiboot.map.in
efivar-37/src/libefivar.abixml
efivar-37/src/libefivar.map.in
efivar-37/src/linux-acpi-root.c
efivar-37/src/linux-acpi.c
efivar-37/src/linux-ata.c
efivar-37/src/linux-emmc.c
efivar-37/src/linux-i2o.c
efivar-37/src/linux-md.c
efivar-37/src/linux-nvme.c
efivar-37/src/linux-pci-root.c
efivar-37/src/linux-pci.c
efivar-37/src/linux-pmem.c
efivar-37/src/linux-sas.c
efivar-37/src/linux-sata.c
efivar-37/src/linux-scsi.c
efivar-37/src/linux-soc-root.c
efivar-37/src/linux-virtblk.c
efivar-37/src/linux.c
efivar-37/src/linux.h
efivar-37/src/loadopt.c
efivar-37/src/makeguids.c
efivar-37/src/path-helpers.c
efivar-37/src/path-helpers.h
efivar-37/src/protocol-guids.txt
efivar-37/src/test/
efivar-37/src/test/.gitignore
efivar-37/src/test/Makefile
efivar-37/src/test/tester.c
efivar-37/src/ucs2.h
efivar-37/src/util.h
efivar-37/src/vars.c
phase `unpack' succeeded after 0.0 seconds
starting phase `bootstrap'
no 'configure.ac' or anything like that, doing nothing
phase `bootstrap' succeeded after 0.0 seconds
starting phase `patch-usr-bin-file'
phase `patch-usr-bin-file' succeeded after 0.0 seconds
starting phase `patch-source-shebangs'
phase `patch-source-shebangs' succeeded after 0.0 seconds
starting phase `patch-generated-file-shebangs'
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds
starting phase `build'
make[1]: Entering directory '/tmp/guix-build-efivar-37.drv-0/efivar-37/src'
aarch64-linux-gnu-gcc -O2 -flto -flto-partition=one -g3 -I/tmp/guix-build-efivar-37.drv-0/efivar-37/src/include/   -specs=/tmp/guix-build-efivar-37.drv-0/efivar-37/gcc.specs  -L.  -Wl,-rpath=/gnu/store/6frmf82qjvmmfanpdbbvf20ic4nxq3b4-efivar-37/lib -Wl,-z,muldefs     -DEFIVAR_BUILD_ENVIRONMENT -o makeguids makeguids.c guid.c -ldl
./makeguids guids.txt guids.bin names.bin \
	guid-symbols.c include/efivar/efivar-guids.h
./makeguids: ./makeguids: cannot execute binary file
make[1]: *** No rule to make target 'include/efivar/efivar-guids.h', needed by 'dp.o'.  Stop.
make[1]: Leaving directory '/tmp/guix-build-efivar-37.drv-0/efivar-37/src'
make: *** [Makefile:14: all] Error 2
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "16" "prefix=/gnu/store/6frmf82qjvmmfanpdbbvf20ic4nxq3b4-efivar-37" "libdir=/gnu/store/6frmf82qjvmmfanpdbbvf20ic4nxq3b4-efivar-37/lib" "CC_FOR_BUILD=aarch64-linux-gnu-gcc" "LDFLAGS=-Wl,-rpath=/gnu/store/6frmf82qjvmmfanpdbbvf20ic4nxq3b4-efivar-37/lib") exit-status: 2 term-signal: #f stop-signal: #f>
phase `build' failed after 0.4 seconds
command "make" "-j" "16" "prefix=/gnu/store/6frmf82qjvmmfanpdbbvf20ic4nxq3b4-efivar-37" "libdir=/gnu/store/6frmf82qjvmmfanpdbbvf20ic4nxq3b4-efivar-37/lib" "CC_FOR_BUILD=aarch64-linux-gnu-gcc" "LDFLAGS=-Wl,-rpath=/gnu/store/6frmf82qjvmmfanpdbbvf20ic4nxq3b4-efivar-37/lib" failed with status 2
note: keeping build directory `/tmp/guix-build-efivar-37.drv-1'
builder for `/gnu/store/gzsd4s1v7yddlmzby8jpjvxvviszaqrk-efivar-37.drv' failed with exit code 1
build of /gnu/store/gzsd4s1v7yddlmzby8jpjvxvviszaqrk-efivar-37.drv failed
View build log at '/var/log/guix/drvs/gz/sd4s1v7yddlmzby8jpjvxvviszaqrk-efivar-37.drv.bz2'.
guix build: error: build of `/gnu/store/gzsd4s1v7yddlmzby8jpjvxvviszaqrk-efivar-37.drv' failed
@vathpela
Copy link
Contributor

You should be able to set HOSTCC=gcc and have this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants