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

Making an empty .cmxa fails on MacOS #6550

Closed
vicuna opened this Issue Sep 10, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Sep 10, 2014

Original bug ID: 6550
Reporter: @damiendoligez
Assigned to: @mshinwell
Status: resolved (set by @mshinwell on 2017-03-10T12:45:39Z)
Resolution: duplicate
Priority: low
Severity: minor
OS: Mac OS X
Category: compiler driver
Monitored by: @gasche

Bug description

The command

ocamlopt -a -o foo.cmxa

works on Linux, but gives an error message from "ar" on MacOSX because Darwin's "ar" command does not allow adding zero files to an archive (stupid MacOSX).

Additional information

One way to create an empty archive is:

ar rc foo.a /dev/null
ar d foo.a null

but it really hurts my sensibility to have to hack around such a problem. Does anybody have a more elegant solution?

I think I'll report this to Apple as an "ar" bug.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Oct 10, 2014

Comment author: @damiendoligez

Turns out that I already reported this to Apple in 2005, and they closed my report without comment.

Also, to create an empty archive that will not trigger a compiler/linker warning:

ar rc foo.a /dev/null
ranlib foo.a 2>/dev/null
ar d foo.a /dev/null

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Dec 6, 2015

Comment author: @xavierleroy

Macports and Homebrew both have a binutils package that provides the GNU sensible implementation of "ar", but it is installed under the name "gar".

How often do we need to create empty .cmxa libraries? I move to suspend this PR.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Dec 6, 2015

Comment author: @gasche

We never need to do this, but some OCaml programmers have a problem when they do something not-really-necessary that happens to do this (for example, have configure switches to decide which packages to include in a foo.mllib file, such that under some configurations the list ends up being empty), and do not see any issue as they test under Linux. Then some OSX user reports that their package build is broken, and pain ensues.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Mar 10, 2017

Comment author: @mshinwell

Moved to #1094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.