Skip to content

Configure static linking for linux-gnu and windows #371

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

Closed
wants to merge 7 commits into from

Conversation

da-kami
Copy link
Member

@da-kami da-kami commented Mar 24, 2021

I think configuring this in the .cargo/config.toml is the way to go.

I read through this:
https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes
https://stackoverflow.com/questions/31770604/how-to-generate-statically-linked-executables

Since it mentions that this is a common problems with Windows I configured static linking for both the linux-gnu and windows target.

I did not see any reason to release a version that is dynamically linked (i.e. release both, dynamic and static linked), but if there is a good reason please let me know!

Fixes #347

@da-kami
Copy link
Member Author

da-kami commented Mar 24, 2021

Unfortunately this problem is not that easy to solve for Linux, because our code contains proc-macros and those are not supported when building statically as far as I understand from these threads:

https://stackoverflow.com/questions/57965805/alpine-dockerfile-cannot-produce-proc-macro-does-not-support-these-crate-typ
rust-lang/rust#40174
rust-lang/cargo#7563

Not sure if this can be solved - any ideas?

@da-kami
Copy link
Member Author

da-kami commented Mar 24, 2021

Unfortunately this problem is not that easy to solve for Linux, because our code contains proc-macros and those are not supported when building statically as far as I understand from these threads:

https://stackoverflow.com/questions/57965805/alpine-dockerfile-cannot-produce-proc-macro-does-not-support-these-crate-typ
rust-lang/rust#40174
rust-lang/cargo#7563

Not sure if this can be solved - any ideas?

If I understand it correct this issue should have been solved, see: rust-lang/rust#45601
I don't fully understand why we run into this problem.

da-kami and others added 7 commits March 24, 2021 17:35
This enforces static linking.

Resolves #347.
There is no reason to limit this, all the docker tests are outside
of the lib.
unknown-linux-gnu is the default for ubuntu, we don't need to
specify this.
This should fix build errors for the arm target.
@thomaseizinger
Copy link
Contributor

I am closing this as a wontfix.

Linking the binaries statically seems non-trivial.

bors bot added a commit that referenced this pull request Mar 25, 2021
380: Simplify CI workflow r=thomaseizinger a=thomaseizinger

Some patches extracted out of #371.

Co-authored-by: Thomas Eizinger <[email protected]>
@thomaseizinger thomaseizinger deleted the static-linking branch September 3, 2021 06:40
abraham-nixon added a commit to abraham-nixon/xmr-btc-swap that referenced this pull request Feb 15, 2022
380: Simplify CI workflow r=thomaseizinger a=thomaseizinger

Some patches extracted out of comit-network/xmr-btc-swap#371.

Co-authored-by: Thomas Eizinger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linux Binary releases are dynamically linked
2 participants