This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Use CMAKE_AR for merging static libraries
ClosedPublic

Authored by mstorsjo on Aug 25 2017, 2:20 AM.

Details

Summary

Don't prepend the ar commands by a dash, not all ar implementations support that (llvm-ar doesn't).

Also pass the 's' option when creating the merged library, to create an index.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Aug 25 2017, 2:20 AM
compnerd requested changes to this revision.Sep 4 2017, 12:41 PM
compnerd added a subscriber: compnerd.

If we handle this in CMake, this will be unnecessary.

This revision now requires changes to proceed.Sep 4 2017, 12:41 PM
EricWF requested changes to this revision.Sep 12 2017, 1:30 PM

Ironically I think parts of this change should be moved into merge_archives.py.

the ar used in merge_archives.py might not be the right one for the target

OK, then we should modify merge_archives.py to support optionally specifying the ar executable.

(and the invocation doesn't include the 's' modifier for updating the archive index)

Isn't this also just a bug in merge_archives.py?

Ironically I think parts of this change should be moved into merge_archives.py.

the ar used in merge_archives.py might not be the right one for the target

OK, then we should modify merge_archives.py to support optionally specifying the ar executable.

(and the invocation doesn't include the 's' modifier for updating the archive index)

Isn't this also just a bug in merge_archives.py?

Hm, indeed, that's probably a better solution. I'll give that a go and see how it goes.

mstorsjo updated this revision to Diff 114907.Sep 12 2017, 2:09 PM
mstorsjo updated this revision to Diff 114908.
mstorsjo edited edge metadata.
mstorsjo retitled this revision from [libc++] Rerun ranlib manually after merging the static libraries to [libc++] Use CMAKE_AR for merging static libraries.
mstorsjo edited the summary of this revision. (Show Details)

The previous patch actually lacked the 's' option that the summary talked about

EricWF accepted this revision.Sep 12 2017, 3:28 PM

LGTM, minus inline comments.

utils/merge_archives.py
97 ↗(On Diff #114908)

-a doesn't feel very descriptive, and unlike -o and -L it isn't used commonly elsewhere. Maybe just the long option on this one?

This revision was automatically updated to reflect the committed changes.