-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
72 lines (56 loc) · 3.37 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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