Skip to content

Build: Loads archives from opam switch to fix bytecode targets

Context

dune build in the project root fails to build bytecode targets and fails with linkers errors

# sample logs
/usr/bin/ld: cannot find -lindex_unix_stubs                                                                                                                                  
/usr/bin/ld: cannot find -lprogress_stubs                                                                                                                                    
/usr/bin/ld: cannot find -lterminal_size_stubs                                                                                                                               
/usr/bin/ld: cannot find -lmirage_crypto_rng_unix_stubs                                                                                                                      
/usr/bin/ld: cannot find -lmirage_crypto_ec_stub

Related open issue at ocaml/dune

This likely because of incorrect linker flags embedded in the cmos

This MR updates scripts/env.sh to load paths from the opam switch (into LDFLAGS) and make it available for Dune (via a configurator script)

Manually testing the MR

eval $(./scripts/env.sh) && dune build ./src/proto_alpha/lib_benchmark/test/test_sampling_data.bc should run fine. The fix can be extended to Granda's lib_benchmark too

Update: eval $(./scripts/env.sh) && dune build should run fine now

Checklist

  • Document the use of scripts/env.sh before dune build
Edited by prometheansacrifice

Merge request reports