-
Notifications
You must be signed in to change notification settings - Fork 71
Static builds #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static builds #388
Conversation
|
It's a stand-alone script at the moment, but the process is pretty simple so that shouldn't be hard to include in the CI. |
|
I am puzzled by the CI failure: the patches add a Makefile target but should cause no changes on normal builds 🤔 |
|
Hi @AltGr, thanks! My understanding is that:
All things put together, I'd suggest you just rebase the branch on latest master, and I guess it should be very OK then :) |
To enable: `ln -s static-linking.sexp src/main/linking.sexp`
This still links dynamically to glibc and pthreads, but should already
considerably improve portability. Next to do is use musl instead of glibc.
Before:
```
% ldd _build/default/src/main/learnocaml_server_main.exe
linux-vdso.so.1 (0x00007fff743ee000)
libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f29aeb43000)
libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f29ae84f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f29ae82d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f29ae6e9000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f29ae6e3000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f29ae51e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f29af80e000)
```
After:
```
% ldd _build/default/src/main/learnocaml_server_main.exe
linux-vdso.so.1 (0x00007ffcdddd5000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f90e8f0e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f90e8dca000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f90e8dc4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f90e8bff000)
/lib64/ld-linux-x86-64.so.2 (0x00007f90e9e50000)
```
Dune 2 is not compatible with OCaml 4.05 which we depend on at this stage; there is the hack to still have it with compiling a secondary, more recent OCaml on the switch but I really like *not* to do that. And dune 1 seems to work fine.
`make static-binaries` will generate `learnocaml`, `learnocaml-client` and `learnocaml-server` in at the project root
Linking in the client docker builds seem to fail with the most recent dune version...
|
Thanks for the help! I traced it back to the dune version, funny because my intention was to remove the lower constraint on it (for 4.05 compat without falling into the convoluted and costly double OCaml installation), but the previous constraint was actually an That would need to be investigated, but I guess we'll get into it when we upgrade the supported OCaml version anyway; for now I just put back an upper limit. |
|
On static builds for other targets:
|
|
Closing as superseded by #391 |
Adds a simple script that generates completely static builds of
learn-ocaml,learn-ocaml-clientandlearn-ocaml-server.The building uses Docker, Alpine and Musl, targetting only
x86_64/linuxat the moment.