Skip to content
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

Statically link librarys when building to fix OpenSSL #79

Closed
wants to merge 1 commit into from

Conversation

veloii
Copy link

@veloii veloii commented Oct 8, 2023

This is required for OpenSSL to work properly when building on Alpine, otherwise a segmentation fault will occur.

sfackler/rust-openssl#1462
est31/cargo-udeps#89

It seems the solution to this issue is to add RUSTFLAGS="-C target-feature=-crt-static". Another solution would be allowing the user to set their own RUSTFLAGS however I'm not experienced enough with bash and github actions to create and test it.

This would also fix #66 and #49.

@Douile
Copy link
Member

Douile commented Oct 9, 2023

Thanks for looking into this!

You should be able to set environment variables with the env job property, the scripts don't override this variable so setting RUSTFLAGS here should work.

I'm not sure static linking is the best default configuration, it would be better to add an easy flag to enable static linking e.g.

with:
  static-linking: true

@veloii
Copy link
Author

veloii commented Oct 9, 2023

Yeah I agree, it should probably also be noted in the README.md as it would be very helpful as it took me a couple hours to figure out the issue. I'm not really good with bash or docker so I wouldn't be able to implement this in this pr.

@Douile
Copy link
Member

Douile commented Oct 22, 2023

My mistake, I had forgotten the default for rust: when building for the musl target (the actions default) static linking is enabled by default 1. What the option you provided is actually doing is disabling static linking 1. That being said if it fixes issues it is a good option to have, but I wanted you to be aware that you are producing a dynamically linked library not a statically linked one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Build lib lettre in target X86_64_UNKNOWN_LINUX_MUSL, build success but got segment fault
2 participants