tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.81k stars 320 forks source link

Clang wrapper scripts and `Exec format error` #339

Open ianks opened 2 years ago

ianks commented 2 years ago

When trying to use osxcross with certain tools, I was getting an Exec format error. It looks like the wrapper scripts do not include a shebang, which may be causing that:

$ cat /opt/osxcross/target/bin/aarch64-apple-darwin-clang
/opt/osxcross/target/bin/aarch64-apple-darwin20.2-clang "$@"

Ideally, they would look like this:

#!/bin/sh
/opt/osxcross/target/bin/aarch64-apple-darwin20.2-clang "$@"

Thanks for your work on osxcross!

MrGuoRanDuo commented 2 years ago
Caused by:
  process didn't exit successfully: `/mnt/d/target/release/build/ring-3320036641aed8cf/build-script-build` (exit status: 101)
  --- stdout
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_x86_64-apple-darwin = None
  CC_x86_64_apple_darwin = None
  TARGET_CC = None
  CC = Some("/home/ano/cross-compiler/bin/x86_64-apple-darwin21.1-cc")
  CFLAGS_x86_64-apple-darwin = None
  CFLAGS_x86_64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2,sse3,ssse3")

  --- stderr
  running "/home/ano/cross-compiler/bin/x86_64-apple-darwin21.1-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-arch" "x86_64" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconvers
ion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-alias
ing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/mnt/d/target/x86_64-apple-darwin/release/build/ring-739e069f0ef347d1/out/aesni-x86_64-macosx.o" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-
0.16.20/pregenerated/aesni-x86_64-macosx.S"
  thread 'main' panicked at 'failed to execute ["/home/ano/cross-compiler/bin/x86_64-apple-darwin21.1-cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-arch" "x86_64" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "
-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized
" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/mnt/d/target/x86_64-apple-darwin/release/build/ring-739e069f0ef347d1/out/aesni-x86_64-macosx.o" "/root/.cargo/registry
/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesni-x86_64-macosx.S"]: Exec format error (os error 8)', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:653:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

looks same like @ianks