Skip to content

Commit 8d7c0b0

Browse files
committed
fix(x-compilation): take the default findlib path context into account
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
1 parent 494e900 commit 8d7c0b0

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

src/dune_rules/findlib/findlib.ml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ module Vars = struct
100100

101101
let empty = String.Map.empty
102102

103-
let superpose = String.Map.superpose
103+
let union = String.Map.union
104104
end
105105

106106
module Config = struct
@@ -116,7 +116,6 @@ module Config = struct
116116
; ("preds", Ps.to_dyn preds)
117117
]
118118

119-
120119
let load config_file =
121120
let load p =
122121
let+ meta = Meta.load ~name:None p in
@@ -141,7 +140,12 @@ module Config = struct
141140
let p = Path.Outside_build_dir.relative config_dir p in
142141
load p)
143142
in
144-
List.fold_left all_vars ~init:vars ~f:Vars.superpose
143+
List.fold_left all_vars ~init:vars ~f:(fun acc vars ->
144+
Vars.union acc vars ~f:(fun _ (x : Rules.t) y ->
145+
Some
146+
{ Rules.set_rules = x.set_rules @ y.set_rules
147+
; add_rules = x.add_rules @ y.add_rules
148+
}))
145149
| Error _ -> Memo.return vars)
146150
| Ok false | Error _ -> Memo.return vars
147151
in

test/blackbox-tests/test-cases/custom-cross-compilation/cross-compilation-ocamlfind.t

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,24 @@ Dune should be able to find it too
6363

6464
$ dune build --root=app @install -x foo
6565
Entering directory 'app'
66-
File "dune", line 6, characters 12-18:
67-
6 | (libraries libdep))
68-
^^^^^^
69-
Error: Library "libdep" not found.
70-
-> required by _build/default/.gen.eobjs/byte/dune__exe__Gen.cmi
71-
-> required by _build/default/.gen.eobjs/native/dune__exe__Gen.cmx
72-
-> required by _build/default/gen.exe
73-
-> required by _build/default.foo/foo.ml
74-
-> required by _build/install/default.foo/lib/repro/foo.ml
75-
-> required by _build/default.foo/repro-foo.install
76-
-> required by alias install (context default.foo)
7766
Leaving directory 'app'
78-
[1]
7967

68+
Library is built in the target context
69+
70+
$ ls app/_build/default.foo
71+
META.repro
72+
foo.ml
73+
repro-foo.install
74+
repro.a
75+
repro.cma
76+
repro.cmxa
77+
repro.cmxs
78+
repro.dune-package
79+
repro.ml-gen
80+
81+
Executable was built in the host context
82+
83+
$ ls app/_build/default
84+
gen.exe
85+
gen.ml
86+
gen.mli

0 commit comments

Comments
 (0)