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

Link static libstdc++ with libicuc in NativeAOT #79501

Merged
merged 4 commits into from
Dec 12, 2022

Conversation

am11
Copy link
Member

@am11 am11 commented Dec 10, 2022

libicuc depends on libstdc++. Statically linking the ICU requires stdc++ to be linked. Also, to produce 100% static executable -Wl,-Bdynamic is unnecessary.

$ ldd --version 2>&1 | head -1
musl libc (aarch64)

$ dotnet publish -p:PublishAot=true -o dist
$ file dist/gh-79498
dist/gh-79498: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=8b2876d810f668a4713963382c5d31f635426b6f, with debug_info, not stripped

Fixes #79498

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Dec 10, 2022
@ghost
Copy link

ghost commented Dec 10, 2022

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

libicuc depends on libstdc++. Statically linking the ICU requires stdc++ to be linked. Also, to produce 100% static executable -Wl,-Bdynamic is unnecessary.

$ uname -a
Linux 4405bca6c481 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 Linux

$ dotnet publish -p:PublishAot=true -o dist
$ file dist/gh-79498
dist/gh-79498: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=8b2876d810f668a4713963382c5d31f635426b6f, with debug_info, not stripped

Fixes #79498

Author: am11
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@am11 am11 requested a review from jkotas December 10, 2022 23:39
@am11 am11 force-pushed the feature/nativeaot/static-icu branch from a3ae425 to 9dde554 Compare December 10, 2022 23:43
@am11 am11 force-pushed the feature/nativeaot/static-icu branch from 9dde554 to 26c7c02 Compare December 11, 2022 00:40
@jkotas
Copy link
Member

jkotas commented Dec 11, 2022

@smhmhmd @Beau-Gosse-dev Does this change look good?

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@smhmhmd
Copy link
Contributor

smhmhmd commented Dec 12, 2022

@jkotas
Thanks for letting us know.
Looks good to me.

Also, progress on full-static builds for Alpine is awesome.

@jkotas
Copy link
Member

jkotas commented Dec 12, 2022

All known failures according to the build analysis

@jkotas jkotas merged commit 21a8eb5 into dotnet:main Dec 12, 2022
kant2002 added a commit to kant2002/NativeAOTDocker that referenced this pull request Dec 26, 2022
dotnet/runtime#79501 is landed, so workaround is not needed
@ghost ghost locked as resolved and limited conversation to collaborators Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NativeAOT on Alpine with StaticICULinking
3 participants