Skip to content
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

Missing symbols from libasmrun.a even with -linkall #5353

Closed
vicuna opened this issue Sep 1, 2011 · 2 comments
Closed

Missing symbols from libasmrun.a even with -linkall #5353

vicuna opened this issue Sep 1, 2011 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Sep 1, 2011

Original bug ID: 5353
Reporter: @zoggy
Status: closed (set by @xavierleroy on 2011-09-06T14:42:28Z)
Resolution: won't fix
Priority: high
Severity: major
Version: 3.12.1
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hello,

uname -a

Linux alcazar 3.0.0-1-amd64 #1 SMP Sat Aug 27 16:21:11 UTC 2011 x86_64 GNU/Linux

These commands:

echo "let x = 1;;" > /tmp/foo.ml

ocamlopt -verbose -linkall /tmp/foo.ml

nm a.out | grep terminfo

produce an executable where some symbols from libasmrun.a are not available, which prevents Dylinlink (in my case, the symbol caml_terminfo_resume is missing)

The solution seems to be to use the --whole-archive of ld, but it has to be put before libasmrun.a, to keep all symbols from this lib, and followed by a --no-whole-archive option to prevent integrating all symbols from next libraries.

@vicuna
Copy link
Author

vicuna commented Sep 1, 2011

Comment author: @alainfrisch

In our code, we use a simple work-around for this issue:

(* Hack to force the inclusion of terminfo.o (found in libasmrun.lib). *)
external setup : unit -> unit = "caml_terminfo_setup"
let () = if false then setup ()

(you can put this code anywhere in your main program)

@vicuna
Copy link
Author

vicuna commented Sep 6, 2011

Comment author: @xavierleroy

I can't see a much better solution than Alain's suggestion. Messing with obscure ld flags is nonportable and risky (cf. our frequent surprises with MacOS X's linker...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant