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

Auto-detect C++ extensions needed to build #179

Merged
merged 3 commits into from
Jul 9, 2024

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented Jul 9, 2024

Certain versions of clang (e.g. 15.0 on macOS) require manually enabling C++ extensions via -std=c++<version>, and ICU 75.1 needs C++17. Auto-detect the flags that are needed to build.

The default C++ version depends on the version of clang:

clang 15.0.0 (macOS Sonoma)

# echo "" | clang++ -dM -E -x c++ - | grep __cplusplus
#define __cplusplus 199711L

On clang 18.1.8 (shipped with archlinux/archlinux:base):

# echo "" | clang++ -dM -E -x c++ - | grep __cplusplus
#define __cplusplus 201703L
__cplusplus string Version
199711L C++98
201103L C++11
201402L C++14
201703L C++17
202002L C++20

Relates to #172

Closes #177

clang requires manually enabling C++ extensions via
`-std=c++<version>`, and ICU 75.1 needs C++17. Auto-detect the flags
that are needed to build.

Relates to brianmario#172

Closes brianmario#177
C++ compilation failed without these explicit casts.
Now that a C++ compiler is used to support later versions of ICU, we
need to surround all C code with `extern "C"` to avoid name mangling
that would cause issues with symbol resolution on macOS.
@tenderlove tenderlove merged commit b77c32c into brianmario:master Jul 9, 2024
4 checks passed
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.

Installing 0.7.8 on macOS 14.5 (Sonoma) error.
2 participants