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

ocamlmklib and .cmxa #3249

Closed
vicuna opened this issue Oct 29, 2004 · 4 comments

Comments

@vicuna
Copy link

commented Oct 29, 2004

Original bug ID: 3249
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: tools (ocaml{lex,yacc,dep,debug,...})

Bug description

Full_Name: Pascal
Version: 3.08 (Debian)
OS: Linux
Submission from: indigo.recherche.enac.fr (195.220.159.164)

ocamlmklib allows to include .cma libraries (by the way, it is not documented
but it works as expected):

    ocamlmklib ... str.cma ...

but not .cmxa :

    brisset@sepia:~% ocamlmklib ... str.cmxa ...
    /usr/lib/ocaml/3.08/str.cmxa is not a compilation unit description.

--Pascal

@vicuna

This comment has been minimized.

Copy link
Author

commented Nov 3, 2004

Comment author: administrator

Same behavior with ocamlc -a vs ocamlopt -a. Wish: ocamlopt -a that accepts
.cmxa as arguments. Require hacking around "ar" limitations.

@vicuna vicuna added the tools label Mar 14, 2019
@dbuenzli

This comment has been minimized.

Copy link
Contributor

commented Mar 16, 2019

This problem still exists on 4.07.1 e.g.:

> ocamlmklib -verbose -o bla hmap.cma
+ /Users/dbuenzli/.opam/4.07.1/bin/ocamlc -a    -o bla.cma  hmap.cma -dllib -lbla -cclib -lbla
    
> ocamlmklib -verbose -o bla hmap.cmxa
+ /Users/dbuenzli/.opam/4.07.1/bin/ocamlopt -a   -o bla.cmxa  hmap.cmxa -cclib -lbla    
Option -a cannot be used with .cmxa input files. 

though I fail a bit to see the use case (repacking a set of libraries as a larger one ?).

That being said the synopsis of ocamlmklib seems to be a bit misleading:

> ocamlmklib -help
Usage: ocamlmklib [options] <.cmo|.cma|.cmx|.cmxa|.ml|.mli|.o|.a|.obj|.lib|.dll|.dylib files>

or at least widly different from what is specified in the manual.

A look at the implementation seems to indicate that the synopsis is right. But the implementation strategy seems to be let's give all that to ocamlc and ocamlopt and see whatever happens.

@nojb

This comment has been minimized.

Copy link
Contributor

commented Mar 16, 2019

My understanding is that this limitation stems from there being no simple way to merge static libraries in a portable way. Including all that intricate logic in the compiler does not seem to fit with its overarching philosophy. With that, I move to close this issue.

@xavierleroy

This comment has been minimized.

Copy link
Contributor

commented Mar 17, 2019

Yes, ocamlc -a can combine several .cma into a single .cma, but ocamlopt -a cannot do the same because ar is unable to combine several .a archive files, at least not without awful hacks.

The ocamlmklib synopsis should be fixed, indeed. I believe no other change is necessary.

xavierleroy added a commit to xavierleroy/ocaml that referenced this issue Mar 17, 2019
That's because ocamlopt -a doesn't support .cmxa files as arguments.
It is better to reject those files in ocamlmklib than later.
The manual never said that ocamlmklib accepts .cmxa files.

Closes: ocaml#3249
xavierleroy added a commit that referenced this issue Mar 18, 2019
That's because ocamlopt -a doesn't support .cmxa files as arguments.
It is better to reject those files in ocamlmklib than later.
The manual never said that ocamlmklib accepts .cmxa files.

Closes: #3249
@vicuna vicuna added the feature-wish label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.