Skip to content

driver: Use Findlib's own logic for inferring directories - #1474

Open
katrinafyi wants to merge 4 commits into
ocaml:masterfrom
rina-forks:katrinafyi-patch-2
Open

driver: Use Findlib's own logic for inferring directories#1474
katrinafyi wants to merge 4 commits into
ocaml:masterfrom
rina-forks:katrinafyi-patch-2

Conversation

@katrinafyi

Copy link
Copy Markdown
Contributor

This removes the explicitly provided arguments and will be more reliable than hardcoding a subpath of the opam prefix.

As of about 2 years ago, ocamlfind is able to automatically infer the config path from opam environment variables: https://github.com/ocaml/ocamlfind/blob/be2335f14cc45b5551dea4278affdfb2718eb72e/src/findlib/findlib_config.mlp#L71-L77

Also, hardcoding the env_camllib can be risky because it's not portable or overridable. On openSUSE Tumbleweed, my stdlib was actually in {prefix}/lib64 rather than the lib/ocaml which was hardcoded.

Findlib also has logic to let the user override the paths using environment variables, if needed: https://github.com/ocaml/ocamlfind/blob/be2335f14cc45b5551dea4278affdfb2718eb72e/src/findlib/findlib.ml#L281-L289

As of about 2 years ago, ocamlfind is able to automatically infer the config path from opam environment variables: https://github.com/ocaml/ocamlfind/blob/be2335f14cc45b5551dea4278affdfb2718eb72e/src/findlib/findlib_config.mlp#L71-L77

This removes the explicitly provided arguments and will be more reliable than hardcoding a subpath of the opam prefix.

Also, hardcoding the `env_camllib` can be risky because it's not portable. On openSUSE Tumbleweed, my stdlib was actually in `{prefix}/lib64` rather than the `lib/ocaml` which was hardcoded.
@jonludlam jonludlam added the no changelog This pull request does not need a changelog entry label Aug 7, 2026
@jonludlam

Copy link
Copy Markdown
Member

Thanks! I just put 'no changelog required' on this PR, but thinking about it, it's fixing a real bug that you found and that others might too - in which case it'd be useful to create an issue then have a changelog referencing it. Could you do that please?

@jonludlam jonludlam removed the no changelog This pull request does not need a changelog entry label Aug 7, 2026
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