-
-
Notifications
You must be signed in to change notification settings - Fork 75
Native C (bindgen) dependent crates do not compile? #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@softprops trying to figure out this as I go... After jumping into your container bypassing the entrypoint to interactively try to figure this out:
And also installing
I'm still having compilation issues right after calling
I also wonder how does this container build for musl since I cannot seem to find a compiler in there:
So far I have been unable to reproduce my host Any ideas on how to fix this are much appreciated! |
In a nutshell, after getting into the container I do:
Minimal changes to your diff --git a/build.sh b/build.sh
index 39320c3..b72d1f0 100755
--- a/build.sh
+++ b/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
# build and pack a rust lambda library
# https://aws.amazon.com/blogs/opensource/rust-runtime-for-aws-lambda/
@@ -23,7 +23,7 @@ export CARGO_TARGET_DIR=$PWD/target/lambda
# cargo only supports --release flag for release
# profiles. dev is implicit
if [ "${PROFILE}" == "release" ]; then
- cargo build ${CARGO_FLAGS:-} --${PROFILE}
+ cargo build ${CARGO_FLAGS:-} --${PROFILE} --verbose --target x86_64-unknown-linux-musl
else
cargo build ${CARGO_FLAGS:-}
fi Also slightly modifying the
But still I'm getting the same linker error:
What am I doing wrong? :/ |
Hello @nlhepler! I just noticed your recently merged Also @clux refers to other I'm new to rust-htslib and bindgen and *-sys crates and its packaging intricacies, so any directions/suggestions on how to fix this are very appreciated :) |
Hi @brainstorm! We did! Exciting times. I'm also very new to these things, but I was also trying to follow the guidelines. My understanding is that the -sys library that links the system library needs to specify links=, and indeed, the hts-sys package does specify links: https://github.com/rust-bio/rust-htslib/blob/master/hts-sys/Cargo.toml#L6. My understanding is that rust-htslib does not need links=, it only needs to depend on an hts-sys. |
LLVM being required may be part of the linker rust uses. I am not entirely sure, I have seen these errors from time to time myself, but I've always had llvm-config to add to PATH. |
Thanks @nlhepler for the pointers! Yesterday I managed to fix the I'll try to import the fix to this |
Aaand, problem solved! I just had to do this inside the container:
Since the installed clang/llvm is 3.6 but htslib seems to require clang 3.9 minimum. Next up is pullrequest and a testcase, thanks everyone! |
For me it failed here:
Is this the same issue or a other one? |
@johansmitsnl Check |
I found that musl-gcc is not installed in the image. Installing makes it build. Why is musl-gcc not available? |
The goal here is to leverage a build environment that aligns as closly with the runtime as possible. We could add |
I wrongly filed this issue on
rust-htslib
: rust-bio/rust-htslib#179After 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:
The text was updated successfully, but these errors were encountered: