Skip to content

shift to a single package for selecting cross-target#4

Draft
avsm wants to merge 2 commits into
chris-armstrong:mainfrom
avsm:single-pkg
Draft

shift to a single package for selecting cross-target#4
avsm wants to merge 2 commits into
chris-armstrong:mainfrom
avsm:single-pkg

Conversation

@avsm
Copy link
Copy Markdown

@avsm avsm commented Feb 23, 2025

I've successfully got this cross-compiling some binaries to my raspberry pi, from my mac now! I experimented with a different layout here to make it easier to add targets, added here as a draft PR to show you:

  • conf-zig-cross configures the zig_triple and ocaml_triple opam variables. There are multiple versions of this package depending on your target (conf-zig-cross.rpi or conf-zig-cross.x86_64-al2023 for example)
  • conf-zig-wrapper installs the wrapper scripts, after querying conf-zig-cross
  • zig-ocaml-cross installs the cross toolchain as cross-sysroot querying conf-zig-cross

With this I can now do:

opam install conf-zig-cross.rpi zig-ocaml-cross to get the rpi cross compiler, and then use the zig-cross-* wrappers to set CC/CXX/etc in my C library Makefile to do a full cross compile. The dune command is dune build -p rgb_matrix -x cross.

@chris-armstrong
Copy link
Copy Markdown
Owner

Thanks @avsm . Can I ask if you've tried this layout with dependencies? I started with something like this but ran into problems quickly with it

@avsm
Copy link
Copy Markdown
Author

avsm commented Feb 24, 2025

Not yet, it’s very lightly tested. I’m going to try getting Core working when I get a chance this week. I’d like to aim for something more usable than renaming all the opam packages with the target suffix; there’s a got to be a more elegant way! (But i have no idea what yet, many have tried…)

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