Open fish4terrisa-MSDSM opened 2 years ago
What did you do to have a static build?
To port box64 to termux. :-) static binaries works well on termux
Not asking why, but how, so I can reproduce on my side.
l just add these lines after the first line of CMakeLists.txt:
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "-static")
so the first lines of it is
cmake_minimum_required(VERSION 3.4) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "-static")
(there are few lines ,but github just showed it as one line)
Ok, I'll try to get a solution for static build.
Thank you.
I'd also like a static build of this (use as a drop-in replacement for QEMU inside a Docker container but I know you didn't ask).
I kept running across issue #146 when googling if anyone had a static build of this just publicly available. I almost commented on that very old issue before I saw this one from much more recently.
I have had multiple people say box64 is much faster than QEMU for running the Minecraft Bedrock server (only available in x86_64) in comments / issues on some of my projects that run on aarch64. It makes it go from pretty laggy on Raspberry Pi to almost perfect.
At any rate consider this seconded for purposes of embedded devices / multiarch / other useful scenarios that if you spend the time on this will be utilized by downstream projects. Thanks!
@ptitSeb Any progress on this? The main use case would be a drop-in replacment for qemu-user-static
as @TheRemote already mentioned.
I did nome testing not too long ago about this but without getting good result. I need to use a more drastic approach on this to succeed. Not sure when I'll work on this tho, it's quite a heavy change I have in mind.
@ptitSeb Any progress on this? The main use case would be a drop-in replacment for
qemu-user-static
as @TheRemote already mentioned.
And, if it can replace qemu-user-static
, it would also be possible to combine box64 with proot.
@ptitSeb Any progress on this? The main use case would be a drop-in replacment for
qemu-user-static
as @TheRemote already mentioned.And, if it can replace
qemu-user-static
, it would also be possible to combine box64 with proot.
Well yeah, but to do what? the static build of box64 will have (very) limited wrapped functionnality. So no wrapped opengl, vulkan or pulse audio. Basicaly, it can be use for headless server stuffs, but not for gaming.
Finaly got a static build of box64. I have just tested the integrated test and they works. Running bash
doesn't work because I'm not on a x86_64 chroot.
There are some limitation of the static build: mainly: no lib wrapping. It might still work for headless usecases.
Finaly got a static build of box64. I have just tested the integrated test and they works. Running
bash
doesn't work because I'm not on a x86_64 chroot. There are some limitation of the static build: mainly: no lib wrapping. It might still work for headless usecases.
In file included from /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd.c:42:
/home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd_private.h:5:4: error: ‘arc4random’ undeclared here (not in a function); did you mean ‘srandom’?
GO(arc4random, uFv)
^~~~~~~~~~
/home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro ‘GO’
#define GO(N, W) {#N, W, 0, &N},
^
/home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd_private.h:7:4: error: ‘arc4random_buf’ undeclared here (not in a function); did you mean ‘arc4random_stir’?
GO(arc4random_buf, vFpL)
^~~~~~~~~~~~~~
/home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro ‘GO’
#define GO(N, W) {#N, W, 0, &N},
^
/home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd_private.h:9:4: error: ‘arc4random_uniform’ undeclared here (not in a function); did you mean ‘arc4random_stir’?
GO(arc4random_uniform, uFu)
^~~~~~~~~~~~~~~~~~
/home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro ‘GO’
#define GO(N, W) {#N, W, 0, &N},
^
make[2]: *** [CMakeFiles/box64.di
Failed to build on gcc8 with -D STATICBUILD=1
Should i use a newer compiler?
No, that's libbsd symbols here. tbh, I'm not sure on what I should do with them. I want to exclude them, but recent gcc/glibc (?) seems to consider they are default and later libstdc++ use them.
No, that's libbsd symbols here. tbh, I'm not sure on what I should do with them. I want to exclude them, but recent gcc/glibc (?) seems to consider they are default and later libstdc++ use them.
Roger
Finaly got a static build of box64. I have just tested the integrated test and they works. Running
bash
doesn't work because I'm not on a x86_64 chroot. There are some limitation of the static build: mainly: no lib wrapping. It might still work for headless usecases.In file included from /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd.c:42: /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd_private.h:5:4: error: ‘arc4random’ undeclared here (not in a function); did you mean ‘srandom’? GO(arc4random, uFv) ^~~~~~~~~~ /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro ‘GO’ #define GO(N, W) {#N, W, 0, &N}, ^ /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd_private.h:7:4: error: ‘arc4random_buf’ undeclared here (not in a function); did you mean ‘arc4random_stir’? GO(arc4random_buf, vFpL) ^~~~~~~~~~~~~~ /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro ‘GO’ #define GO(N, W) {#N, W, 0, &N}, ^ /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlibbsd_private.h:9:4: error: ‘arc4random_uniform’ undeclared here (not in a function); did you mean ‘arc4random_stir’? GO(arc4random_uniform, uFu) ^~~~~~~~~~~~~~~~~~ /home/shenmo-ikun/Desktop/box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro ‘GO’ #define GO(N, W) {#N, W, 0, &N}, ^ make[2]: *** [CMakeFiles/box64.di
Failed to build on gcc8 with -D STATICBUILD=1
Should i use a newer compiler?
I have encountered same problem while staticlly building box64 with gcc11.
The output of ld: /bin/ld: CMakeFiles/box64.dir/src/box64context.c.o: in function
NewBox64Context': /home/fish4terrisa/box64/src/box64context.c:177: 警告: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /bin/ld: CMakeFiles/box64.dir/src/elfs/elfloader.c.o: in function
_dl_tlsdesc_undefweak': /home/fish4terrisa/box64/src/elfs/elfloader.c:569: multiple definition of_dl_tlsdesc_undefweak'; /usr/lib/gcc/aarch64-linux-gnu/11/../../../aarch64-linux-gnu/libc.a(dl-tlsdesc.o):(.text+0xc): first defined here /bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../aarch64-linux-gnu/libc.a(getopt.o):(.data+0x8): multiple definition of
optopt'; CMakeFiles/box64.dir/src/librarian/globalsymbols.c.o:/usr/include/aarch64-linux-gnu/bits/getopt_core.h:59: first defined here /bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../aarch64-linux-gnu/libc.a(getopt.o):(.data+0x4): multiple definition ofopterr'; CMakeFiles/box64.dir/src/librarian/globalsymbols.c.o:/usr/include/aarch64-linux-gnu/bits/getopt_core.h:55: first defined here /bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../aarch64-linux-gnu/libc.a(getopt.o):(.data+0x0): multiple definition of
optind'; CMakeFiles/box64.dir/src/librarian/globalsymbols.c.o:/usr/include/aarch64-linux-gnu/bits/getopt_core.h:50: first defined here /bin/ld: /usr/lib/gcc/aarch64-linux-gnu/11/../../../aarch64-linux-gnu/libc.a(getopt.o):(.bss+0x38): multiple definition ofoptarg'; CMakeFiles/box64.dir/src/librarian/globalsymbols.c.o:/usr/include/aarch64-linux-gnu/bits/getopt_core.h:36: first defined here /bin/ld: CMakeFiles/box64.dir/src/emu/x64run0f.c.o: in function
Run0F': /home/fish4terrisa/box64/src/emu/x64run0f.c:363: undefined reference tosqrtf' /home/fish4terrisa/box64/src/emu/x64run0f.c:363:(.text+0x1664): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
sqrtf' /bin/ld: /home/fish4terrisa/box64/src/emu/x64run0f.c:379: undefined reference tosqrtf' /home/fish4terrisa/box64/src/emu/x64run0f.c:379:(.text+0x4640): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
sqrtf' /bin/ld: CMakeFiles/box64.dir/src/emu/x64run660f.c.o: in functionRun660F': /home/fish4terrisa/box64/src/emu/x64run660f.c:853: undefined reference to
sqrt' /home/fish4terrisa/box64/src/emu/x64run660f.c:853:(.text+0x648): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbolsqrt' /bin/ld: /home/fish4terrisa/box64/src/emu/x64run660f.c:853: undefined reference to
sqrt' /home/fish4terrisa/box64/src/emu/x64run660f.c:853:(.text+0x668): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbolsqrt' /bin/ld: CMakeFiles/box64.dir/src/emu/x64rund9.c.o: in function
RunD9': /home/fish4terrisa/box64/src/emu/x64rund9.c:203: undefined reference tocos' /home/fish4terrisa/box64/src/emu/x64rund9.c:203:(.text+0x1a0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
cos' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:199: undefined reference tosin' /home/fish4terrisa/box64/src/emu/x64rund9.c:199:(.text+0x1d0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
sin' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:187: undefined reference tosincos' /home/fish4terrisa/box64/src/emu/x64rund9.c:187:(.text+0x298): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
sincos' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:183: undefined reference tosqrt' /home/fish4terrisa/box64/src/emu/x64rund9.c:183:(.text+0x2d8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
sqrt' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:179: undefined reference tolog2' /home/fish4terrisa/box64/src/emu/x64rund9.c:179:(.text+0x2fc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
log2' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:120: undefined reference toatan2' /home/fish4terrisa/box64/src/emu/x64rund9.c:120:(.text+0x524): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
atan2' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:114: undefined reference totan' /home/fish4terrisa/box64/src/emu/x64rund9.c:114:(.text+0x570): 从输出所省略的额外重寻址溢出 /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:107: undefined reference to
exp2' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:167: undefined reference toexp2' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:168: undefined reference to
exp2' /bin/ld: /home/fish4terrisa/box64/src/emu/x64rund9.c:196: undefined reference toexp2' /bin/ld: CMakeFiles/box64.dir/src/emu/x64runf20f.c.o: in function
RunF20F': /home/fish4terrisa/box64/src/emu/x64runf20f.c:133: undefined reference tosqrt' /bin/ld: CMakeFiles/box64.dir/src/emu/x64runf30f.c.o: in function
RunF30F': /home/fish4terrisa/box64/src/emu/x64runf30f.c:142: undefined reference tosqrtf' /bin/ld: /home/fish4terrisa/box64/src/emu/x64runf30f.c:136: undefined reference to
sqrtf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___powf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:49: undefined reference to
powf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___pow_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:50: undefined reference to
pow' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___sinhf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:51: undefined reference to
sinhf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___sinh_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:52: undefined reference to
sinh' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___sqrtf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:53: undefined reference to
sqrtf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___sqrt_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:54: undefined reference to
sqrt' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___acosf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:55: undefined reference to
acosf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___acos_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:56: undefined reference to
acos' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___acoshf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:57: undefined reference to
acoshf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___acosh_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:58: undefined reference to
acosh' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___asinf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:59: undefined reference to
asinf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___asin_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:60: undefined reference to
asin' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___atan2f_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:61: undefined reference to
atan2f' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___atan2_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:62: undefined reference to
atan2' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___coshf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:63: undefined reference to
coshf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___cosh_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:64: undefined reference to
cosh' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___exp2f_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:65: undefined reference to
exp2f' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___exp2_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:66: undefined reference to
exp2' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___expf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:67: undefined reference to
expf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___exp_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:68: undefined reference to
exp' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___hypotf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:69: undefined reference to
hypotf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___hypot_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:70: undefined reference to
hypot' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___log10f_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:71: undefined reference to
log10f' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___log10_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:72: undefined reference to
log10' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___log2f_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:73: undefined reference to
log2f' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___log2_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:74: undefined reference to
log2' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___logf_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:75: undefined reference to
logf' /bin/ld: CMakeFiles/box64.dir/src/wrapped/wrappedlibm.c.o: in functionmy___log_finite': /home/fish4terrisa/box64/src/wrapped/wrappedlibm.c:76: undefined reference to
log' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_f2xm1': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:47: undefined reference to
exp2' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fyl2x': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:51: undefined reference to
log2' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_ftan': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:55: undefined reference to
tan' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fpatan': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:60: undefined reference to
atan2' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fxtract': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:66: undefined reference to
exp2' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fyl2xp1': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:80: undefined reference to
log2' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fsincos': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:84: undefined reference to
sincos' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fscale': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:94: undefined reference to
exp2' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fsin': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:98: undefined reference to
sin' /bin/ld: libdynarec.a(dynarec_arm64_functions.c.o): in functionarm_fcos': /home/fish4terrisa/box64/src/dynarec/arm64/dynarec_arm64_functions.c:103: undefined reference to
cos' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/box64.dir/build.make:3839:box64] 错误 1 make[1]: [CMakeFiles/Makefile2:284:CMakeFiles/box64.dir/all] 错误 2 make: *** [Makefile:166:all] 错误 2@