-
Notifications
You must be signed in to change notification settings - Fork 16
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
Cross-compiling from MacOS to x86_64-linux-musl #2
Comments
Hello ! |
If it requires a single statically-linked binary, than I recommend using the HiGHS solver, which is statically linked by default (in highs-sys). |
I've pushed a demo here - if you have time would appreciate your thoughts. The current error is this when using the Docker:
And also: rustup target add x86_64-unknown-linux-musl
CROSS_COMPILE=x86_64-linux-musl- cargo build --release --target x86_64-unknown-linux-musl gives the following error:
No luck with either |
The error seems to point vaguely to highs cpp |
Ok, I transferred the issue to the highs-sys repository. I think the problem is that highs-sys links highs itself dynamically, but it links libstdc++ dynamically, and your target doesn't have a libstdc++ https://github.com/rust-or/highs-sys/blob/master/build.rs#L55 |
Are you interested in working on this issue ? Could you make a PR that detects whether libstdc++ should be statically linked and sets the right values in build.rs ? You could also update the CI to add a linux musl target. |
I can certainly give it a go. Thanks for the quick investigation - wish I had flagged it several days ago now to be fair. Many thanks @lovasoa |
I'm not an expert with C++ and CMake, but it looks like it has a useful option to add standard library linker flags: So you should be able to add
to the build script. Of course you will need to have a |
If you have a linux system lying around, I'd advise you try to get it working without cross-compilation first (just creating a fully statically linked binary from linux), then check if it cross-compiles correctly. |
libstdc++ should indeed probably be statically linked, but contrarily to what I said your initial issue may not be with that. and the suggested workaround, using docker: rust-rocksdb/rust-rocksdb#440 (comment) |
Hey @lovasoa Managed to get hold of a Linux machine but unable to
Are you able to advise / take a look at this at all? |
Hello @rust-or/owners ,
Have you of you attempted to create an AWS Lambda using the library?
The text was updated successfully, but these errors were encountered: