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

ocamlopt -pack on macos 10.3.X fails #2634

Closed
vicuna opened this issue Jun 1, 2004 · 6 comments
Closed

ocamlopt -pack on macos 10.3.X fails #2634

vicuna opened this issue Jun 1, 2004 · 6 comments

Comments

@vicuna
Copy link

vicuna commented Jun 1, 2004

Original bug ID: 2634
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name:
Version: 3.07+2
OS: MacOS 10.3.4
Submission from: 129.67.76.83.cust.bluewin.ch (83.76.67.129)

Dear bugmaster,

I'm unable to use -pack with native code under (at least) MacOS 10.3.3 and
10.3.4. The steps below reproduce the bug. However, I suspect this is a problem
of the objcopy that comes on MacOS 10.3.X (GNU objcopy 2.13.90 20030128) itself
since I have no problem with -pack for bytecode and no problem with native code
on Linux with a later version of objcopy (GNU objcopy 2.13.90.0.18 20030206).

echo 'let () = print_endline "hello"' > test.ml
ocamlopt -c test.ml
ocamlopt -pack -o super.cmx test.cmx
/usr/libexec/binutils/objcopy: super.o: Invalid operation
Error during partial linking

Thanks for your work,

Daniel

@vicuna
Copy link
Author

vicuna commented Jun 11, 2004

Comment author: administrator

Full_Name:
Version: 3.07+2

I'm unable to use -pack with native code under (at least) MacOS 10.3.3 and
10.3.4. The steps below reproduce the bug. However, I suspect this is a
problem
of the objcopy that comes on MacOS 10.3.X (GNU objcopy 2.13.90 20030128)
itself
since I have no problem with -pack for bytecode and no problem with native
code
on Linux with a later version of objcopy (GNU objcopy 2.13.90.0.18 20030206).

That's right. It seems that Apple's version of objcopy cannot rename symbols.
In fact, I have been unable to make it do anything at all. I tried to
recompile
binutils from source, but it's such a huge piece of software that I finally gave
up.

This means that option -pack doesn't work on Mac OS X. You could file a
bug report with Apple, or try to recompile objcopy (I would like to hear about
it
if you manage to do it), or live without -pack.

I hope someday we'll have the -pack functionality without depending on objcopy,
but that's not for the near future.

-- Damien

@vicuna
Copy link
Author

vicuna commented Jun 12, 2004

Comment author: administrator

Le 11 juin 04, à 15:31, Damien Doligez a écrit :

That's right. It seems that Apple's version of objcopy cannot rename
symbols.
In fact, I have been unable to make it do anything at all. I tried to
recompile binutils from source, but it's such a huge piece of software
that I finally gave
up.
Apparently there is no support for the mach-o object format in the
sources of binutils. See this thread of discussion [1], and I just
tried with the latest stable 2.15 and it is still the case. So trying
to rebuild binutils from the sources is useless.

I will report a bug to Apple. However I do not have any knowledge of
these tools. Could you please confirm me that what I see below is the
occurence of the actual bug (and not a misuse of the program) that I
should report.

echo 'int f (int x) { return x; }' > test.c
gcc -c test.c
/usr/libexec/binutils/objcopy --prefix-symbols _pre test.o pretest.o
/usr/libexec/binutils/objcopy: test.o: Invalid operation

Thanks,

Daniel

[1] http://sources.redhat.com/ml/binutils/2003-10/threads.html#00572

@vicuna
Copy link
Author

vicuna commented Jun 12, 2004

Comment author: administrator

Apparently there is no support for the mach-o object format in the
sources of binutils. See this thread of discussion [1], and I just
tried with the latest stable 2.15 and it is still the case. So trying
to rebuild binutils from the sources is useless.

I will report a bug to Apple. However I do not have any knowledge of
these tools. Could you please confirm me that what I see below is the
occurence of the actual bug (and not a misuse of the program) that I
should report.

echo 'int f (int x) { return x; }' > test.c
gcc -c test.c
/usr/libexec/binutils/objcopy --prefix-symbols _pre test.o pretest.o
/usr/libexec/binutils/objcopy: test.o: Invalid operation

Actually, the objcopy operation needed for ocamlopt -pack is --redefine-sym:

/usr/libexec/binutils/objcopy --redefine-sym _f=_g test.o pretest.o

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jan 25, 2005

Comment author: administrator

see also #3320
feature wish: option -pack that doesn't depend on objcopy
DD 2004-06-11
Implemented using ld instead of objcopy. DD 2005-01-25

@vicuna
Copy link
Author

vicuna commented Jan 27, 2005

Comment author: administrator

Hello,

(replying to an old bug report of yours)

I'm unable to use -pack with native code under (at least) MacOS 10.3.3 and
10.3.4. The steps below reproduce the bug. However, I suspect this is a
problem
of the objcopy that comes on MacOS 10.3.X (GNU objcopy 2.13.90 20030128)
itself
since I have no problem with -pack for bytecode and no problem with native
code
on Linux with a later version of objcopy (GNU objcopy 2.13.90.0.18 20030206).

I have implemented ocamlopt -pack on Mac OS X, using ld instead of objcopy.
The change is commited in the CVS version (both branches). If you still need
it,
I would appreciate if you could test it before we release 3.08.3.

-- Damien

@vicuna vicuna closed this as completed Jan 27, 2005
@vicuna
Copy link
Author

vicuna commented Jan 27, 2005

Comment author: administrator

Le 27 janv. 05, à 13:14, Damien Doligez a écrit :

I have implemented ocamlopt -pack on Mac OS X, using ld instead of
objcopy.
Thanks. Good thing : it seems that binutils are being removed from
macos' developer tools. Besides, I just checked my bug report at apple
and it has been closed (without any further comment or information...).

The change is commited in the CVS version (both branches). If you
still need
it, I would appreciate if you could test it before we release 3.08.3.
I tried on a small scale example it seems works. But since in the end I
worked around this I have no big example at hand to try.

Thanks you very much for this.

Daniel

P.S.
I forwarded your message to Eric Dahlman since he ran into the problem
recently
http://caml.inria.fr/archives/200412/msg00343.html.

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