Closed cmdln closed 4 years ago
Maybe it isn't correctly statically compiling?
Yes, static linking is failing. This is probably caused by some specific crate that you're including, probably one that links to a C library. Try running:
ldd target/x86_64-unknown-linux-musl/release/portcullis
This will print out any dynamic dependencies. Once you have a list, then things get fun: It will be necessary to figure out how to link those libraries statically. :-(
I will try that. The fact that the rust openssl package now has the vendored feature and at least one or two other crates I've seen seem to be going this route makes this a little less surprising. If it is one of the crates that does this, I will try to open an issue in their repo about better support for static compilation.
@emk thank you a lot! Your advice helped me find a root cause of a problem. I used С-library wrapped with Rust for a first time and forgot about static/dynamic libraries linking. It's not a solution but a first step and a right direction.
Great! Sorry for the slow response, and I'm happy everybody figured this out.
What did you try to do?
I built a project that I've built countless times before but recently ported from Iron over to Actix Web. The project continues to build without error. I tried to run the binary from target/x86_64-unknown-linux-musl. I am currently building with the 1.35.0 image. I am also building natively with 1.36.0 for Linux without any issues.
What happened?
When I try to run the resulting binary, I get the error "No such file or directory". I ran
file target/x86_64-unknown-linux-musl/release/my-binary
, and gotMaybe it isn't correctly statically compiling?
What did you hope to happen?
That the binary would actually run.
Does
./test-image
work?Yes.
OK. ALL TESTS PASSED.
Additional information
The openssl crate now has a "vendored" feature, I am using that in my Cargo.toml. Is it possible that is causing or exacerbating the problem?