The merged link needs the stubs archive, and must not name a libdl that is gone

This commit is contained in:
Joseph Ferano 2026-09-12 21:57:16 +07:00
parent a915140f17
commit a31d89e6bb
2 changed files with 13 additions and 1 deletions

View File

@ -2062,6 +2062,13 @@ let compiler_object () =
"-output-complete-obj";
"-I"; Filename.quote (Filename.concat lib ".flan.objs/byte");
"-I"; Filename.quote (Filename.concat lib ".flan.objs/native");
(* [lib] again, as a library search path. The macro work gave
[lib/dune] a [foreign_stubs] stanza, so [flan.cmxa] now records
a dependency on [-lflan_stubs] and the linker has to be told
where dune put the archive. Without this the merged object
fails with "cannot find -lflan_stubs" and only
[--two-process] works. *)
"-cclib"; Filename.quote ("-L" ^ lib);
"-o"; Filename.quote tmp;
Filename.quote cmxa; Filename.quote ml ]
in

View File

@ -14,7 +14,12 @@
(foreign_stubs
(language c)
(names dynload_stubs))
(c_library_flags (-ldl)))
; No (c_library_flags (-ldl)): since glibc 2.34 dlopen lives in libc itself
; and libdl is a stub, and naming it breaks the merged build -- the partial
; link -output-complete-obj performs cannot resolve -ldl, so `flan dev` in
; one process fails at the link with "cannot find -ldl" while the ordinary
; build is unaffected. Add it back only with a platform guard.
)
; The host shim is Flan's, not the user's, so the compiler carries it rather
; than looking for it in an install directory. Generated from the real .c files