nix icon indicating copy to clipboard operation
nix copied to clipboard

MacOS: Undefined symbols for architecture x86_64

Open PsiACE opened this issue 4 years ago • 9 comments
trafficstars

   = note: Undefined symbols for architecture x86_64:
            "_preadv", referenced from:
                nix::sys::uio::preadv::h8c66d9fb8b619a73 in libnix-1b7d7137231b30ff.rlib(nix-1b7d7137231b30ff.nix.1b5c8824-cgu.0.rcgu.o)
            "_pwritev", referenced from:
                nix::sys::uio::pwritev::hb39f620af1eb34cc in libnix-1b7d7137231b30ff.rlib(nix-1b7d7137231b30ff.nix.1b5c8824-cgu.0.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

PsiACE avatar Nov 06 '21 13:11 PsiACE

What command results in that error? What version of OSX are you using? And, if you know, why doesn't this happen in CI?

asomers avatar Nov 16 '21 01:11 asomers

What command results in that error?

      - name: Run test
        uses: actions-rs/cargo@v1
        with:
          command: test
          components: rustfmt
          args: --all-features --no-fail-fast
        env:
          RUST_TEST_THREADS: 2
          RUST_LOG: debug
          RUST_BACKTRACE: full
          CARGO_INCREMENTAL: '0'
          RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests'
          RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests'

What version of OSX are you using?

macos-latest

And, if you know, why doesn't this happen in CI?

This happen in CI.

PsiACE avatar Nov 16 '21 02:11 PsiACE

I meant Nix's CI, not yours. Nix's CI does not fail with this error. Can you determine what is different about Nix's CI environment and yours? You have a lot of stuff in RUSTFLAGS there. Maybe one of those is responsible? Is there anything unusual about the toolchain you're using? And what command causes the error? What you pasted above is not a command, it's a github actions definition. I need to know exactly what command is failing.

asomers avatar Nov 16 '21 04:11 asomers

Looks like #1590 fixes the issue, I'll check it out.

Can you determine what is different about Nix's CI environment and yours?

I can't.

Maybe one of those is responsible?

I don't have a macos environment, but all this will not fail under linux.

Is there anything unusual about the toolchain you're using?

nightly-2021-09-11 with pprof, our project is https://github.com/datafuselabs/databend

And what command causes the error?

cargo test --all-features --no-fail-fast

PsiACE avatar Nov 16 '21 04:11 PsiACE

What version of OSX are you using? I can reproduce your problem on Catalina, but not Monterey or Big Sur. I don't know what you mean by "latest".

asomers avatar Nov 17 '21 01:11 asomers

For the Github Actions CI, 'macos-latest' is currently OSX v10.15 (or "Catalina" in your parlance).

rivy avatar Nov 17 '21 02:11 rivy

In that case the problem is either that one of your dependencies is actually trying to use preadv/pwritev, or it's the -Clink-dead-code. Normally unlinkable symbols shouldn't be a problem if they aren't actually used.

asomers avatar Nov 17 '21 02:11 asomers

It would have to be the -Clink-dead-code option as the code compiles and tests normally until testing code coverage (for our repo, 'uutils/coreutils'). Unfortunately, the -Clink-dead-code is required for code coverage by grcov.

Hmm... could it be feature-gated? Or, I guess, feature-blocked?

rivy avatar Nov 17 '21 03:11 rivy

In fact, it will be feature-gated in Nix 0.24.0. See #1498 .

asomers avatar Nov 17 '21 03:11 asomers