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

v1.3.248 fails to build with libc++ #206

Closed
jbeich opened this issue Apr 26, 2023 · 0 comments · Fixed by #207
Closed

v1.3.248 fails to build with libc++ #206

jbeich opened this issue Apr 26, 2023 · 0 comments · Fixed by #207

Comments

@jbeich
Copy link
Contributor

jbeich commented Apr 26, 2023

Regressed by 6dd7a3d. Found on FreeBSD but OpenBSD, Android, macOS, ChimeraLinux also use libc++ by default (OpenMandriva seems to use Clang with libstdc++). BSD (unlike GNU) enable extensions by default unless _POSIX_C_SOURCE or _XOPEN_SOURCE is defined. Unfortunately, libc++ uses some of the extensions without resetting POSIX conformance.

$ export CC=clang CXX=clang++ CXXFLAGS=-stdlib=libc++
$ cmake -DBUILD_TESTS=OFF -G Ninja -B _build
$ cmake --build _build
[...]
FAILED: layers/CMakeFiles/VkLayer_khronos_synchronization2.dir/synchronization2.cpp.o
/usr/bin/c++ -DVK_ENABLE_BETA_EXTENSIONS -DVkLayer_khronos_synchronization2_EXPORTS -D_POSIX_C_SOURCE=200112 -Ilayers -Iutils -Iutils/generated -isystem /usr/local/include -Wpointer-arith -Wno-unused-function -Wno-sign-compare -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fno-strict-aliasing -fno-builtin-memcmp -fvisibility=hidden -std=c++17 -MD -MT layers/CMakeFiles/VkLayer_khronos_synchronization2.dir/synchronization2.cpp.o -MF layers/CMakeFiles/VkLayer_khronos_synchronization2.dir/synchronization2.cpp.o.d -o layers/CMakeFiles/VkLayer_khronos_synchronization2.dir/synchronization2.cpp.o -c layers/synchronization2.cpp
In file included from layers/synchronization2.cpp:28:
In file included from layers/synchronization2.h:29:
In file included from utils/vk_concurrent_unordered_map.h:29:
In file included from /usr/include/c++/v1/iomanip:47:
In file included from /usr/include/c++/v1/istream:165:
In file included from /usr/include/c++/v1/ostream:171:
In file included from /usr/include/c++/v1/ios:221:
/usr/include/c++/v1/__locale:680:16: error: use of undeclared identifier 'isascii'
        return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
               ^
/usr/include/c++/v1/__locale:687:22: error: use of undeclared identifier 'isascii'
            *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
                     ^
/usr/include/c++/v1/__locale:695:17: error: use of undeclared identifier 'isascii'
            if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
                ^
/usr/include/c++/v1/__locale:704:18: error: use of undeclared identifier 'isascii'
            if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m))
                 ^
4 errors generated.

Possible fixes:

  • Convert -D_POSIX_C_SOURCE=200112 to -D_XOPEN_SOURCE=600
  • Convert -D_POSIX_C_SOURCE=200112 to -D_GNU_SOURCE
  • Make -D_POSIX_C_SOURCE=200112 local to the specific file(s)
  • Drop <iomanip> and maybe more via include-what-you-use
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 a pull request may close this issue.

1 participant