Comments (15)
Does LDFLAGS="--static -Wl,--start-group" work?
from toybox.
The problem I'm having is I can dynamically pull in libssl from my host, but when I try to statically link additional libraries my build goes all /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/libgcc_eh.a(unwind-dw2.o): in function uw_init_context_1': (.text+0x1de5): undefined reference to
pthread_once'
which is libgcc_eh.a trying to pull in pthreads, and from there it goes /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libcrypto.a(dso_dlfcn.o): in function dlfcn_globallookup': (.text+0x11): undefined reference to
dlopen' which CAN'T work (you can't dlopen() from a static binary)...
You're saying you have a build environment in which statically linking libssl is possible in the first place, and I'm going... alpine maybe?
I tried to use the android NDK to statically build android_defconfig but that went ./lib/lsm.h:7:10: fatal error: 'selinux/selinux.h' file not found NDK r25c doesn't have selinux.h.
So I tried to set up a fedora kvm to test static libselinux building, but "sudo yum install glibc-static" there didn't give me static libraries for anything else (still only libselinux.so not .a)...
This is part of the reason I try to minimize build dependencies. The accelerators are available for android to use them, and Elliott tests them, but they tend to tangle for me.
from toybox.
I tried to use the android NDK to statically build android_defconfig but that went ./lib/lsm.h:7:10: fatal error: 'selinux/selinux.h' file not found NDK r25c doesn't have selinux.h.
yeah, libselinux (which is code you should only look at on a strong stomach: SELinuxProject/selinux#417) is not part of the NDK.
This is part of the reason I try to minimize build dependencies. The accelerators are available for android to use them, and Elliott tests them, but they tend to tangle for me.
the rules around building these libraries are weird because of FIPS, but i can report "works for me!".
from toybox.
Link order only matters for static libraries. I can maintain a magic link order (although I'd rather have the compiler just do --start-group and resolve it itself if that still works), but can't test it...
from toybox.
yes i am using musl static toolchain ... will try the option
from toybox.
TBO ... my build environment currently looks like this:
- Linux Mint 21.x aka. Ubuntu 22.04.x (glibc)
- static musl toolchain build using musl-cross-make
- maven based airlock build system
from toybox.
ok with the option the toybox binary builds fine.
the only warning i get is:
/toolchain/bin/../lib/gcc/x86_64-linux-musl/10.2.1/../../../../x86_64-linux-musl/bin/ld:
missing --end-group; added as last command line option
from toybox.
i also tested the wget bugger, i was getting the build errors in the first place.
a simple toybox wget https://www.google.com
worked.
from toybox.
could it make sense to add a STATIC_BUILD
option to config that would set LDFLAGS="--static -Wl,--start-group"
automatically ?
from toybox.
Does commit 1b6d64f work for you?
from toybox.
test compiles ... ok
wget on https://www.google.com ... works
good work !
from toybox.
In case this is not known yet, this apparently breaks the build on MacOS:
ld: unknown option: --start-group
from toybox.
In case this is not known yet, this apparently breaks the build on MacOS:
ld: unknown option: --start-group
is that a missing feature of clang ?
from toybox.
Apparently, the fix for this seems pretty simple though. Some
stuff in portability.sh should fix it.
Actually, since we are doing -l, I don't even think we need the
start-group stuff, it compiles fine without it on my system
from toybox.
@landley after reading your blog, please pardon me as i was not observing enough.
i will keep using custom LDFLAGS for my buildsystem.
please keep up the good work !
from toybox.
Related Issues (20)
- xargs has non-conforming behavior (failing to exit) when a child exits with exit status 255 HOT 3
- install does not handle the creation of "drwxr-s---" correctly HOT 6
- xsendfile error checking
- add a useful common ip HOT 3
- Request diff -I/--ignore-matching-lines
- [Documentation] Differences to busybox? HOT 3
- [Feature request] Could a static-option be added to the menu interface? HOT 5
- [Documentation / Question] Can toybox be combined with e. g. mruby? HOT 9
- building a rootfs without a kernel HOT 10
- Most scripts use /bin/bash, which not all systems have. Use /usr/bin/env instead? HOT 11
- [Q] Can `bash` compatibility in toysh be turned off during build time and during run time? HOT 2
- When running shell scripts, the process coredump.
- POSIX deviation: test arithmetic operands must support decimal only HOT 12
- find -size <number-without-suffix> not POSIX HOT 7
- Can you include oksh? HOT 1
- On incremental builds' reproducibility HOT 1
- ASAN failures in various file processing commands HOT 1
- [Feature Suggestion] progress meter (pv subcommand) HOT 5
- [FR] envsubst HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toybox.