For Alpine and Void-Linux as statical single executable without loading shared objects. #82830
Unanswered
DeafMan1983
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone, I am working on Ubuntu 22.04 and I have invented about
""clang" ..."
since dotnet process output. I have found if I have compiled static libraries with specific libraries like -lX11 or etcI wrote a code with included headers for example:
Save x11sharp.cpp. I use qemu with Void-Linux via SharedFolder to host and I prompt with musl-gcc-static from Void-Linux:
Create simple classlib from dotnet
And I type example.
And create simple console project for native aot
And add reference to console project.
Publish your dotnet with native aot and include library
Then it happens if you get error message of clang because clang doesn't find extra libraries if I add gui specific framework from C/headers in static library
libx11sharp.a
.Copy command line from error message from dotnet.
Then I replace
"clang"
withmusl-gcc -static
, find-lrt
add after-lrt
:-lX11 -lxcb -lXau -lXdmcp
and remove-pie
. And prompt until it has generated to real console executable with native aot.I recommend you first
strip -S
from Ubuntu 22.04 or Void-Linux.If you like get small executable then
upx --best
from Ubuntu 22.04 because Ubuntu 22.04 upx from website made smaller than Void-Linux's upx if you see which results:upx from website 2.2Mb
upx from Void-Linux or Alpine 2.4Mb
See more in my video for Example X11Test.
Enjoy your development without loaded so files.
Beta Was this translation helpful? Give feedback.
All reactions