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

fix: compilation error with libc++ #784

Merged
merged 1 commit into from
Mar 19, 2024
Merged

Conversation

ItsAlbertZhang
Copy link
Contributor

@ItsAlbertZhang ItsAlbertZhang commented Mar 19, 2024

I use Crow on Windows, MacOS, and Linux. On Windows, I compile with the MSVC compiler, while on MacOS and Linux, I use the Clang compiler. It works well.

The issue arose when migrating from my local development environment on Linux (WSL, Ubuntu Preview 24.04 daily live) to a cloud server (Debian 12). Since Debian 12 lacks the latest Clang compiler and C++ Library, I had to install libc++ as a replacement for libstdc++, which led to compilation problems. Subsequently, linking the version that ran correctly on WSL to libc++ instead of libstdc++ also resulted in the same issue.

After searching for relevant information in this repository, I found that issues #229, #481, and #636, as well as pull requests #229 and #634, might be related. After modifying json.h, my code compiled and ran successfully.

I'm unsure if _LIBCPP_VERSION would be defined under defined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) || defined(__ANDROID__), so I didn't remove the conditional checks in the original code. Instead, I added checks for _LIBCPP_VERSION directly after them. If possible, you can further investigate this.

I'm a beginner in C++, and English is not my first language, so please forgive any inaccuracies in my wording.

@gittiver gittiver self-requested a review March 19, 2024 15:58
@gittiver
Copy link
Member

Looks Ok, I will add an issue for compiling with gcc and clang as matrix build for getting these variants checked

@gittiver gittiver merged commit ad337a8 into CrowCpp:master Mar 19, 2024
6 checks passed
@ItsAlbertZhang
Copy link
Contributor Author

Looks Ok, I will add an issue for compiling with gcc and clang as matrix build for getting these variants checked

It seems more like an issue with the C++ Library rather than the compiler itself. In my case, Clang works well with libstdc++, but encounters this compilation error when working with libc++.

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.

2 participants