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

[macOS] CMake: Work around ranlib potentially corrupting static libs #2757

Merged
merged 3 commits into from
Jun 29, 2018

Conversation

kinke
Copy link
Member

@kinke kinke commented Jun 27, 2018

Also cross-checked against LLVM 6.0.0 (no relevant changes though).

@JohanEngelen
Copy link
Member

perhaps you wanted to target master instead?

lgtm

@kinke
Copy link
Member Author

kinke commented Jun 27, 2018

Nope, this is done as part of remaining 2.081 OSX troubleshooting (dynamic-compile integration tests fail for Circle, once again due to a ranlib-corrupted static lib in the install folder when using the integrated archiver...).

[We need the internal archiver for BUILD_LTO_LIBS.]

When installing the static lib archived by LDC (1 D object file, 1 C++
one) via CMake, `ranlib` is apparently invoked for the installed copy,
which may corrupt it, e.g., reproduced via CircleCI SSH with Xcode 9.2
(.a file size unchanged after (successful) ranlib run):

/Applications/Xcode-9.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
foo.a truncated or malformed archive (terminator characters in archive
member "c_" not the correct "`\n" values for the archive member header
at offset 784)

We already encountered this or a very similar bug (with LLVM 5 and some
Xcode version IIRC). Copy the file manually for now as hopefully robust
workaround.
@kinke kinke changed the title Slightly revise stripped-down llvm-ar code in driver/archiver.cpp [macOS] CMake: Work around ranlib potentially corrupting libldc-jit-rt.a Jun 28, 2018
@kinke kinke changed the title [macOS] CMake: Work around ranlib potentially corrupting libldc-jit-rt.a [macOS] CMake: Work around ranlib potentially corrupting static libs Jun 28, 2018
I.e., druntime and Phobos too, not just ldc-jit-rt.
[Only affecting MULTILIB=OFF builds, as the fat libs are generated and
copied manually anyway).
@kinke kinke merged commit 5bb8ec8 into ldc-developers:merge-2.081 Jun 29, 2018
@kinke kinke deleted the osx_archiver branch June 29, 2018 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants