You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7150 Reporter:@yallop Assigned to:@chambart Status: assigned (set by @chambart on 2017-06-02T10:13:45Z) Resolution: reopened Priority: normal Severity: minor Target version: 4.03.1+dev Category: compiler driver Related to:#5441 Monitored by:@Drup@diml@ygrek@hcarty
Bug description
Here's a demonstration of unhelpful reordering behaviour involving options passed through by ocamlopt to the linker.
First, let's compile a couple of modules:
$ ocamlopt -c a.ml b.ml
Next, we'll build a library from one of the modules with some linker options, passed via -cclib:
$ ocamlopt -a -o liba.cmxa a.cmx -cclib -L/usr/adir/lib -cclib -L/usr/adir2/lib
Finally, we'll build an executable from the library and the other module, passing some more linker options:
Although liba.cmxa appeared between -L/usr/lib/bdir and -L/usr/bdir2/lib in the ocamlopt command line, in the gcc command line the options embedded in liba.cmxa have all been moved to the beginning of the line.
Moving the options in this way is a problem because the order of -L options is significant. Moving cmxa-embedded options to the beginning of the line results in those options taking precedence over whatever's specified on the command-line. On my system, for example, the lwt-unix.cmxa library embeds -L/usr/lib, which then appears at the beginning of the library search path. As a result system libraries are chosen before user-installed libraries, which is not usually the desired behaviour.
The text was updated successfully, but these errors were encountered:
to embed the linker options from liba.cmxa between the linker option -L/usr/bdir/lib and -L/usr/bdir2/lib and there doesn't appear to be any way to achieve that with any combination of '-ccopt -Wl,' and '-cclib'.
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
Original bug ID: 7150
Reporter: @yallop
Assigned to: @chambart
Status: assigned (set by @chambart on 2017-06-02T10:13:45Z)
Resolution: reopened
Priority: normal
Severity: minor
Target version: 4.03.1+dev
Category: compiler driver
Related to: #5441
Monitored by: @Drup @diml @ygrek @hcarty
Bug description
Here's a demonstration of unhelpful reordering behaviour involving options passed through by ocamlopt to the linker.
First, let's compile a couple of modules:
Next, we'll build a library from one of the modules with some linker options, passed via -cclib:
Finally, we'll build an executable from the library and the other module, passing some more linker options:
Here's the linker invocation from the last step:
In particular, note the order of the linker options
Although liba.cmxa appeared between -L/usr/lib/bdir and -L/usr/bdir2/lib in the ocamlopt command line, in the gcc command line the options embedded in liba.cmxa have all been moved to the beginning of the line.
Moving the options in this way is a problem because the order of -L options is significant. Moving cmxa-embedded options to the beginning of the line results in those options taking precedence over whatever's specified on the command-line. On my system, for example, the lwt-unix.cmxa library embeds -L/usr/lib, which then appears at the beginning of the library search path. As a result system libraries are chosen before user-installed libraries, which is not usually the desired behaviour.
The text was updated successfully, but these errors were encountered: