Dune linking error only when building bytecode

I’m building a dune project with some c-stubs and external libraries, however whenever I try to build a bytecode executable the build fails with a linking error:

> dune build ./src/main.bc --verbose
....
$ cd _build/default && ~/.opam/default/bin/ocamlc.opt -linkall -g -o src/main.bc ...
/usr/bin/ld: cannot find -lcore_stubs
/usr/bin/ld: cannot find -lspawn_stubs
/usr/bin/ld: cannot find -lversion_util_stubs
...

However, these libraries are present and installed via opam:

> locate core_stubs
~/.opam/default/lib/core/libcore_stubs.a
~/.opam/default/lib/stublibs/dllcore_stubs.so

and whenever I build the project for a native target the build succeeds.

The relevant dune file is:

(library
 (name lib)
 (libraries ...)
 (foreign_stubs
  (language c)
  (names ...)
  (include_dirs ...))
 (c_library_flags ....)
 (foreign_archives ...)
 (modes native byte)
 (flags -linkall))

I can make some of the errors go away by explicitly passing additional flags to ocamlc to look in the right directory, but this seems brittle.

What is the cause of this issue/why isn’t ocamlc finding the libraries?