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

Argl is dropped w/o -linkall: camlp4.cm[x]a should be linked with -linkall, or some other way to link in argl w/o -linkall is ne #3439

Closed
vicuna opened this issue Jan 22, 2005 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jan 22, 2005

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

Bug description

Full_Name: Aleksey Nogin
Version: 3.08.2
OS: Fedora Core 2
Submission from: wasco.cs.caltech.edu (131.215.44.173)

I want to be able to compile a camlp4-based executable (which links in the
campl4.cm[x]a library) without a -linkall (which would result in a noticeably
smaller executable in my case). Unfortunatelly, it is impossible in the current
(3.08.2) state of things - the camlp4 processing relies on the Argl module to do
the "real job" of file processing, but without -linkall, the Argl module gets
dropped!

There are a number of things that can be done about it:

  1. Users could link all camlp4 executables with -linkall. This is what I
    currently have to do, but this is obviously suboptimal (especially in case the
    executable also needs a bunch of other big libraries).

  2. You could change the camlp4/camlp4/Makefile to use -linkall for building
    camlp4.cm[x]a. I should be sufficient (I have to admit - have not tested it yet)
    to just replace the "LINKFLAGS=$(INCLUDES)" on line 9 with
    "LINKFLAGS=$(INCLUDES) -linkall"! This is ideal, unless there are some valid
    reasons to link agains the camlp4.cm[x]a library and not use Argl (I doubt
    this is likely to happen)

  3. You could change the camlp4/camlp4/Makefile to install the argl.cmo, argl.o,
    and argl.cmx into the "$(LIBDIR)/camlp4/.". This way users would be able to
    explicitly link in argl.cmx and not worry about it being dropped. (Not sure if
    that would require removing Argl from the camlp4.cm[x]a - if yes, than may be
    this is not such a good idea).

  4. You could change the camlp4/camlp4/Makefile to install argl.cmi (by adding it
    to the line 76 that currently reads
    cp mLast.cmi quotation.cmi ast2pt.cmi pcaml.cmi spretty.cmi
    "$(LIBDIR)/camlp4/."). This way users could, for example, add "let _ = Argl.go"
    to one of the files compiled into my executable and I am good to go. This is a
    bit of a hack, obviously, but it is a possibility.

  5. You could create some additional dependency on Argl (similar to 3) that users
    could then use to "pull in" the Argl module w/o haing to use -linkall.

  6. Users could just copy argl.ml from the distribution and compile it into their
    binaries, instead of using the Argl in the camlp4.cm[x]a. This is obviously
    problematic.

IMHO, options "2" and "3" are much better than all others.

Thank you in advance for considering this!

@vicuna
Copy link
Author

vicuna commented Jan 31, 2005

Comment author: administrator

Fixed 2005-01-31 MM.
Implemented both 3) and 4).

@vicuna vicuna closed this as completed Jan 31, 2005
@vicuna vicuna added the bug label Mar 19, 2019
dra27 pushed a commit to dra27/ocaml that referenced this issue Feb 27, 2021
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