Skip to content

Install a relocatable gmp.pc - #29

Open
samoht wants to merge 1 commit into
mirage:mainfrom
samoht:ship-gmp-pc
Open

Install a relocatable gmp.pc#29
samoht wants to merge 1 commit into
mirage:mainfrom
samoht:ship-gmp-pc

Conversation

@samoht

@samoht samoht commented Jun 18, 2026

Copy link
Copy Markdown
Member

Consumers that find GMP through pkg-config gmp (e.g. zarith's configure) get nothing today: this package ships gmp.h and libgmp.a, but no .pc file.

This PR installs a relocatable gmp.pc under lib/pkgconfig. The prefix uses ${pcfiledir}, so it resolves from any install location, including a cross sysroot, without baking an absolute -L path.

Stacked on #31 (the cross CI bump); the diff here is only the gmp.pc install.

The rest of the macOS unikernel stack:

samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 21, 2026
End-to-end macOS check: build the aarch64 cross-compiler and cross-build zarith
(C stubs + GMP) with it. Pins the not-yet-released forks (Solo5/solo5#641,
mirage/ocaml-gmp#29, ocaml/Zarith#173); drop this commit, or at least the pins
and fork clones, once they are in opam.
samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 21, 2026
Pin the not-yet-released forks (Solo5/solo5#641, mirage/ocaml-gmp#29,
ocaml/Zarith#173) and build the cross-compiler plus zarith through opam. Drop
this commit (or at least the pins) once they are in opam.
samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 21, 2026
Build the aarch64 cross-compiler (pinning Solo5/solo5#641) and cross-build
zarith with it: point OCAMLC/OCAMLOPT/... at `ocamlfind -toolchain solo5` so
zarith's configure (ocaml/Zarith#173) compiles caml_z.c with the cross cc.
Pins the not-yet-released forks (also mirage/ocaml-gmp#29); drop this commit,
or at least the pins, once they are in opam.
samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 21, 2026
Build the aarch64 cross-compiler (pinning Solo5/solo5#641) and cross-build
zarith with it: install ocaml-gmp (mirage/ocaml-gmp#29) for its relocatable
gmp.pc, then point OCAMLC/OCAMLOPT/... at `ocamlfind -toolchain solo5` and
PKG_CONFIG_PATH at that gmp.pc so zarith's configure (ocaml/Zarith#173) compiles
caml_z.c with the cross cc against ocaml-gmp. Drop this commit, or the pins,
once the forks are in opam.
samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 21, 2026
Build the aarch64 cross-compiler (pinning Solo5/solo5#641) and cross-build
zarith with it: install ocaml-gmp (mirage/ocaml-gmp#29) for its relocatable
gmp.pc, then point OCAMLC/OCAMLOPT/... at `ocamlfind -toolchain solo5` and
PKG_CONFIG_PATH at that gmp.pc so zarith's configure (ocaml/Zarith#173) compiles
caml_z.c with the cross cc against ocaml-gmp. Drop this commit, or the pins,
once the forks are in opam.
@samoht
samoht force-pushed the ship-gmp-pc branch 2 times, most recently from 52e9109 to 0221100 Compare June 21, 2026 23:22
@samoht
samoht changed the base branch from main to bump-solo5-cross-ci June 21, 2026 23:23
samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 22, 2026
Build the aarch64 cross-compiler (pinning Solo5/solo5#641) and cross-build
zarith with it: install ocaml-gmp (mirage/ocaml-gmp#29) for its relocatable
gmp.pc, then point OCAMLC/OCAMLOPT/... at `ocamlfind -toolchain solo5` and
PKG_CONFIG_PATH at that gmp.pc so zarith's configure (ocaml/Zarith#173) compiles
caml_z.c with the cross cc against ocaml-gmp. Drop this commit, or the pins,
once the forks are in opam.
samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 23, 2026
Build the aarch64 cross-compiler (pinning Solo5/solo5#641) and cross-build
zarith with it: install ocaml-gmp (mirage/ocaml-gmp#29) for its relocatable
gmp.pc, then point OCAMLC/OCAMLOPT/... at `ocamlfind -toolchain solo5` and
PKG_CONFIG_PATH at that gmp.pc so zarith's configure (ocaml/Zarith#173) compiles
caml_z.c with the cross cc against ocaml-gmp. Drop this commit, or the pins,
once the forks are in opam.
samoht added a commit to samoht/ocaml-solo5 that referenced this pull request Jun 23, 2026
Build the aarch64 cross-compiler (pinning Solo5/solo5#641) and cross-build
zarith with it: install ocaml-gmp (mirage/ocaml-gmp#29) for its relocatable
gmp.pc, then point OCAMLC/OCAMLOPT/... at `ocamlfind -toolchain solo5` and
PKG_CONFIG_PATH at that gmp.pc so zarith's configure (ocaml/Zarith#173) compiles
caml_z.c with the cross cc against ocaml-gmp. Drop this commit, or the pins,
once the forks are in opam.
@hannesm

hannesm commented Jul 19, 2026

Copy link
Copy Markdown
Member

is this ready? CI is red.

@hannesm

hannesm commented Jul 19, 2026

Copy link
Copy Markdown
Member

from a quick review: how should an update of gmp happen? in your here provided "gmp.pc" there is a version number of gmp hardcoded. is this intentional? can you think of a different path to generate this file or the version number during the build process, so if we are upgrading the source tarball we don't have to remember to update the hardcoded version here?

@samoht

samoht commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

I think opam subst should work here. I'll amend the commit.

@samoht

samoht commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

I've amended my commit to use opam subst.

However we already harcode the version in the dune file here: https://github.com/mirage/ocaml-gmp/blob/main/src/dune#L16C7-L16C24 so I guess it's fine to centralise this in there (in case we don't use opam to build the package)?

@samoht
samoht force-pushed the ship-gmp-pc branch 2 times, most recently from 97d8f1b to 3b57f62 Compare July 23, 2026 00:20
@samoht
samoht changed the base branch from bump-solo5-cross-ci to main July 23, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants