-
-
Notifications
You must be signed in to change notification settings - Fork 448
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
Project cannot be built with both recent gcc and clang #21
Comments
mold is written in C++20. You need a very recent version of clang or gcc as well as libstdc++. I'm using Ubuntu 20 right now, and even though I don't remember what packages I installed, I could set up a build env only with apt-get. |
I tried by changing CXX and CC at the top of the Makefile to btw, if the top of the makefile was: CC?=clang
CXX?=clang++ instead of CC=clang
CXX=clang++ Then CC and CXX would be respected when running |
When using the (begin, end) constructor for string, the types of begin and end must match, including cv qualifiers. Depending on the library headers used, strstr(const char *, const char*) can potentially return char * or const char *, the former being a call to the C function strstr and the latter being a call to C++ std::strstr. This commit fixes the clang portion of issue rui314#21, by explicitly casting the return value of strstr to match the 1st param of the string ctor so that the ctor can be instantiated regardless of the header used.
When using the (begin, end) constructor for string, the types of begin and end must match, including cv qualifiers. Depending on the library headers used, strstr(const char *, const char *) can potentially return char * or const char *, the former being a call to the C function strstr and the latter being a call to C++ std::strstr. This commit fixes the clang portion of issue rui314#21, by explicitly casting the return value of strstr to match the 1st param of the string ctor so that the ctor can be instantiated regardless of the header used. Signed-off-by: Jim Ye <gjimye@gmail.com>
I believe mold can now be built both with clang and with gcc. |
I cannot build this project with both gcc and clang on latest commit as this time: 6630781.
I'm happy to answer more questions about my build environment if that helps.
Expected Behavior
Build shall pass.
Current Behavior
Build fails.
With clang:
With gcc by changing CC and CXX in makefile.
Context (Environment)
The text was updated successfully, but these errors were encountered: