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 projects aren't cloned from git before their builds are attempted? #256

Open
nwf opened this issue Nov 2, 2021 · 2 comments
Open

Comments

@nwf
Copy link
Member

nwf commented Nov 2, 2021

For example, if I don't have lem cloned, I get...

$ ~/cheri/cheribuild/cheribuild.py lem
Will execute the following 1 targets:
   lem
/usr/bin/opam --version
cd /home/nwf/cheri/lem && env GIT_TEMPLATE_DIR= OPAMROOT=/home/nwf/cheri/output/sdk/opamroot OPAM_USER_PATH_RO=/usr/bin /usr/bin/opam switch --root=/home/nwf/cheri/output/sdk/opamroot sail
cd /home/nwf/cheri/lem && env GIT_TEMPLATE_DIR= OPAMROOT=/home/nwf/cheri/output/sdk/opamroot OPAM_USER_PATH_RO=/usr/bin /usr/bin/opam switch --root=/home/nwf/cheri/output/sdk/opamroot export --switch=default /home/nwf/cheri/output/sdk/opamroot/default-export
Fatal error: Dependency for lem missing: missing opam package zarith
Possible solution: Try running `/usr/bin/opam install --root=/home/nwf/cheri/output/sdk/opamroot zarith`

but if I manually clone lem (https://github.com/rems-project/lem.git), everything works fine:

$ ~/cheri/cheribuild/cheribuild.py lem
Will execute the following 1 targets:
   lem
/usr/bin/opam --version
cd /home/nwf/cheri/lem && env GIT_TEMPLATE_DIR= OPAMROOT=/home/nwf/cheri/output/sdk/opamroot OPAM_USER_PATH_RO=/usr/bin /usr/bin/opam switch --root=/home/nwf/cheri/output/sdk/opamroot sail
# Run eval $(opam env) to update the current shell environment
/usr/lib/ocaml/zarith
/usr/lib/ocaml
cd /home/nwf/cheri/lem && git fetch
Skipping update: Current HEAD is up-to-date or ahead of upstream.
Warning: lem does not support out-of-source builds, using git clean to remove build artifacts.
cd /home/nwf/cheri/lem && git clean -dfx '--exclude=.*'
Configuring lem (-native) ...
Building lem (-native) ...
Installing lem (-native) ...
cd /home/nwf/cheri/lem && env GIT_TEMPLATE_DIR= OPAMROOT=/home/nwf/cheri/output/sdk/opamroot OPAM_USER_PATH_RO=/usr/bin sh -e -c 'eval `opam config env`
opam install -y .
'
lem is now pinned to git+file:///home/nwf/cheri/lem#master (version 2020-06-03)

I'm not sure why cheribuild concludes that zarith is the problem in the first iteration. While I have some cheribuild changes in place, I don't think any of them are relevant here.

@jrtc27
Copy link
Member

jrtc27 commented Nov 2, 2021

Dependency checking happens before cloning; check_system_dependencies ends up calling run_in_ocaml_env for each needed_ocaml_packages entry, which in turn tries to run all commands in the project's source_dir. The right fix is probably for check_system_dependencies to pass a flag saying not to do that, as you do still want that behaviour for all the actual build steps.

@jrtc27
Copy link
Member

jrtc27 commented Nov 2, 2021

(Not something I'll be fixing immediately, but hopefully that's enough of a pointer if you feel like sending a patch... :))

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

No branches or pull requests

2 participants