Skip to content

x86_64-apple-darwin: unrecognized command line option ‘-arch’ #710

Open
@wafflespeanut

Description

@wafflespeanut

When I attempted to cross-compile cxx from linux, I got the following emitted from link-cplus-plus dependency, which uses cc-rs:

   Compiling link-cplusplus v1.0.6 (/work/depends/link-cplusplus)
The following warnings were emitted during compilation:

warning: c++: error: x86_64: No such file or directory
warning: c++: error: unrecognized command line option '-arch'; did you mean '-march='?

error: failed to run custom build command for `link-cplusplus v1.0.6 (/work/depends/link-cplusplus)`

Caused by:
  process didn't exit successfully: `/work/depends/link-cplusplus/target/debug/build/link-cplusplus-8998b4e36463b047/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  CXX_x86_64-apple-darwin = None
  CXX_x86_64_apple_darwin = None
  TARGET_CXX = None
  CXX = None
  CROSS_COMPILE = None
  CXXFLAGS_x86_64-apple-darwin = None
  CXXFLAGS_x86_64_apple_darwin = None
  TARGET_CXXFLAGS = None
  CXXFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2,sse3,ssse3")
  running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/work/depends/link-cplusplus/target/x86_64-apple-darwin/debug/build/link-cplusplus-a777ebbad1615f40/out/dummy.o" "-c" "/work/depends/link-cplusplus/target/x86_64-apple-darwin/debug/build/link-cplusplus-a777ebbad1615f40/out/dummy.cc"
  cargo:warning=c++: error: x86_64: No such file or directory
  cargo:warning=c++: error: unrecognized command line option '-arch'; did you mean '-march='?
  exit status: 1

  --- stderr

  error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/work/depends/link-cplusplus/target/x86_64-apple-darwin/debug/build/link-cplusplus-a777ebbad1615f40/out/dummy.o" "-c" "/work/depends/link-cplusplus/target/x86_64-apple-darwin/debug/build/link-cplusplus-a777ebbad1615f40/out/dummy.cc" with args "c++" did not execute successfully (status code exit status: 1).

Instead of -arch x86-64, the argument should be -march=x86-64 for darwin target (-march instead of -arch as key-value parameter and Apple target is dashed x86-64 instead of x86_64).

If there's some way to override or work around this, then I'd happily go for that until this issue can be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-appleApple targets and toolchains

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions