-
Notifications
You must be signed in to change notification settings - Fork 2
A wrapper around gcc for creating binaries without dependencies on newer glibc versions
sulix/bingcc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
bingcc is a wrapper around gcc and mjau's gensymoverride for generating binaries which do not depend on newer glibc versions. It's got a pretty basic website at http://davidgow.net/hacks/bingcc.html It doesn't touch libstdc++ at all, just libc, so while it should fix most of the GLIBC errors, it won't do a thing about the GLIBCXX ones. Try statically linking libstdc++ or using an old compiler (before gcc 4.6; you're probably pretty safe if you don't use many fancy STL features). Be warned: there a several cases where using bingcc will simply stop your program from compiling. Basically, if you try to use too new a feature, it'll give up. You can get around this sort of thing by running setup-bingcc with a higher glibc version, or by somehow finding a compiler switch to disable the missing functionality. bingcc will add some of these flags automatically. Hopefully this will help make the world just a little more compatible. If it's not working (it's really just a bit of an experiment), let me know. Using an older toolchain (or indeed an older distro in a VM) will probably be a bit more reliable. It's all in the public domain (or Creative Commons Zero) except for gensymoverride, which isn't mine to license. Have fun with it, and let me know if you make any improvements. The "32" versions of things simply add "-m32" to the cflags for cross-compiling. You'll probably need to hack some of the paths in the various files in order to get it to work on anything other than the latest amd64 ubuntu release. You also might need to add CFLAGS=-fno-finite-math-only to your environment to counteract the use of -ffast-math. WARNING: This doesn't work for binaries built with glibc 2.34 or later yet, as __libc_start_main has been updated, and is linked in differently. Shared libraries do tend to work, though. You can work around this by removing the __libc_start_main version using patchelf[1]: patchelf --clear-symbol-version __libc_start_main [filename] WARNING: Equally, this doesn't handle the fact that libpthread, libdl, libm, etc. are now part of the main libc.so library, which means that binaries built with bingcc will not have these libraries in the NEEDED section. Again, this can be worked around with LD_PRELOAD, or patched with patchelf: patchelf --add-needed <libpthread.so.0, etc> Usage: [optional]: run ./setup-bingcc [max glibc version] - This scans your system libraries and generates the header using mjau's gensymoverride. Max glibc version defaults to 2.14. You'll need to run this manually if you're using a verion older than 2.33 (due to changes in stat functions), or later than 2.34 (as that's the version the built-in ones were generated from). run bingcc-env: - This launces a bash shell which will have bingcc set up: it sets the CC and CXX environment variables to point to bingcc/bing++. ./configure (or cmake) and build within this shell. check to see if it worked: - use objdump -p <binary> to have a look at what's required - objdump -CT <binary> | grep <version> to see what symbols are causing problems. Notes: There's some commented out code for stdc++ stuff, which might work pre gcc4.6, but I've not had much luck yet myself. There's a script to download and compile the Simple Directmedia Layer (v1.2) in the examples/ directory. Have a look if that's your thing. There's also one to build libogg/libvorbis and friends. [1]: https://github.com/NixOS/patchelf
About
A wrapper around gcc for creating binaries without dependencies on newer glibc versions
Resources
Stars
Watchers
Forks
Packages 0
No packages published