I recently installed the llvm package (version 19-static) via opam on an iMac M4. All seemed to go OK. When I came to build a small dune project to play with llvm I got a warning: ld: warning: ignoring duplicate libraries: '-lLLVMAArch64AsmParser', '-lLLVMAArch64CodeGen', '-lLLVMAArch64Desc', '-lLLVMAArch64Disassembler', ... '-lLLVMXCoreInfo', '-lc++', '-lm', '-lz', '-lzstd'
The project executed as I expected but I’m wondering how to get rid of the warning?
I currently have llvm.19-shared installed rather than llvm.19-static (as in my first message) which I believe accounts for the fewer number of duplicate libraries reported.
I get the same warning whether or not I omit “llvm”.
I’ve looked at dune’s log file and at some tracing from the ocamlopt.opt command dune invokes to link my executable. From the latter I can see that for each library from the llvm bindings package that my executable references ocamlopt.opt emits a -l argument for the appropriate library plus five others: -lLLVM-19 -lc++ -lm -lz -lzstd. The macOS build tool (clang) generates the warning I see about these duplicate libraries.
I’ll report this minor inconvenience to the maintainer of the llvm bindings if I can but I’m going to stop worrying about it now.