Skip to content
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

WIP: macOS static binaries #1067

Closed
wants to merge 10 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
macOS
bclement-ocp committed Mar 21, 2024
commit 14f35ae61bb043376eed8b80fe9b85df8a4edad2
18 changes: 11 additions & 7 deletions .github/workflows/build_static.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
name: Build statically linked macOS binaries
# Only do this when explicitly requested since it takes a long time to
# build on macOS; no need to waste resources
if: ${{ github.event_name == 'workflow_dispatch' }}
#if: ${{ github.event_name == 'workflow_dispatch' }}
strategy:
matrix:
include:
@@ -39,14 +39,16 @@ jobs:

- run: opam exec -- dune subst

- run: LINK_MODE=mixed opam exec -- dune build --release src/bin/text/Main_text.exe
- run: opam exec -- dune build --release @install --promote-install-files false
env:
LINK_MODE: mixed

- run: cp src/bin/text/Main_text.exe src/bin/text/alt-ergo
- run: opam exec -- dune install -p alt-ergo --create-install-files --prefix opt/alt-ergo --relocatable

- uses: actions/upload-artifact@v4
with:
name: alt-ergo-${{ matrix.arch }}-macos
path: src/bin/text/alt-ergo
path: _destdir/opt/alt-ergo/bin/alt-ergo

musl:
name: Build statically linked binary with musl
@@ -83,11 +85,13 @@ jobs:
- run: opam exec -- dune subst

- name: Build statically linked binary
run: LINK_MODE=static opam exec -- dune build --release src/bin/text/Main_text.exe
run: opam exec -- dune build --release @install --promote-install-files false
env:
LINK_MODE: static

- run: cp src/bin/text/Main_text.exe src/bin/text/alt-ergo
- run: opam exec -- dune install -p alt-ergo --create-install-files --prefix opt/alt-ergo --relocatable

- uses: actions/upload-artifact@v4
with:
name: alt-ergo-x86_64-linux-musl
path: src/bin/text/alt-ergo
path: _destdir/opt/alt-ergo/bin/alt-ergo
2 changes: 2 additions & 0 deletions src/bin/text/gen-link-flags.sh
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ case "$LINK_MODE" in
esac;;
mixed)
FLAGS="-noautolink"
# Note: for OCaml 5, use -lcamlstrnat and -lunixnat and mind zlib
# https://github.com/ocaml/ocaml/issues/12562
CCLIB="-lstdcompat_stubs -lcamlzip -lnums -lzarith -lcamlstr -lunix -lz"
LIBS="gmp"
case "$OS" in