TLDR: How to build a ninja project with clang 18 and libstdc++13 on an arm Mac?
Hi!
I was investigating a bit regarding the usage of libstdc++ with clang on arm Macs in order to use the same "configuration" of my coworkers on linux.
Giving a bit of context. I'm using C++20 (23 in a few weeks!) staying as far away as possible from Xcode and its build system: I'm using clang 18 with its own libc++ and the ninja build system.
Given that now the GCC package in brew finally supports Arm Macs and comes with libstdc++, I've tried to compile the project I'm working on, adding those two lines in our CompilerOptions.cmake file:
add_compile_options(-stdlib=libstdc++ -I/opt/homebrew/opt/gcc/include/c++/13)
add_link_options(-Wl,-rpath,/opt/homebrew/opt/gcc/lib/gcc/13)
With this, clang return the following warnings and errors:
clang++: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] /opt/homebrew/opt/gcc/include/c++/13/bits/requires_hosted.h:31:10: fatal error: 'bits/c++config.h' file not found
31 | #include <bits/c++config.h>
The errors derives from the fact that clang does not recognise the `aarch64-apple-darwin23` directory in the headers. Linking the folder in the compile option "solve" the error:
add_compile_options(-stdlib=libstdc++ -I/opt/homebrew/opt/gcc/include/c++/13 -I/opt/homebrew/opt/gcc/include/c++/13/aarch64-apple-darwin23)
add_link_options(-Wl,-rpath,/opt/homebrew/opt/gcc/lib/gcc/13)
With this clang fails with tons of these warnings/errors:
clang++: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] .... infinite message like this: .... "vtable for llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>", referenced from: llvm::cl::opt<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>::opt<char [17], llvm::cl::desc, llvm::cl::initializer<char [1]>, llvm::cl::value_desc, llvm::cl::cat>(char const (&) [17], llvm::cl::desc const&, llvm::cl::initializer<char [1]> const&, llvm::cl::value_desc const&, llvm::cl::cat const&) in libCommandLine.a[2](CommandLine.cpp.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
What am I doing wrong? Using libstdc++ is possible in principle on an arm-based Mac?
Thank you all in advance!
c++ - Static link libstdc++ using clang - Stack Overflow
c++ - How to detect the libstdc++ version in Clang? - Stack Overflow
Which version of libc++/libstdc++ clang take to compile ?
[question] Is libstdc++11 used in Linux clang?
On Linux: In general, all commonly available linux distributions will use libstdc++ by default, and all modern versions of GCC come with a libstdc++ that supports C++11. If you want to compile c++11 code here, use one of:
g++ -std=c++11 input.cxx -o a.out(usually GNU compiler)g++ -std=gnu++11 input.cxx -o a.out
On OS X before Mavericks: g++ was actually an alias for clang++ and Apple's old version of libstdc++ was the default. You could use libc++ (which included c++11 library support) by passing -stdlib=libc++. If you want to compile c++11 code here, use one of:
g++ -std=c++11 -stdlib=libc++ input.cxx -o a.out(clang, not GNU compiler!)g++ -std=gnu++11 -stdlib=libc++ input.cxx -o a.out(clang, not GNU compiler!)clang++ -std=c++11 -stdlib=libc++ input.cxx -o a.outclang++ -std=gnu++11 -stdlib=libc++ input.cxx -o a.out
On OS X since Mavericks: libc++ is the default and you should not pass any -stdlib=<...> flag. Since Xcode 10, building against libstdc++ is not supported at all anymore. Existing code built against libstdc++ will keep working because libstdc++.6.dylib is still provided, but compiling new code against libstdc++ is not supported.
clang++ -std=c++11 input.cxx -o a.outclang++ -std=gnu++11 input.cxx -o a.out
When is it necessary to use use the flag
-stdlib=libstdc++for the compiler and linker when compiling with gcc?
Short answer: never
Longer answer: -stdlib is a Clang flag and will not work with any version of GCC ever released. On macOS sometimes the gcc and g++ commands are actually aliases for Clang not GCC, and the version of libstdc++ that Apple ships is ancient (circa 2008) so of course it doesn't support C++11. This means that on macOS when using Clang-pretending-to-be-GCC, you can use -stdlib=libc++ to select Clang's new C++11-compatible library, or you can use -stdlib=libstdc++ to select the pre-C++11 antique version of libstdc++ that belongs in a museum. But on GNU/Linux gcc and g++ really are GCC not Clang, and so the -stdlib option won't work at all.
Edit: Since I wrote this answer, GCC was changed to conditionally support the -stdlib flag, but for most platforms that support is disabled by default. Even when it's enabled, the default is -stdlib=libstdc++ so you still never need to say that explicitly. GCC will still automatically use libstdc++.
Does the compiler automatically use libstdc++?
Yes, GCC always uses libstdc++ unless you tell it to use no standard library at all with the -nostdlib or -nostdlib++ option (in which case you either need to avoid using any standard library features, or use -I and -L and -l flags to point it to an alternative set of header and library files).
I am using gcc4.8.2 on Ubuntu 13.10 and I would like to use the c++11 standard. I already pass
-std=c++11to the compiler.
You don't need to do anything else. GCC comes with its own implementation of the C++ standard library (libstdc++) which is developed and tested alongside GCC itself so the version of GCC and the version of libstdc++ are 100% compatible. If you compile with -std=c++11 then that enables the C++11 features in g++ compiler and also the C++11 features in the libstdc++ headers.
clang is compatible with gcc on this matter. Basically for hello-world program that uses iostream to ensure libstdc++ requirement (actual lib versions may vary between distributions):
$ clang++ test.cpp
$ ldd ./a.out
linux-vdso.so.1 (0x00007ffec65c0000)
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/libstdc++.so.6 (0x00007ff937bb6000)
libm.so.6 => /lib64/libm.so.6 (0x00007ff9378b6000)
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/libgcc_s.so.1 (0x00007ff93769e000)
libc.so.6 => /lib64/libc.so.6 (0x00007ff9372fe000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff937f3e000)
Here is a dependency for libstdc++ and libgcc_s. But if you add -static-libgcc -static-libstdc++:
$ clang++ test.cpp -static-libgcc -static-libstdc++
$ ldd ./a.out
linux-vdso.so.1 (0x00007ffe5d678000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb8e4516000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb8e4176000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb8e4816000)
That still leaves dependency on libc, but that is a different question.
clang: warning: argument unused during compilation: '-static-libstdc++' means clang ignored this flag, because flag is useless in current situation. First two examples that coming to mind is compiling C code (which obviously don't depend on libstdc++), or issuing compile-only command without linking (-c flag). Since .o file cannot hold information about static or dynamic linking, this flag have to be specified on linking phase (and, to avoid warning, only on linking phase).
Instead of using -static-libstdc++ or -static-libgcc, just use clang's -static flag. It will produce a non dynamic executable, with everything it needs linked in statically.
On my test program, it produces:
[root@interserver ogrerobot.com]# ldd ./CppUtilsSpikes
not a dynamic executable
Clang does come with its own standard library implementation, it's called libc++. You can use it by adding -stdlib=libc++ to your compile command.
That being said, there are various ways to check Clang/libstdc++ C++ support:
- Clang has the
__has_featuremacro (and friends) that can be used to detect language features and language extenstions. - Libstdc++ has its own version macros, see the documentation. You'll need to include a libstdc++ header to get these defined though.
- GCC has its version macros which you already discovered, but those would need to be manually compared to the documentation.
And also, this took me 2 minutes of googling.
This is what I think would help. It prints the value of the _LIBCPP_VERSION macro:
#include <iostream>
#include <string>
using namespace std;
int main(int argc, const char * argv[])
{
cout<<"Value = "<<_LIBCPP_VERSION<<endl;
return 0;
}
Compile it again the version of clang you want the info for.
I have some errors that I cannot reproduce except on my system. When I use some views from c++20, il have weird error about constraint not met about begin, sentinel and range_iter_t. I manually (not from the package manager) installed clang++16 on linux (ubuntu 22.04). On godbolt, everything works (https://godbolt.org/z/Wbbz5aEqM) .
When I type clang++ --version, it says 14.0.0. When I type clang++-16 --version, it says 16.0.5.
I also have g++12 but when I type g++ --version, it says 11.3.0.
Here is the cmake command I run:
export CC=/usr/bin/clang-16 export CXX=/usr/bin/clang++-16 export CUDACXX=/usr/local/cuda/bin/nvcc export CLAZY_IGNORE_DIRS="/usr/*" cmake -B build -S . -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_CXX_COMPILER=clazy -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake cmake --build build -j`nproc`
Is it possible that clang++-16 use an stl implmentation from clang14 or gcc11 ?
Here is the errors I get:
In file included from /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:1:
In file included from /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.h:3:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QComboBox:1:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qcombobox.h:43:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qtwidgetsglobal.h:43:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qtguiglobal.h:43:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:142:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/algorithm:60:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algobase.h:65:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_iterator_base_types.h:71:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:982:13: error: no matching function for call to '__begin'
= decltype(ranges::__cust_access::__begin(std::declval<_Tp&>()));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_base.h:595:5: note: in instantiation of template type alias '__range_iter_t' requested here
using iterator_t = std::__detail::__range_iter_t<_Tp>;
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_util.h:121:36: note: in instantiation of template type alias 'iterator_t' requested here
requires contiguous_iterator<iterator_t<_Derived>>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1098:29: note: in instantiation of template class 'std::ranges::view_interface<std::ranges::ref_view<const std::vector<BaseObject *>>>' requested here
class ref_view : public view_interface<ref_view<_Range>>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:38: note: in instantiation of template class 'std::ranges::ref_view<const std::vector<BaseObject *>>' requested here
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:38: note: in instantiation of requirement here
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:27: note: (skipping 20 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:832:9: note: while substituting template arguments into constraint expression here
= requires { std::declval<_Adaptor>()(declval<_Args>()...); };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:857:5: note: while checking the satisfaction of concept '__adaptor_invocable<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' requested here
&& __adaptor_invocable<_Self, _Range>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:857:5: note: while substituting template arguments into constraint expression here
&& __adaptor_invocable<_Self, _Range>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:13: note: while checking constraint satisfaction for template 'operator|<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' required here
| std::views::transform([](auto *object) { return object->objectName(); })
^
/home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:13: note: in instantiation of function template specialization 'std::ranges::views::__adaptor::operator|<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' requested here
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:966:7: note: candidate template ignored: constraints not satisfied [with _Tp = std::ranges::ref_view<const std::vector<BaseObject *>>]
__begin(_Tp& __t)
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:964:16: note: because 'is_array_v<std::ranges::ref_view<const std::vector<BaseObject *> > >' evaluated to false
requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:964:35: note: and 'std::ranges::ref_view<const std::vector<BaseObject *>> &' does not satisfy '__member_begin'
requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:947:23: note: because '__decay_copy(__t.begin())' would be invalid: no member named 'begin' in 'std::ranges::ref_view<const std::vector<BaseObject *>>'
{ __decay_copy(__t.begin()) } -> input_or_output_iterator;
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:964:59: note: and 'std::ranges::ref_view<const std::vector<BaseObject *>> &' does not satisfy '__adl_begin'
requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:958:19: note: because '__decay_copy(begin(__t))' would be invalid: call to deleted function 'begin'
{ __decay_copy(begin(__t)) } -> input_or_output_iterator;
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:982:13: error: no matching function for call to '__begin'
= decltype(ranges::__cust_access::__begin(std::declval<_Tp&>()));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_base.h:595:5: note: in instantiation of template type alias '__range_iter_t' requested here
using iterator_t = std::__detail::__range_iter_t<_Tp>;
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_util.h:127:25: note: in instantiation of template type alias 'iterator_t' requested here
&& contiguous_iterator<iterator_t<const _Derived>>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1098:29: note: in instantiation of template class 'std::ranges::view_interface<std::ranges::ref_view<const std::vector<BaseObject *>>>' requested here
class ref_view : public view_interface<ref_view<_Range>>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:38: note: in instantiation of template class 'std::ranges::ref_view<const std::vector<BaseObject *>>' requested here
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:38: note: in instantiation of requirement here
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:27: note: (skipping 20 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:832:9: note: while substituting template arguments into constraint expression here
= requires { std::declval<_Adaptor>()(declval<_Args>()...); };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:857:5: note: while checking the satisfaction of concept '__adaptor_invocable<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' requested here
&& __adaptor_invocable<_Self, _Range>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:857:5: note: while substituting template arguments into constraint expression here
&& __adaptor_invocable<_Self, _Range>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:13: note: while checking constraint satisfaction for template 'operator|<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' required here
| std::views::transform([](auto *object) { return object->objectName(); })
^
/home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:13: note: in instantiation of function template specialization 'std::ranges::views::__adaptor::operator|<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' requested here
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:966:7: note: candidate template ignored: constraints not satisfied [with _Tp = const std::ranges::ref_view<const std::vector<BaseObject *>>]
__begin(_Tp& __t)
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:964:16: note: because 'is_array_v<const std::ranges::ref_view<const std::vector<BaseObject *> > >' evaluated to false
requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:964:35: note: and 'const std::ranges::ref_view<const std::vector<BaseObject *>> &' does not satisfy '__member_begin'
requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:947:23: note: because '__decay_copy(__t.begin())' would be invalid: no member named 'begin' in 'std::ranges::ref_view<const std::vector<BaseObject *>>'
{ __decay_copy(__t.begin()) } -> input_or_output_iterator;
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:964:59: note: and 'const std::ranges::ref_view<const std::vector<BaseObject *>> &' does not satisfy '__adl_begin'
requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/iterator_concepts.h:958:19: note: because '__decay_copy(begin(__t))' would be invalid: call to deleted function 'begin'
{ __decay_copy(begin(__t)) } -> input_or_output_iterator;
^
In file included from /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:1:
In file included from /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.h:3:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/QComboBox:1:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qcombobox.h:43:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qtwidgetsglobal.h:43:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qtguiglobal.h:43:
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:142:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/algorithm:63:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_algo.h:36:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_util.h:133:24: error: constraints not satisfied for alias template 'sentinel_t' [with _Range = std::ranges::ref_view<const std::vector<BaseObject *>>]
&& sized_sentinel_for<sentinel_t<_Derived>, iterator_t<_Derived>>
^~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1098:29: note: in instantiation of template class 'std::ranges::view_interface<std::ranges::ref_view<const std::vector<BaseObject *>>>' requested here
class ref_view : public view_interface<ref_view<_Range>>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:38: note: in instantiation of template class 'std::ranges::ref_view<const std::vector<BaseObject *>>' requested here
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:38: note: in instantiation of requirement here
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1233:27: note: while substituting template arguments into constraint expression here
concept __can_ref_view = requires { ref_view{std::declval<_Range>()}; };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1255:7: note: while checking the satisfaction of concept '__can_ref_view<const std::vector<BaseObject *> &>' requested here
|| __detail::__can_ref_view<_Range>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:1255:17: note: (skipping 18 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
|| __detail::__can_ref_view<_Range>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:832:9: note: while substituting template arguments into constraint expression here
= requires { std::declval<_Adaptor>()(declval<_Args>()...); };
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:857:5: note: while checking the satisfaction of concept '__adaptor_invocable<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' requested here
&& __adaptor_invocable<_Self, _Range>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/ranges:857:5: note: while substituting template arguments into constraint expression here
&& __adaptor_invocable<_Self, _Range>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:13: note: while checking constraint satisfaction for template 'operator|<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' required here
| std::views::transform([](auto *object) { return object->objectName(); })
^
/home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:13: note: in instantiation of function template specialization 'std::ranges::views::__adaptor::operator|<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Transform, (lambda at /home/gitlab-runner/builds/LontYnRx/0/root/xact/shared/widgets/objectcombobox.cpp:160:37)>, const std::vector<BaseObject *> &>' requested here
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_base.h:597:12: note: because 'std::ranges::ref_view<const std::vector<BaseObject *>>' does not satisfy 'range'
template<range _Range>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/ranges_base.h:585:2: note: because 'ranges::begin(__t)' would be invalid: no matching function for call to object of type 'const __cust_access::_Begin'
ranges::begin(__t);
^Can someone elaborate on what are libc, libc++, libstdc++
-
What the difference between libc++ and libstdc++? Why can't we just use one of them for all times?
-
How to determine which versions of these libs support specific standard version? For example which version of c++ standard does libstdc++-4.6 support?
-
Can i just "copy-paste" these libs into target OS to run my project if that OS lacks newer versions of these ones available in repositories?
-
Can i just "copy-paste" all dependent `.so` files into target OS? What should i consider when "copy-pasting" libraries from my development workstation to user's one?
-
sudo apt install libstdc++-12-dev
I had this problem on Ubuntu 22.04. The gcc and g++ versions are both the same (11.3.0)
I think the broken upgrade from 20.04 to 22.04 was incomplete.
The /usr/lib/gcc/x86_64-linux-gnu directory contained a '12' directory. However most of the libraries are missing in this dir.
I simply removed the 12 directory. Now clang++ picks '11' and everything works correctly