Skip to content

Native C (bindgen) dependent crates do not compile? #53

Closed
@brainstorm

Description

@brainstorm

I wrongly filed this issue on rust-htslib: rust-bio/rust-htslib#179

After a bit more digging, I now believe it belongs here. I've put together a small reproducer using the serverless-aws-rust-multi template, just adding an additional lambda function called htslib:

https://github.com/brainstorm/serverless-aws-rust-multi-fail-native-crate

There's a full explanation and error log on the README from the repo above, but TL;DR the lamda-rust docker container doesn't seem to compile/link the rust-htslib crate with C bindings well:

  = note: /code/target/lambda/release/deps/librust_htslib-fc86895fccfb6420.rlib(rust_htslib-fc86895fccfb6420.rust_htslib.25lsx2fx-cgu.11.rcgu.o): In function `rust_htslib::bam::Reader::new::h7805fb2441edac2e':
          rust_htslib.25lsx2fx-cgu.11:(.text._ZN11rust_htslib3bam6Reader3new17h7805fb2441edac2eE+0x4c): undefined reference to `sam_hdr_read'
          /code/target/lambda/release/deps/librust_htslib-fc86895fccfb6420.rlib(rust_htslib-fc86895fccfb6420.rust_htslib.25lsx2fx-cgu.11.rcgu.o): In function `_$LT$rust_htslib..bam..Reader$u20$as$u20$core..ops..drop..Drop$GT$::drop::hc749ab5efb9aea68':
          rust_htslib.25lsx2fx-cgu.11:(.text._ZN66_$LT$rust_htslib..bam..Reader$u20$as$u20$core..ops..drop..Drop$GT$4drop17hc749ab5efb9aea68E+0x5): undefined reference to `hts_close'
          /code/target/lambda/release/deps/librust_htslib-fc86895fccfb6420.rlib(rust_htslib-fc86895fccfb6420.rust_htslib.25lsx2fx-cgu.11.rcgu.o): In function `rust_htslib::bam::hts_open::hac1f0f64c9261566':
          rust_htslib.25lsx2fx-cgu.11:(.text._ZN11rust_htslib3bam8hts_open17hac1f0f64c9261566E+0xc3): undefined reference to `hts_open'
          /code/target/lambda/release/deps/librust_htslib-fc86895fccfb6420.rlib(rust_htslib-fc86895fccfb6420.rust_htslib.25lsx2fx-cgu.11.rcgu.o): In function `_$LT$rust_htslib..bam..HeaderView$u20$as$u20$core..ops..drop..Drop$GT$::drop::h06ec3494656e04e9':
          rust_htslib.25lsx2fx-cgu.11:(.text._ZN70_$LT$rust_htslib..bam..HeaderView$u20$as$u20$core..ops..drop..Drop$GT$4drop17h06ec3494656e04e9E+0xb): undefined reference to `bam_hdr_destroy'
          collect2: error: ld returned 1 exit status

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions