Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Allow building with libc++ on linux#5505

Merged
halfalicious merged 3 commits intomasterfrom
libcxx
Feb 27, 2019
Merged

Allow building with libc++ on linux#5505
halfalicious merged 3 commits intomasterfrom
libcxx

Conversation

@chfast
Copy link
Member

@chfast chfast commented Feb 26, 2019

No description provided.

The Gold linker is not maintained any more by Google and it starts to have problems with linking code produced by newer compilers like clang 8.
@chfast chfast requested a review from halfalicious February 26, 2019 14:05
void setDefaultOrCLocale()
{
#if __unix__
if (!std::setlocale(LC_ALL, ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In libc++ the setlocale is not in the std namespace.

set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")

option(USE_LD_GOLD "Use GNU gold linker" ON)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, which linker will we use for clang builds if we don't use the gold linker?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GNU ld. Also lld from LLVM can be used (is much faster, I'm using it for building LLVM itself where linking time is huge). In the same way: -fuse-ld=lld. But only clang supports it (GCC not).

As I explained in the commit message, Google has switched to use LLD, and they are not interested in maintaining ld.gold. Fedora is considering moving ld.gold out of the main package repo. And I have linking error when using clang-8. There must be new "linking features" that clang-8 depends on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification!

Copy link
Contributor

@halfalicious halfalicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go, it looks like the AppVeyor run timed out but that's probably not related to your changes since yours only impact Linux

@halfalicious halfalicious merged commit 05e6030 into master Feb 27, 2019
@halfalicious halfalicious deleted the libcxx branch February 27, 2019 17:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants