Closed zrzka closed 5 years ago
I have never seen that error before :/
There's another warning in the output (did overlook it before), which says:
ld: warning: ignoring file rust-mozjs/target/debug/build/mozjs-f51f5dceff420288/out/libjsglue.a,
file was built for archive which is not the architecture being linked (x86_64):
rust-mozjs/target/debug/build/mozjs-f51f5dceff420288/out/libjsglue.a
And lipo says:
Non-fat file: rust-mozjs/target/debug/build/mozjs-f51f5dceff420288/out/libjsglue.a
is architecture: x86_64
Okay, had time to investigate more. I've found that the wrong ar
(archiver) was used - because of the wrong PATH
. Tools from different sources (system vs brew llvm vs brew binutils) were used.
There are two ways to fix this:
/usr/bin
should be first in PATH
, not /usr/local/bin
brew uninstall llvm binutils
Both ways works fine with rlib
& cdylib
. It was a problem on my side, not rust-mozjs
. Closing. Sorry for the noise.
I'm trying to use
mozjs
crate in one of my project and I'm encountering linker issues. It always fails with the following error message:It has something to do with
cdylib
. Tried to create minimal reproducible example:src/lib.rs
contains just one lineuse mozjs;
.cargo build
- doesn't work (same error message)cargo test
- doesn't work (same error message)When I remove the whole
[lib]
section:cargo build
- workscargo test
- doesn't work (same error message)Hmm, weird. Even this doesn't work. Did checkout
rust-mozjs
repo and tried same commands there:cargo build
- workscargo test
- doesn't work (same error message)I checked your
.travis.yml
and followed all steps forosx
likebrew install autoconf@2.13 ccache llvm yasm
, but still no luck.I'm running macOS 10.14.3 (18D109) & Xcode 10.1 (10B61) & reinstalled Xcode command line tools.
Did you ever saw this error message? Any idea how this can be fixed? I've found couple of similar issues (Google), but none of those recommendations (like link toolchain frameworks to
/Library/Frameworks
) help.