ocaml / ocaml/dune

ld: Error: unable to disambiguate: -shared-libgcc

Open
#7,073 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build c-bindings
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

I'm getting the linker error ld: Error: unable to disambiguate: -shared-libgcc when trying to create a .o file with (modes object).
I'm not sure that the issue is with Dune, but I'm hoping you can shed some light.

To replicate, create a new project with dune init project broken, run opam install class_group_vdf, and finally change bin/dune to:

(executable
 (public_name broken)
 (name main)
 (libraries broken class_group_vdf)
 (modes exe object))

Then, dune build should fail with ld: Error: unable to disambiguate: -shared-libgcc.

Do you have any idea what might be causing this?
It seems odd that a single library would use conflicting versions of another library, so perhaps a flag Dune is passing is introducing the conflict?
I'm also confused as to why an apparently shared library is coming up when doing static linking.

Specifications

dune 3.6.2, ocaml 4.14.1, Ubuntu 22.04.

Additional information

https://gist.github.com/emchristiansen/da7584036fcbe7a3373f8298dbeaf84a

https://github.com/zshipko/rust-ocaml-starter/issues/4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure in a project created with dune init project broken, after installing class_group_vdf and changing bin/dune to use (modes exe object). Start by examining the build or linker command associated with dune build and the reported -shared-libgcc error on Ubuntu 22.04. Done means identifying whether Dune or a dependency introduces the conflicting flag and clarifying the cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, ocaml
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.