cc1 execv: Exec format error, on macOS 11.6 Xcode 13.0

Georgi Valkov gvalkov at abv.bg
Fri Oct 1 08:55:51 PDT 2021


I just noticed that building from an empty directory fails on macOS 11.6 with Xcode 13.0.
This is likely due to some build script not recognising the latest version of Xcode or clang.
As a result cc1 is compiled for unknown architecture, and cannot be executed on the host:
cc1:	file format coff-<unknown arch>
staging_dir/toolchain-mips_24kc_gcc-11.2.0_musl/libexec/gcc/mips-openwrt-linux-musl/11.2.0/cc1

`objdump -x cc1` on the old build returns:
cc1:	file format mach-o 64-bit x86-64

clang --version
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Can anyone please point me where the checks are made and how to try fixing this?
I would be happy to contribute a PR, I just need a bit of help to get started.


Complete build log:
https://httpstorm.com/support/openwrt/2021-10-01/

Error message:
checking whether C compiler works... no; compiler output follows:
mips-openwrt-linux-musl-gcc: fatal error: cannot execute '/Volumes/wrt3200/openwrt/staging_dir/toolchain-mips_24kc_gcc-11.2.0_musl/libexec/gcc/mips-openwrt-linux-musl/11.2.0/cc1': execv: Exec format error

Short log:
make[3]: Entering directory '/Volumes/wrt3200/openwrt/toolchain/musl'
mkdir -p /Volumes/wrt3200/openwrt/dl
SHELL= flock /Volumes/wrt3200/openwrt/tmp/.musl-1.2.2.tar.gz.flock -c '  	/Volumes/wrt3200/openwrt/scripts/download.pl "/Volumes/wrt3200/openwrt/dl" "musl-1.2.2.tar.gz" "9b969322012d796dc23dda27a35866034fa67d8fb67e0e2c45c913c3d43219dd" "" "https://musl.libc.org/releases/"    '
+ curl -f --connect-timeout 20 --retry 5 --location --insecure https://musl.libc.org/releases/musl-1.2.2.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1030k  100 1030k    0     0   497k      0  0:00:02  0:00:02 --:--:--  497k
. /Volumes/wrt3200/openwrt/include/shell.sh; gzip -dc /Volumes/wrt3200/openwrt/dl/musl-1.2.2.tar.gz | tar -C /Volumes/wrt3200/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/musl-1.2.2/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/* /Volumes/wrt3200/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/musl-1.2.2

Applying ./patches/110-read_timezone_from_fs.patch using plaintext: 
patching file src/time/__tz.c

Applying ./patches/200-add_libssp_nonshared.patch using plaintext: 
patching file Makefile
patching file libssp_nonshared/__stack_chk_fail_local.c

Applying ./patches/300-relative.patch using plaintext: 
patching file Makefile

Applying ./patches/600-nftw-support-common-gnu-extension.patch using plaintext: 
patching file include/ftw.h
patching file src/misc/nftw.c

Applying ./patches/900-iconv_size_hack.patch using plaintext: 
patching file src/locale/iconv.c
patching file src/locale/codepages.h

Applying ./patches/901-crypt_size_hack.patch using plaintext: 
patching file src/crypt/crypt_sha512.c
patching file src/crypt/crypt_blowfish.c
patching file src/crypt/crypt_sha256.c
touch /Volumes/wrt3200/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/musl-1.2.2/.prepared881524106529731ec405d68938b4abdf_6664517399ebbbc92a37c5bb081b5c53
ln -snf musl-1.2.2 /Volumes/wrt3200/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/musl
( cd /Volumes/wrt3200/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/musl-1.2.2; rm -f config.cache; AR="mips-openwrt-linux-musl-gcc-ar" AS="mips-openwrt-linux-musl-gcc -c -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DCRYPT_SIZE_HACK" LD=mips-openwrt-linux-musl-ld NM="mips-openwrt-linux-musl-gcc-nm" CC="mips-openwrt-linux-musl-gcc" GCC="mips-openwrt-linux-musl-gcc" CXX="mips-openwrt-linux-musl-g++" RANLIB="mips-openwrt-linux-musl-gcc-ranlib" STRIP=mips-openwrt-linux-musl-strip OBJCOPY=mips-openwrt-linux-musl-objcopy OBJDUMP=mips-openwrt-linux-musl-objdump SIZE=mips-openwrt-linux-musl-size CFLAGS="-pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DCRYPT_SIZE_HACK" CROSS_COMPILE="mips-openwrt-linux-musl-" /Volumes/wrt3200/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/musl-1.2.2/configure --prefix=/ --host=x86_64-apple-darwin20.6.0 --target=mips-openwrt-linux-musl --disable-gcc-wrapper --enable-debug --enable-optimize );
checking for C compiler... mips-openwrt-linux-musl-gcc
checking whether C compiler works... no; compiler output follows:
mips-openwrt-linux-musl-gcc: fatal error: cannot execute '/Volumes/wrt3200/openwrt/staging_dir/toolchain-mips_24kc_gcc-11.2.0_musl/libexec/gcc/mips-openwrt-linux-musl/11.2.0/cc1': execv: Exec format error
compilation terminated.
make[3]: *** [Makefile:33: /Volumes/wrt3200/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/musl-1.2.2/.configured] Error 1
make[3]: Leaving directory '/Volumes/wrt3200/openwrt/toolchain/musl'
time: toolchain/musl/compile#0.20#0.50#3.04
    ERROR: toolchain/musl failed to build.
make[2]: *** [toolchain/Makefile:97: toolchain/musl/compile] Error 1
make[2]: Leaving directory '/Volumes/wrt3200/openwrt'
make[1]: *** [toolchain/Makefile:93: /Volumes/wrt3200/openwrt/staging_dir/toolchain-mips_24kc_gcc-11.2.0_musl/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory '/Volumes/wrt3200/openwrt'
make: *** [/Volumes/wrt3200/openwrt/include/toplevel.mk:230: world] Error 2


Thank you in advance for any help!
Georgi Valkov




More information about the openwrt-devel mailing list