Unable to properly specify a linker for building to x86 Darwin from Linux #1444
Unanswered
SwissArmyWrench
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Firstly, are you actually using cross? We don't support |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey folks, I am working towards my first release of a small little tool I wrote, and I am working on compiling my binaries for release. I am trying to run cross-rs on my dev server to compile binaries for MacOS. However, I am encountering a linker problem. After doing all of the rest of the compilation without issue, it fails when trying to do the linking. I get an error that says
note: cc: error: unrecognized command-line option -arch
.Talking about this with one of my buddies, we believe that this is due to the compilation happening within Linux but with the rustup target for macOS: On macOS,
gcc
is actually an alias for theclang
compiler/linker, but on the linux system, the call togcc
invokes the actuall GCC, the GNU C Compiler. To try to confirm this, I installed clang on my system and then called it with the -arch flag, and it complained about it not being used correctly, instead of the previous error that didn't recognize the option at all. This leads me to believe i'm on the right track with thinking that rustup is expecting to find a different linker that it actually gets.Now to actually do something about it. I currently have in my Cross.toml some custom settings for the
x86_64-apple-darwin
target. This includes some prebuild commands that install Clang. However, I am having a difficult time getting the compilation process to actually use clang, even though it's there. I have tried things like adding a set command to set the environment variable to use the linker, using an alias, passing the env variable directly with thecross build
command, but with no luck whatsoever.Can anybody who's done this walk me through how they made it work? Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions