Open devjgm opened 3 years ago
Looks like the default language version is not what I'd expect it to be:
$ cat test.cc
#include <iostream>
int main() {
std::cout << __cplusplus << "\n";
}
$ c++ -o test test.cc && ./test
199711 # <---
$ c++ -std=c++17 -o test test.cc && ./test
201703
And from man c++
The default C++ language standard is gnu++14
Huh.
Note setting -DCMAKE_CXX_STANDARD=11
on the cmake configure line seems to work.
This may be working as intended. I'm not sure. I don't understand the output of https://github.com/abseil/abseil-cpp/issues/955#issuecomment-831599980. And it would be nice if Abseil Just Worked w/ the naive cmake
invocation above without explicitly specifying the language version, but I could see an argument for WAI here. I'll leave this open in case the Abseil folks have any thoughts/comments.
I don't know if it is feasible to both get this to work with a naive cmake
invocation and still have Abseil work as intended.
If you are a programmer, due to nature of Abseil, understanding which C++ dialect is being used is pretty fundamental and needs to be a conscious choice. The C++ dialect needs to be consistently set between the libraries being compiled/linked together (unless you really know what you are doing). If the person building Abseil isn't making a conscious choice of C++ dialect, it seems to me that using the default is the only reasonable choice, since the best guess is that everything else is also being built with the default.
If you are just a user who needs to install Abseil, you might not know what a C++ dialect is. In that case, we really just want to naive cmake
invocation to work.
I don't know how to reconcile these issues.
I think you're probably right about relying on the default. I think a reasonable solution may be to just document how to build and install this on macos. The doc can say that on macOS the user needs to select the C++ language standard to use for reasons, and they can compile with something like
cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=/foo/bar -S . -B cmake-out
cmake --build cmake-out
cmake --build cmake-out --target install
Describe the bug
A CMake build of Abseil on my Mac mini M1 fails
Steps to reproduce the bug
IMPORTANT On an Apple M1 machine
cmake -S . - B cmake-out
cmake --build cmake-out
(add-- VERBOSE=1
to see the build command)What version of Abseil are you using?
HEAD=a9831f1cbf93fb18dd951453635f488037454ce9
What operating system and version are you using
What compiler and version are you using?
What build system are you using?
Additional context
This is on a Mac mini M1