Skip to content

Fail to cross compilation on Linux for Mac #25

@viirya

Description

@viirya

Hi,

I'm working on cross-compilation of a project on Linux for Mac binaries. Got an error currently:

error: failed to run custom build command for `lz4-sys v1.9.2`

Caused by:
  process didn't exit successfully: `/opt/core/target/release/build/lz4-sys-635d53f76c21d05f/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,llvm14-builtins-abi,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,v8.1a,v8.2a,v8.3a,v8.4a,vh")
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/opt/core/target/aarch64-apple-darwin/release/build/lz4-sys-6a23633e37c16f77/out/liblz4/lib/lz4.o" "-c" "liblz4/lib/lz4.c"
  cargo:warning=cc: error: arm64: No such file or directory
  cargo:warning=cc: error: unrecognized command line option ‘-arch’; did you mean ‘-march=’?
  exit status: 1
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/opt/core/target/aarch64-apple-darwin/release/build/lz4-sys-6a23633e37c16f77/out/liblz4/lib/lz4frame.o" "-c" "liblz4/lib/lz4frame.c"
  cargo:warning=cc: error: arm64: No such file or directory
  cargo:warning=cc: error: unrecognized command line option ‘-arch’; did you mean ‘-march=’?
  exit status: 1

  --- stderr

So based on https://stackoverflow.com/questions/4391192/why-do-i-get-cc1plus-error-unrecognized-command-line-option-arch, seems -arch is only for Xcode's gcc. Not sure if lz4-sys's custom build script is able to make some change to fix that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions