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: 5260 Reporter: nacl Status: closed (set by @xavierleroy on 2013-08-31T10:43:55Z) Resolution: not a bug Priority: normal Severity: major Version: 3.12.0 Category: ~DO NOT USE (was: OCaml general) Related to:#5234
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'
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.
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.
Original bug ID: 5260
Reporter: nacl
Status: closed (set by @xavierleroy on 2013-08-31T10:43:55Z)
Resolution: not a bug
Priority: normal
Severity: major
Version: 3.12.0
Category: ~DO NOT USE (was: OCaml general)
Related to: #5234
Bug description
Yeah, the title says it all.
OS: Linux/openSUSE 11.4
Kernel Version: 2.6.37.6
Arch: x86_64
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: http://www.mail-archive.com/godi-list@ocaml-programming.de/msg00347.html
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 #5234
File attachments
The text was updated successfully, but these errors were encountered: