New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynlink fails on linux #5093
Comments
Comment author: @alainfrisch I cannot reproduce the bug on my 64-bit Linux machine. I get "no bug" printed. $ uname -a I'll try to find a 32-bit Linux... |
Comment author: @alainfrisch Same on a freshly installed 32-bit Linux machine: $ uname -a I still cannot reproduce your problem. Could you add the -verbose option to ocamlopt? Normally, the command line used for linking the main program should contain -Wl,-E, whose effect is to make all symbols from the main program available to shared libraries. |
Comment author: @dbuenzli That's it. The option -Wl,-E is missing and if I add it with -cclib everything works perfectly. What strange is that the output of configure mentions this option as link flags. It is also mentioned in the BYTECCLINKOPTS and NATDYNLINKOPTS variables of /usr/local/lib/ocaml/Makefile.config. Can you find out where something is missing ? Let me know if I can help. Daniel |
Comment author: @alainfrisch Normally the -Wl,-E option is stored in dynlink.cmxa (see otherlibs/dynlink/Makefile) and should thus be inserted on the command-line used to link your main program. Could you rebuild OCaml and look for the command-line that builds dynlink.cmxa? |
Comment author: @dbuenzli I build with build/fastworld.sh, _build/_log mentions : Target: otherlibs/dynlink/nat/dynlink.cmxa, tags: { debug, dont_link_with, extension:cmxa, file:otherlibs/dynlink/nat/dynlink.cmxa, library, link, native, ocaml, otherlibs, quiet, traverse, use_stdlib }./ocamlopt.opt -nostdlib -a -I stdlib myocamlbuild_config.cmx utils/misc.cmx parsing/linenum.cmx utils/terminfo.cmx utils/warnings.cmx parsing/location.cmx parsing/longident.cmx typing/ident.cmx typing/path.cmx typing/primitive.cmx typing/types.cmx typing/btype.cmx typing/predef.cmx typing/datarepr.cmx utils/tbl.cmx typing/subst.cmx utils/config.cmx utils/clflags.cmx utils/consistbl.cmx typing/env.cmx bytecomp/lambda.cmx asmcomp/debuginfo.cmx asmcomp/clambda.cmx otherlibs/dynlink/nat/dynlink.cmx -o otherlibs/dynlink/nat/dynlink.cmxa Target: otherlibs/dynlink/dynlink.cmxa, tags: { }cp -p otherlibs/dynlink/nat/dynlink.cmxa otherlibs/dynlink/dynlink.cmxa |
Comment author: @alainfrisch This is clearly the source of the problem. Just to be sure, could you rebuild with "make world opt" and confirm that your example works fine? |
Original bug ID: 5093
Reporter: @dbuenzli
Assigned to: @xclerc
Status: closed (set by @xclerc on 2011-02-21T15:29:55Z)
Resolution: not a bug
Priority: normal
Severity: major
Platform: Unix
OS: Linux
OS Version: 2.6.32-23
Version: 3.12.0+beta1 or 3.12.0+rc1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @dbuenzli
Bug description
In the attached program loading plugin.cmxs fails on linux because of undefined symbols. On osx, the same program works.
Thanks,
Daniel
Steps to reproduce
dbuenzli@minidip:
/sync$ uname -a/sync$ tar -xjf bug-dlink.tbzLinux minidip 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 07:54:58 UTC 2010 i686 GNU/Linux
dbuenzli@minidip:
dbuenzli@minidip:
/sync$ cd bug-dlink* loader.ml plugin.ml _tagsbuild.sh* build.sh
dbuenzli@minidip:
/sync/bug-dlink$ ./build.sh/sync/bug-dlink$ ./loader.native/usr/local/bin/ocamldep.opt -modules plugin.ml > plugin.ml.depends
/usr/local/bin/ocamlc.opt -c -linkall -o plugin.cmo plugin.ml
/usr/local/bin/ocamlopt.opt -c -linkall -o plugin.cmx plugin.ml
/usr/local/bin/ocamlopt.opt -shared plugin.cmx -o plugin.cmxs
/usr/local/bin/ocamldep.opt -modules loader.ml > loader.ml.depends
/usr/local/bin/ocamlc.opt -c -linkall -o loader.cmo loader.ml
/usr/local/bin/ocamlopt.opt -c -linkall -o loader.cmx loader.ml
/usr/local/bin/ocamlopt.opt dynlink.cmxa loader.cmx -o loader.native
dbuenzli@minidip:
error loading shared library: /home/dbuenzli/sync/bug-dlink/_build/plugin.cmxs: undefined symbol: camlPervasives__print_endline_1274
File attachments
The text was updated successfully, but these errors were encountered: