|Anonymous | Login | Signup for a new account||2015-07-04 01:46 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005260||OCaml||OCaml general||public||2011-05-01 22:40||2013-08-31 12:43|
|Status||closed||Resolution||no change required|
|Target Version||Fixed in Version|
|Summary||0005260: ocaml compiler presents static link libraries to GCC backwards|
|Description||Yeah, the title says it all.|
OS: Linux/openSUSE 11.4
Kernel Version: 22.214.171.124
The openSUSE build service compiles static libraries with the --as-needed linker flag, which causes the statically linking against the pcre library fail with GCC linker errors. This likely extends to other libraries as well.
This can be set to ocamlc or ocamlopt by adding '-ccopt -Wl,--as-needed'
For example, compiling the attached file with
ocamlc.opt -verbose -g -o test.byt -thread -I /usr/lib64/ocaml/pcre/ /usr/lib64/ocaml/pcre/pcre.cma test.ml
Works fine. The relevant linker arguments are '-lpcre' and '-lpcre_stubs', in that order However, when called as:
ocamlc.opt -ccopt -Wl,--as-needed -verbose -g -o test.byt -thread -I /usr/lib64/ocaml/pcre/ /usr/lib64/ocaml/pcre/pcre.cma test.ml
It fails. However, It works when I explicitly add a 'cclib -lpcre' to the mix, like so:
ocamlc.opt -ccopt -Wl,--as-needed -cclib -lpcre -verbose -g -o test.byt -thread -I /usr/lib64/ocaml/pcre/ /usr/lib64/ocaml/pcre/pcre.cma test.ml
It works perfectly fine, dumping the pcre linker flags as -lpcre -lpcre_stubs -lpcre, with the last '-lpcre' appearing to be appended as a result of the '-cclib -lpcre' argument.
The linker args at the bottom of the pcre.cma file appear to be specified in the correct order of '-lpcre_stubs -lpcre' as was seen by opening it in a text editor. Attempting to reverse the order of the flags in the file resulted in the compiler segfaulting.
It was suggested that the problem is somehow related to a list reversal, but I do not know for sure.
|Additional Information||This problem was first noted in this thread: //firstname.lastname@example.org/msg00347.html">http://email@example.com/msg00347.html [//firstname.lastname@example.org/msg00347.html" target="_blank">^]|
It was unclear whether this was a problem with pcre or ocaml itself, but Gerd seems to suggest that it was related to ocaml itself.
This bug is likely the same as described in http://caml.inria.fr/mantis/view.php?id=5234 [^]
|Tags||No tags attached.|
|Attached Files||test.ml [^] (99 bytes) 2011-05-01 22:40 [Show Content]|
When I compile pcre 6.2.2, the command line that compiles pcre.cmxa is the following:
ocamlopt -a -cclib "-L/opt/local/lib -lpcre" -cclib -lpcre_stubs -o pcre.cmxa pcre.cmx
Note that "-lpcre" and "-lpcre_stubs" appear in this order (which is the wrong order, given the strange semantics of the Unix linker). OCaml preserves this order, as it should.
I strongly claim that the problem is in pcre itself: it should list -lpcre_stubs before -lpcre.
|2011-05-01 22:40||nacl||New Issue|
|2011-05-01 22:40||nacl||File Added: test.ml|
|2011-05-02 12:47||doligez||Relationship added||related to 0005234|
|2011-05-16 16:36||doligez||Status||new => acknowledged|
|2011-05-17 16:08||doligez||Note Added: 0005900|
|2011-05-17 16:08||doligez||Status||acknowledged => resolved|
|2011-05-17 16:08||doligez||Resolution||open => no change required|
|2013-08-31 12:43||xleroy||Status||resolved => closed|
|Copyright © 2000 - 2011 MantisBT Group|