Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Error: linking with cc failed #322

Closed
jklukas opened this issue Jan 27, 2022 · 4 comments
Closed

Error: linking with cc failed #322

jklukas opened this issue Jan 27, 2022 · 4 comments

Comments

@jklukas
Copy link
Contributor

jklukas commented Jan 27, 2022

When trying to compile this project for the first time and run tests, I ran into some linking error.

I ran the documented instructions:

$ docker-compose -f dev/docker-compose.yaml up -d
$ cargo test

The docker-compose configuration launched successfully, but cargo test failed with:

<snip>

   Compiling merino-adm v0.5.1 (/Users/jklukas/Code/merino/merino-adm)
   Compiling merino-web v0.5.1 (/Users/jklukas/Code/merino/merino-web)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" "/Users/jklukas/Code/merino/target/debug/deps/merino_settings-54cf418990a9e503.1509bqjy37dfkjbp.rcgu.o"

<snip>

  = note: 0  0x10286c224  __assert_rtn + 128
          1  0x1028717e8  ld::tool::OutputFile::addressAndTarget(ld::Internal const&, ld::Fixup const*, ld::Atom const**) (.cold.1) + 0
          2  0x1027ab104  ld::tool::OutputFile::addressOf(ld::Internal const&, ld::Fixup const*, ld::Atom const**) + 252
          3  0x1027acdfc  ld::tool::OutputFile::applyFixUps(ld::Internal&, unsigned long long, ld::Atom const*, unsigned char*) + 4004
          4  0x1027b1540  ld::tool::OutputFile::writeAtoms(ld::Internal&, unsigned char*) + 356
          5  0x1027a8fa4  ld::tool::OutputFile::writeOutputFile(ld::Internal&) + 408
          6  0x1027a1adc  ld::tool::OutputFile::write(ld::Internal&) + 216
          7  0x10272f1d8  main + 584
          A linker snapshot was created at:
          	/tmp/merino_settings-54cf418990a9e503-2022-00-26-190755.ld-snapshot
          ld: Assertion failed: (_mode == modeFinalAddress), function finalAddress, file ld.hpp, line 1190.
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `merino-settings` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

I'm running on a new M1 Macbook Pro which could well be related. Do we know of anybody who has been doing development on merino using an Apple Silicon machine?

┆Issue is synchronized with this Jira Task

@mythmon
Copy link
Contributor

mythmon commented Jan 27, 2022

Ah, I don't think anyone has been using Apple Silicon to work on Merino yet. I think in theory this should work, so it might worth figuring out what's going on here. That being said, I don't have access to Apple SIlicon, so it would be difficult for me to debug directly. This is certainly a strange issue!

Could you paste the entire compilation log onto something like https://paste.mozilla.org and send it to me?

@jklukas
Copy link
Contributor Author

jklukas commented Jan 27, 2022

Could you paste the entire compilation log onto something like https://paste.mozilla.org and send it to me?

Sent. I can also try running in a terminal in Rosetta mode, but I'd likely need to learn more about clearing out build cache, and potentially keep a separate install of rust for Rosetta.

@mythmon
Copy link
Contributor

mythmon commented Jan 27, 2022

Clearing the build cache is simple: cargo clean. Often however Rust will automatically store it's built artifacts in different places for different architectures, so you may not even need to do that. As for running rust in Rosetta mode, I can't offer any suggestions there.

@pjenvey
Copy link
Member

pjenvey commented Feb 16, 2022

This sounds like this issue rust-lang/rust#90342

It offers a workaround: cargo clean, then retry again w/ export MACOSX_DEPLOYMENT_TARGET=10.7.

Feel free to reopen this if that doesn't solve it.

@pjenvey pjenvey closed this as completed Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants