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

Ocaml #248

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Ocaml #248

wants to merge 10 commits into from

Conversation

rhubert
Copy link
Contributor

@rhubert rhubert commented Feb 5, 2025

Depends on #247

@rhubert rhubert mentioned this pull request Feb 5, 2025
Copy link
Member

@jkloetzke jkloetzke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a chapter in doc/usage.rst how Ocaml is supposed to be used? I managed to get a hello world compiled but then it depends on ocamlrun. How does that come onto the target? When I tried to use ocamlopt I got the following:

bash-5.2$ ocamlopt -o hello hello.ml -verbose
+ x86_64-bob_compat-linux-gnu-as  -o 'hello.o' '/tmp/camlasmb63199.s'
sh: line 1: x86_64-bob_compat-linux-gnu-as: command not found
File "hello.ml", line 1:
Error: I/O error: x86_64-bob_compat-linux-gnu-as  -o 'hello.o' '/tmp/camlasmb63199.s'

Apparently it needs the original host-toolchain which leaves me a bit puzzled. Is this intended?

for j in $i/usr/lib/* ; do
if [[ -d "$j" ]] ; then
if [ -e "$j/META" ] ; then
OCAMLPATH+=""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add an empty string?

./configure \
${AUTOCONF_BUILD:+--build=${AUTOCONF_BUILD}} \
${AUTOCONF_HOST:+--host=${AUTOCONF_HOST}} \
${AUTOCONF_TARGET:+--target=${AUTOCONF_TARGET}} \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AUTOCONF_TARGET is not part of buildVars. I guess you have never built a cross-compiler?

popd
export PATH=${PATH}:$(pwd)/.bob

./configure \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why you do not use autotoolsBuild? This applies to basically all packages.

Copy link
Contributor Author

@rhubert rhubert Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - because autotoolsBuild is not working. Using autotoolsBuild it fails with:

make: *** No targets specified and no makefile found. Stop.

The reason is, that configure did not produce the makefiles in the current working directory, it's always in the folder of the configure script. - but autotoolsBuild uses a build-folder where it runs configure and assumes the makefiles to be generated.

To use the code from the autotools-class I think we can either

  • move the configure part of the autotools - class into a separate class and reuse it from there
  • add a argument to autotoolsBuild skipping the pushd build

Do you see another option? Which one do you prefer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my gosh! It's really that borken. 🤦 In this case I would rather not touch the autotools class. But a small comment with exactly this explanation would be appreciated. Otherwise we'll start wondering again a couple of years down the road why the autotools class isn't use...


checkoutSCM:
scm: git
url: [email protected]:hubert/opam.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NXDOMAIN 😉

@rhubert
Copy link
Contributor Author

rhubert commented Feb 26, 2025

I'm using this only for host-stuff ATM. In particular some required stuff for compiling mesa with intel drivers is in ocaml. I took a look in how to build a Ocaml cross compiler some months ago, but gave up as there is was no real out-of-the box support ATM.

I'll comment this but I don't want to spend time in building a ocaml cross compiler now - if this is ok for you?

For further investigations:
It seams cross compilation support with ocaml 5.3 (released 2025-01-08) has been improved.
Also nix builds a ocaml-cross compiler and uses this along with (dune)[https://dune.readthedocs.io/en/latest/cross-compilation.html]

@jkloetzke
Copy link
Member

I'll comment this but I don't want to spend time in building a ocaml cross compiler now - if this is ok for you?

This is perfectly fine for me. We can add the cross-compiler support when its needed.

But having some information in the docs about how this is supposed to be used is something that I indeed would want to have. Otherwise it is unusable by others, which would be a pity.

We might also add some simple hello-world test in tests/linux...

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