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

Fails to compile with clang-15 and libc++ on linux #984

Open
kraj opened this issue Aug 31, 2022 · 2 comments
Open

Fails to compile with clang-15 and libc++ on linux #984

kraj opened this issue Aug 31, 2022 · 2 comments

Comments

@kraj
Copy link

kraj commented Aug 31, 2022

I am seeing following error

[55/64] Building CXX object tests/empty/CMakeFiles/soci_empty_test_static.dir/test-empty.cpp.o
FAILED: tests/empty/CMakeFiles/soci_empty_test_static.dir/test-empty.cpp.o
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot-native/usr/bin/x86_64-yoe-linux-musl/x86_64-yoe-linux-musl-clang++ -DBOOST_ALL_NO_LIB -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -DCATCH_CONFIG_CPP11_NO_IS_ENUM -DHAVE_DL=1 -DSOCI_ABI_VERSION=\"4.0\" -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/build -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/include -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/build/include -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/include/private -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/tests -I/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/src/core/../../include -target x86_64-yoe-linux-musl  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -ffile-compilation-dir=. -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security  --sysroot=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3=/usr/src/debug/soci/4.0.3-r0  -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3=/usr/src/debug/soci/4.0.3-r0  -fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/build=/usr/src/debug/soci/4.0.3-r0  -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/build=/usr/src/debug/soci/4.0.3-r0  -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot=  -fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot=  -fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot-native=  -fvisibility-inlines-hidden  -pedantic -Wno-error=parentheses -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Woverloaded-virtual -Wredundant-decls -Wno-long-long -std=c++11  -fvisibility=hidden -MD -MT tests/empty/CMakeFiles/soci_empty_test_static.dir/test-empty.cpp.o -MF tests/empty/CMakeFiles/soci_empty_test_static.dir/test-empty.cpp.o.d -o tests/empty/CMakeFiles/soci_empty_test_static.dir/test-empty.cpp.o -c /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/tests/empty/test-empty.cpp
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/tests/empty/test-empty.cpp:8:
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/include/soci/soci.h:12:
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/include/soci/soci-platform.h:18:
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/string:551:
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/string_view:222:
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/algorithm:1851:
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/__algorithm/ranges_sample.h:13:
In file included from /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/__algorithm/sample.h:18:
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/__random/uniform_int_distribution.h:235:5: error: static assertion failed due to requirement '__libcpp_random_is_valid_urng<Catch::RandomNumberGenerator, void>::value':
    static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/__algorithm/shuffle.h:154:35: note: in instantiation of function template specialization 'std::uniform_int_distribution<long>::operator()<Catch::RandomNumberGenerator>' requested here
            difference_type __i = __uid(__g, _Pp(0, __d));
                                  ^
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/recipe-sysroot/usr/include/c++/v1/__algorithm/shuffle.h:166:14: note: in instantiation of function template specialization 'std::__shuffle<std::_ClassicAlgPolicy, std::__wrap_iter<Catch::TestCase *>, std::__wrap_iter<Catch::TestCase *>, Catch::RandomNumberGenerator &>' requested here
  (void)std::__shuffle<_ClassicAlgPolicy>(
             ^
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/tests/catch.hpp:7186:18: note: in instantiation of function template specialization 'std::shuffle<std::__wrap_iter<Catch::TestCase *>, Catch::RandomNumberGenerator &>' requested here
            std::shuffle( vector.begin(), vector.end(), rng );
                 ^
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/soci/4.0.3-r0/soci-4.0.3/tests/catch.hpp:7204:44: note: in instantiation of function template specialization 'Catch::RandomNumberGenerator::shuffle<std::vector<Catch::TestCase>>' requested here
                    RandomNumberGenerator::shuffle( sorted );
                                           ^
1 error generated.
[57/64] Building CXX object src/core/CMakeFiles/soci_core_static.dir/soci-simple.cpp.o

it works ok when I use -std=gnu++98

@kraj
Copy link
Author

kraj commented Aug 31, 2022

As a workaround using

+++ b/cmake/SociConfig.cmake
@@ -94,6 +94,7 @@ else()
     set(SOCI_CXX11 ON)
     set(SOCI_CXX_VERSION_FLAGS "-std=c++11")
     add_definitions(-DCATCH_CONFIG_CPP11_NO_IS_ENUM)
+    add_definitions(-DCATCH_CONFIG_CPP11_NO_SHUFFLE)

     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SOCI_GCC_CLANG_COMMON_FLAGS} ${SOCI_CXX_VERSION_FLAGS}")

@vadz
Copy link
Member

vadz commented Aug 31, 2022

Thanks for the report and the workaround.

The real solution is to upgrade to a non-ancient version of CATCH which has probably fixed this already, but this won't happen in 4.0.x, so we should probably just apply this there, unless anybody sees a better solution.

vadz added a commit to vadz/soci that referenced this issue Sep 18, 2022
This results in build problems with clang 15 and libc++ (see SOCI#984) and
also with MSVC due to the use of min/max function that are defined as
macros.

This is just a temporary workaround, the real solution will be to update
our CATCH version.
vadz added a commit to vadz/soci that referenced this issue Sep 18, 2022
This results in build problems with clang 15 and libc++ (see SOCI#984) and
also with MSVC due to the use of min/max function that are defined as
macros.

This is just a temporary workaround, the real solution will be to update
our CATCH version.
vadz added a commit to vadz/soci that referenced this issue Sep 18, 2022
This results in build problems with clang 15 and libc++ (see SOCI#984) and
also with MSVC due to the use of min/max function that are defined as
macros.

This is just a temporary workaround, the real solution will be to update
our CATCH version.
vadz added a commit to vadz/soci that referenced this issue Sep 18, 2022
This results in build problems with clang 15 and libc++ (see SOCI#984) and
also with MSVC due to the use of min/max function that are defined as
macros.

This is just a temporary workaround, the real solution will be to update
our CATCH version.
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

No branches or pull requests

2 participants