Closed smarsching closed 1 year ago
Even if we don't need C++ 17, we have to enable it. If we enabled only C++ 14, no application using ChimeraTK could be build with C++ 17. The compiler takes the lowest standard, if multiple flags are listed!
I am wondering a bit, we are testing against various boost versions on Linux and do not see this issue. Is this problem related do Mac only? In which context does it appear exactly? Did you modify something in the control system adapter?
A sorry, you mentioned clang. We test with gcc only. Maybe it is a clang issue?
This is not so much a Clang issue as a libc++ issue. When enabling C++ 17, libc++ removes std::auto_ptr
. Technically, this is correct as auto_ptr
has been removed in C++ 17 (see here). So one could argue that glibc is wrong when it still provides auto_ptr
when C++ 17 is enabled.
Anyway, if you want to C++ 17 the best workaround is adding -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
to the compiler flags. This will tell libc++ that auto_ptr
shall be provided, even though it is not part of the standard library any longer.
I just tried cppext with clang on Ubuntu 1604 (the oldest BOOST and clang we have) and on tumbleweed (newest). It compiles on both systems. Seems to be a MAC issue.
Hm, I somehow don't see the other comments, incl. smarsching proposing to add -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR on github.
@smarsching Could you please add this to the project template and try it out? I think it is a good solution until it is fixed in BOOST.
P.S. I don't know if my comment that it works with Ubuntu 1604 (oldest BOOST and clang) and tumbleweed (newest system we have) went online. It might be because g++ is the system compiler and libc++ ist compiled with it that there is no issue on Linux, while on MAC clang is the system compiler.
I think this is no longer relevant...
The
cmake/enable_latest_cxx_support.cmake
script breaks Boost because some parts of Boost still seem to usestd::auto_ptr
, but as of C++ 17 this class has been removed. It is possible that this still works with GCC / the GNU C library, but it does not work with Clang / libc++.Below is an error message that I get when compiling the Control System Adapter, but I get a similar message when compiling the cppext library. There is a bug report for the Boost libarary, but it seems like the issue has not been resolved yet.
I suggest to avoid enabling the compiler's C++ 17 support. As far as I can tell, we are not using any features from C++ 17 anyway, so I do not see a benefit in compiling with C++ 17 features enabled, but maybe I a missing a point.
If we need C++ 17, we could think about using a workaround to reenable
std::auto_ptr
.