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

documentation bug #2441

Closed
vicuna opened this issue May 6, 2000 · 4 comments
Closed

documentation bug #2441

vicuna opened this issue May 6, 2000 · 4 comments
Labels

Comments

@vicuna
Copy link

vicuna commented May 6, 2000

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

Bug description

Full_Name: Brad Knotwell
Version: 3.00
OS: NetBSD1.4.2 x86
Submission from: user-2ini98i.dialup.mindspring.com (165.121.37.18)

section 17.1.3 of the documentation is quite confusing and apparently
incorrect. specifically, the following information doesn't work
as advertised:

ocamlc -o mylib.cma -custom a.cmo b.cmo -cclib -lmylib

From my experience, something like the following is more correct:

ocamlc -a -make-runtime -o mylib.cma -custom a.cmo b.cmo -cclib -lmylib

For a more complete example, I've put a small syslog library on the
web at the following url: http://pweb.netcom.com/~knotwell/syslog.tar

The Makefile in the tarball explicitly shows the commands necessary
to build (under NetBSD anyhow) "easy linkable" native and bytecode
libraries.

Or I could be wrong. . .

@vicuna
Copy link
Author

vicuna commented May 8, 2000

Comment author: administrator

here's what I did. . .I probably just don't understand something:

bash-2.04$ ocamlc -c syslogwrap.c
bash-2.04$ ocamlc -c syslog.mli
bash-2.04$ ocamlc -c syslog.ml
bash-2.04$ ocamlc -o syslog.cma -custom syslog.cmo syslogwrap.o
bash-2.04$ ocamlc -o syslogtest syslog.cma syslogtest.ml
The file syslog.cma is not a bytecode object file
bash-2.04$

#I didn't follow the docs exactly, so I'll try it with the cclib option
bash-2.04$ ar -r libsyslogwrap.a syslogwrap.o
bash-2.04$ ranlib libsyslogwrap.a
bash-2.04$ ocamlc -o syslog.cma -custom syslog.cmo -cclib -lsyslogwrap -ccopt -L.
bash-2.04$ ocamlc -o syslogtest syslog.cma syslogtest.ml
The file syslog.cma is not a bytecode object file

#on the other hand; the following works fine:
bash-2.04$ ocamlc -o syslog.cma -make-runtime -a -o syslog.cma -custom syslog.cmo syslogwrap.o
bash-2.04$ ocamlc -o syslogtest syslog.cma syslogtest.ml
bash-2.04$ ./syslogtest
bash-2.04$ tail -2 /var/log/messages
May 8 17:13:21 ./syslogtest[841]: first test
May 8 17:13:22 ./syslogtest[841]: second test
bash-2.04$

If you need anything else, just email me. BTW: is the -a option deprecated?

--Brad

--text follows this line--

section 17.1.3 of the documentation is quite confusing and apparently
incorrect. specifically, the following information doesn't work
as advertised:

ocamlc -o mylib.cma -custom a.cmo b.cmo -cclib -lmylib

Could you explain more why it "doesn't work as advertised"? This
builds a library mylib.cma, which you can then link with your program,
and the associated C library -lmylib will then be linked in too.

From my experience, something like the following is more correct:

ocamlc -a -make-runtime -o mylib.cma -custom a.cmo b.cmo -cclib -lmylib

It's not "more correct": it does something different.

It could very well be that the documentation is not clear enough, and
I'd be happy to try to clarify things, but I'd need to understand
better what wasn't clear to you in the first place.

Regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented May 9, 2000

Comment author: administrator

section 17.1.3 of the documentation is quite confusing and apparently
incorrect. specifically, the following information doesn't work
as advertised:

ocamlc -o mylib.cma -custom a.cmo b.cmo -cclib -lmylib

Could you explain more why it "doesn't work as advertised"? This
builds a library mylib.cma, which you can then link with your program,
and the associated C library -lmylib will then be linked in too.

From my experience, something like the following is more correct:

ocamlc -a -make-runtime -o mylib.cma -custom a.cmo b.cmo -cclib -lmylib

It's not "more correct": it does something different.

It could very well be that the documentation is not clear enough, and
I'd be happy to try to clarify things, but I'd need to understand
better what wasn't clear to you in the first place.

Regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented May 9, 2000

Comment author: administrator

here's what I did. . .I probably just don't understand something:

Actually, you're correct, something is wrong in the documentation and
I'm guilty of not having read your first message carefully enough.
Namely:

    ocamlc -o syslogtest syslog.cma syslogtest.ml

There's a missing "-a" option to instruct ocamlc to build a library
rather than an executable. I'll fix the docs as soon as possible.

#on the other hand; the following works fine:
bash-2.04$ ocamlc -o syslog.cma -make-runtime -a -o syslog.cma
-custom syslog.cmo syslogwrap.o

Right. Actually, the key option here is "-a"; "-make-runtime" is
ignored in this case (I believe).

Thanks for the bug report,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jun 5, 2000

Comment author: administrator

Fixed on 2000/05/09 by Xavier. Also related to #2471.

@vicuna vicuna closed this as completed Jun 5, 2000
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant