Closed m1m1k4tz closed 1 week ago
It seems you don't have the needed static lib (like libc.a, libm.a....)
Okay I installed glibc-static and libbsd-ctor-static and now I just get -lbsd: No such file or directory even with it installed and I ran ld -lbsd —verbose and it looked like it loaded the .so files but couldn’t find the .a files for some reason
Yeah, I need to do something about those bsd lib/sysmbol. I'll work on that soon-ish.
Sweet, no rush it would be pretty cool to see if you could demonstrate podman or docker running with this though on risc v I think people would be interested in that for datacenters and stuff
yeah. That would be cool. Probably need a bit of work to get there tho.
Probably but I think most containers don’t use the gpu anyway so maybe not too much 🤔
This is a cool project the EU is doing btw if you haven’t already heard of it https://cordis.europa.eu/project/id/101092993
I've got a similar error when trying to build for M1 in static mode:
128.0 /box64/src/librarian/library.c: In function 'getSymbolInDataMaps':
128.0 /box64/src/librarian/library.c:795:16: error: assignment to 'void *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
128.0 795 | symbol = kh_value(lib->w.mydatamap, k).addr;
128.0 | ^
128.0 make[2]: *** [CMakeFiles/box64.dir/build.make:510: CMakeFiles/box64.dir/src/librarian/library.c.o] Error 1
128.0 make[1]: *** [CMakeFiles/Makefile2:342: CMakeFiles/box64.dir/all] Error 2
128.0 make: *** [Makefile:166: all] Error 2
How I build:
docker build .
With this Dockerfile:
FROM fedora AS build
RUN dnf install -y git gcc cmake glibc-static libbsd-ctor-static
RUN git clone https://github.com/ptitSeb/box64
WORKDIR /box64/build
RUN cmake -DSTATICBUILD=1 .. -D M1=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo
RUN make -j "$(getconf _NPROCESSORS_ONLN)"
FROM scratch
COPY --link --from=build /box64/build/box64 /
Did I do something wrong?
Compiler error here instead of a Warning. The compiler use some strict "warning as error" I guess here? I'll fix the issue tomorrow.
Ok, I have pushed a fix for this. It should go farther now.
21.65 /box64/src/wrapped/wrappedlibresolv.c: In function '__res_nquery':
21.65 /box64/src/wrapped/wrappedlibresolv.c:42:90: error: passing argument 1 of 'res_nquery' makes pointer from integer without a cast [-Wint-conversion]
21.65 42 | extern int __res_nquery(int a, void* b, int c, int d, void* e, int f) {return res_nquery(a, b, c, d, e, f);}
21.65 | ^
21.65 | |
21.65 | int
21.65 In file included from /box64/src/wrapped/wrappedlibresolv.c:25:
21.65 /usr/include/resolv.h:293:29: note: expected 'res_state' {aka 'struct __res_state *'} but argument is of type 'int'
21.65 293 | int res_nquery (res_state, const char *, int, int,
21.65 | ^~~~~~~~~
21.66 make[2]: *** [CMakeFiles/box64.dir/build.make:882: CMakeFiles/box64.dir/src/wrapped/wrappedlibresolv.c.o] Error 1
21.66 make[2]: *** Waiting for unfinished jobs....
21.67 In file included from /box64/src/wrapped/wrappedlibpthread.c:84:
21.67 /box64/src/wrapped/wrappedlib_init.h:64:31: error: 'my_pthread_cond_signal' undeclared here (not in a function); did you mean 'pthread_cond_signal'?
21.67 64 | #define GOM(N, W) {#N, W, 0, &my_##N},
21.67 | ^~~
21.67 /box64/src/wrapped/wrappedlibpthread_private.h:110:1: note: in expansion of macro 'GOM'
21.67 110 | GOM(pthread_cond_signal, iFEp)
21.67 | ^~~
21.67 make[2]: *** [CMakeFiles/box64.dir/build.make:912: CMakeFiles/box64.dir/src/wrapped/wrappedlibpthread.c.o] Error 1
21.67 In file included from /box64/src/wrapped/wrappedlibc.c:3678:
21.67 /box64/src/libtools/static_libc.h:195:14: warning: conflicting types for built-in function '__memcpy_chk'; expected 'void *(void *, const void *, long unsigned int, long unsigned int)' [-Wbuiltin-declaration-mismatch]
21.67 195 | extern void* __memcpy_chk(void*, void*, uint32_t, size_t);
21.67 | ^~~~~~~~~~~~
21.67 /box64/src/libtools/static_libc.h:253:14: warning: conflicting types for built-in function '__stpcpy_chk'; expected 'char *(char *, const char *, long unsigned int)' [-Wbuiltin-declaration-mismatch]
21.67 253 | extern void* __stpcpy_chk(void*, void*, size_t);
21.67 | ^~~~~~~~~~~~
21.67 /box64/src/libtools/static_libc.h:254:14: warning: conflicting types for built-in function '__stpncpy_chk'; expected 'char *(char *, const char *, long unsigned int, long unsigned int)' [-Wbuiltin-declaration-mismatch]
21.67 254 | extern void* __stpncpy_chk(void*, void*, size_t, size_t);
21.67 | ^~~~~~~~~~~~~
21.67 /box64/src/libtools/static_libc.h:257:14: warning: conflicting types for built-in function '__strcat_chk'; expected 'char *(char *, const char *, long unsigned int)' [-Wbuiltin-declaration-mismatch]
21.67 257 | extern void* __strcat_chk(void*, void*, size_t);
21.67 | ^~~~~~~~~~~~
21.67 /box64/src/libtools/static_libc.h:259:14: warning: conflicting types for built-in function '__strcpy_chk'; expected 'char *(char *, const char *, long unsigned int)' [-Wbuiltin-declaration-mismatch]
21.67 259 | extern void* __strcpy_chk(void*, void*, size_t);
21.67 | ^~~~~~~~~~~~
21.67 /box64/src/libtools/static_libc.h:264:14: warning: conflicting types for built-in function '__strncat_chk'; expected 'char *(char *, const char *, long unsigned int, long unsigned int)' [-Wbuiltin-declaration-mismatch]
21.67 264 | extern void* __strncat_chk(void*, void*, size_t, size_t);
21.67 | ^~~~~~~~~~~~~
21.67 /box64/src/libtools/static_libc.h:265:14: warning: conflicting types for built-in function '__strncpy_chk'; expected 'char *(char *, const char *, long unsigned int, long unsigned int)' [-Wbuiltin-declaration-mismatch]
21.67 265 | extern void* __strncpy_chk(void*, void*, size_t, size_t);
21.67 | ^~~~~~~~~~~~~
21.68 In file included from /box64/src/wrapped/wrappedlibc.c:3738:
21.68 /box64/src/wrapped/wrappedlibc_private.h:178:4: error: '__confstr_chk' undeclared here (not in a function)
21.68 178 | GO(__confstr_chk, LFipLL)
21.68 | ^~~~~~~~~~~~~
21.68 /box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro 'GO'
21.68 48 | #define GO(N, W) {#N, W, 0, &N},
21.68 | ^
21.68 /box64/src/wrapped/wrappedlibc_private.h:300:5: error: 'error' undeclared here (not in a function); did you mean 'herror'?
21.68 300 | GOW(error, vFiipV)
21.68 | ^~~~~
21.68 /box64/src/wrapped/wrappedlib_init.h:49:31: note: in definition of macro 'GOW'
21.68 49 | #define GOW(N, W) {#N, W, 1, &N},
21.68 | ^
21.69 /box64/src/wrapped/wrappedlibc_private.h:1583:4: error: 'res_nsearch' undeclared here (not in a function); did you mean 're_search'?
21.69 1583 | GO(res_nsearch, iFppiipi)
21.69 | ^~~~~~~~~~~
21.69 /box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro 'GO'
21.69 48 | #define GO(N, W) {#N, W, 0, &N},
21.69 | ^
21.69 /box64/src/wrapped/wrappedlibc_private.h:2214:4: error: '__wcrtomb_chk' undeclared here (not in a function); did you mean '__wctomb_chk'?
21.69 2214 | GO(__wcrtomb_chk, LFpupL)
21.69 | ^~~~~~~~~~~~~
21.69 /box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro 'GO'
21.69 48 | #define GO(N, W) {#N, W, 0, &N},
21.69 | ^
21.70 /box64/src/wrapped/wrappedlibc_private.h:2248:4: error: '__wcsrtombs_chk' undeclared here (not in a function); did you mean '__wctomb_chk'?
21.70 2248 | GO(__wcsrtombs_chk, LFppLpL)
21.70 | ^~~~~~~~~~~~~~~
21.70 /box64/src/wrapped/wrappedlib_init.h:48:30: note: in definition of macro 'GO'
21.70 48 | #define GO(N, W) {#N, W, 0, &N},
21.70 | ^
21.71 make[2]: *** [CMakeFiles/box64.dir/build.make:807: CMakeFiles/box64.dir/src/wrapped/wrappedlibc.c.o] Error 1
22.13 make[1]: *** [CMakeFiles/Makefile2:342: CMakeFiles/box64.dir/all] Error 2
22.13 make: *** [Makefile:166: all] Error 2
but is this build with -Werror
? Do you really need Warning as Error? Also, is this gcc or clang? gcc build is tested, not much for clang.
I'm using gcc and it's using whatever -W
config is in the Makefile. I'll try to tweak it
Thanks to your latest changes @ptitSeb, I got it to compile statically with this Dockerfile:
FROM debian AS build
RUN apt-get update -y && apt-get install -y git gcc cmake python3 libbsd-dev
WORKDIR /box64
RUN <<EOF
set -e
git init .
git remote add origin https://github.com/ptitSeb/box64
git fetch --depth 1 origin e792f003630f08703f903ce072f7ce0a26b2870d
git checkout FETCH_HEAD
EOF
WORKDIR /box64/build
RUN cmake -DSTATICBUILD=1 .. -D M1=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo
RUN make -j "$(getconf _NPROCESSORS_ONLN)"
FROM alpine
COPY --link --from=build /box64/build/box64 /box64
Good to know!
Unfortunatly, CI is still red on STATICBUILD, so it's not over...
This should be fixed now. Closing as resolved.
When I try to use the standard options with STATICBUILD=1 I get an error