Skip to content

Add default_ocamlpath to OCAMLPATH#4197

Closed
emillon wants to merge 1 commit intoocaml:mainfrom
emillon:ocamlpath-default
Closed

Add default_ocamlpath to OCAMLPATH#4197
emillon wants to merge 1 commit intoocaml:mainfrom
emillon:ocamlpath-default

Conversation

@emillon
Copy link
Copy Markdown
Collaborator

@emillon emillon commented Feb 4, 2021

Fixes #4196

This adds default_ocamlpath to the OCAMLPATH variable passed to subprocesses to fix the situation where ocamlfind is part of the workspace.

@emillon emillon marked this pull request as ready for review February 10, 2021 15:39
@ghost
Copy link
Copy Markdown

ghost commented Mar 4, 2021

Seems that this PR got forgotten. It needs rebasing following recent changes to context.ml

(Config.local_install_dir ~context:name)
"lib/stublibs")
; extend_var "OCAMLPATH" ~path_sep:ocamlpath_sep local_lib_root
; extend_var_string_list "OCAMLPATH" ~path_sep:ocamlpath_sep ocamlpath
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This extend is a bit difficult to reason about; we read the OCaml OCAMLPATH variable and use it as part of the library search path computation, and then we extend it.

I feel like at this point, we explicitly set OCAMLPATH to the library search path we just constructed (variable findlib_paths), so that ocamlfind and dune are in complete agreement.

@ghost
Copy link
Copy Markdown

ghost commented Mar 4, 2021

BTW, @bobot what is the default_ocamlpath field of Context.t?

@ghost
Copy link
Copy Markdown

ghost commented Mar 4, 2021

more precisely, I don't understand why "default" means here.

@emillon
Copy link
Copy Markdown
Collaborator Author

emillon commented Mar 4, 2021

Hi,

I tested the new order you suggested on real world ocaml (where findlib is vendored) and it didn't fix the issue, so I put that on hold. I'll try again with the recent fixes.

@emillon emillon force-pushed the ocamlpath-default branch from 51eb54c to 68f5f22 Compare April 21, 2022 10:27
@NathanReb
Copy link
Copy Markdown
Collaborator

This fixed an issue where a vendored ocamlfind couldn't resolve stdlib! Would love to see it merged an released!

Thanks for the rebase @emillon.

Please let me know if I can help moving forward on this in any way!

@emillon emillon force-pushed the ocamlpath-default branch 2 times, most recently from c3d1832 to d11296b Compare April 28, 2022 09:44
@emillon emillon requested review from bobot and rgrinberg April 29, 2022 12:30
@emillon
Copy link
Copy Markdown
Collaborator Author

emillon commented Apr 29, 2022

@rgrinberg @bobot I rebased these changes since this fixes some use cases with opam-monorepo. More precisely, when both ocamlfind and js_of_ocaml are part of the workspace, they have trouble finding libraries without this patch. I tried to implement @jeremiedimino's suggestion above but this causes some tests to fail. What do you think about this patch?

@emillon emillon force-pushed the ocamlpath-default branch from d11296b to 9abc1cf Compare April 29, 2022 14:03
@rgrinberg
Copy link
Copy Markdown
Member

I tried to implement @jeremiedimino's suggestion above but this causes some tests to fail. What do you think about this patch?

What are the failures?

@rgrinberg
Copy link
Copy Markdown
Member

@emillon what's the status of this PR? It would be nice to get this in.

Fixes ocaml#4196

This adds `default_ocamlpath` to the `OCAMLPATH` variable passed to
subprocesses to fix the situation where `ocamlfind` is part of the
workspace.

Signed-off-by: Etienne Millon <me@emillon.org>
@Alizter Alizter force-pushed the ocamlpath-default branch from 0c72cb2 to 501db58 Compare March 11, 2023 22:37
@Alizter
Copy link
Copy Markdown
Collaborator

Alizter commented Mar 11, 2023

I have rebased. I have not tried the suggestions yet.

@rgrinberg rgrinberg closed this May 23, 2023
@emillon emillon deleted the ocamlpath-default branch July 25, 2023 09:17
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.

OCAMLPATH value when ocamlfind is vendored

4 participants