jguhlin / minimap2-rs

Rust bindings to minimap2 library
Other
60 stars 13 forks source link

Difficulty building on M1 mac #81

Open rob-p opened 2 weeks ago

rob-p commented 2 weeks ago

Hi @jguhlin,

I encounter the following error when attempting to include the minimap2-rs crate when building on OSX on an M1 Mac (MacOS 13.4):

  = note: ld: warning: directory not found for option '-L/Users/rob/software_src/oarfish/target/release/build/libz-sys-388cc2f2b07c10b2/out/lib64'
          Undefined symbols for architecture arm64:
            "_gzclose", referenced from:
                _mm_bseq_close in libminimap2_sys-4b0173a9259d886d.rlib(aa1d8596991defc1-bseq.o)
            "_gzdopen", referenced from:
                _mm_bseq_open in libminimap2_sys-4b0173a9259d886d.rlib(aa1d8596991defc1-bseq.o)
            "_gzopen", referenced from:
                _mm_bseq_open in libminimap2_sys-4b0173a9259d886d.rlib(aa1d8596991defc1-bseq.o)
            "_gzread", referenced from:
                _ks_getuntil2 in libminimap2_sys-4b0173a9259d886d.rlib(aa1d8596991defc1-bseq.o)
                _kseq_read in libminimap2_sys-4b0173a9259d886d.rlib(aa1d8596991defc1-bseq.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Have you seen anything like this before? Any idea why the relevant libz functions might not be found?

Thanks!

rob-p commented 2 weeks ago

I was able to get this to compile by manually overriding the rust flags (as below), but that shouldn’t be necessary. Any ideas why?

RUSTFLAGS=‘-C link-args=-lz’ cargo build —-release
jguhlin commented 2 weeks ago

Hmm that should be a change we can make in build.rs script for it.

I don't have a Mac to test on, but will take a stab at it soon

On Tue, 27 Aug 2024, 11:33 am Rob Patro, @.***> wrote:

I was able to get this to compile by manually overriding the rust flags (as below), but that shouldn’t be necessary. Any ideas why?

RUSTFLAGS=‘-C link-args=-lz’ cargo build —-release

— Reply to this email directly, view it on GitHub https://github.com/jguhlin/minimap2-rs/issues/81#issuecomment-2311287515, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOA2CFJAUBPEXLGPTFS76LZTO3LDAVCNFSM6AAAAABNELLLGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJRGI4DONJRGU . You are receiving this because you were mentioned.Message ID: @.***>