ocaml / ocaml/flexdll

Issue with link order of archive files specified twice on the command line

Open
#87 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
115
Forks
34
PR merge metrics
No merged PRs in 30d

Description

I am currently in the process of moving the Coq Windows build from our old shell scripts to opam. Doing so, I have an issue with linking CoqIDE with flexlink. I (or ocamlfind) specify one archive twice on the command line like this:

-lpangocairo-1.0
: 
-llablgtk3_stubs
:
-lpangocairo-1.0

liblablgtk3_stubs needs symbols defined in lpangocairo-1.0 and the nm tool tells me that the symbols are there. Still I get an error that the symbols are undefined.

I looked into this with SysInternals ProcMon and all involved tools (flexlink, mingw gcc and ld) read the archives in the order libpangocairo and then lablgtk3_stubs. Notably pangocairo-1.0 is not read a second time although it is specified twice.
As far as I know at least ld does not use objects in an archive when they don't contain currently needed symbols, so in this order pangocairo-1.0 get's ignored.

Another interesting point is that the command line to gcc does not contain libpangocairo at all, although it does read it later - not sure what kind of magic this is (See line 9175 in the attached log).

I must admit I am not 100% sure what version of flexlink I have since it is supplied by opam and it doesn't seem to have an option to display this.

If this helps I can supply batch/shell scripts which install a fresh cygwin and bring you to the point of this error.

P.S.: I tried to attach the ProcMon log as txt or zip - it won't let me giving obscure errors. I will try again after creating the issue.

Contributor guide

No contributing guide indexed for this repository

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 Windows link command using the flexlink and ocamlfind setup described, then inspect how flexlink forwards repeated archive arguments to mingw gcc and ld. The issue provides no repository file, test, or complete reproduction script; done means explaining and resolving the missing symbols when libpangocairo-1.0 is specified twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.