Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000103OCamlOCaml generalpublic2000-05-06 08:412000-06-05 14:44
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000103: documentation bug
DescriptionFull_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. . .

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000375)
administrator (administrator)
2000-05-08 17:27

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

(0000376)
administrator (administrator)
2000-05-09 10:22

> 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

(0000377)
administrator (administrator)
2000-05-09 17:04

> 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

(0000378)
administrator (administrator)
2000-06-05 14:44

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

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker