I downloaded the master for mapbox-gl-native, installed needed dependencies, followed instructions, then tried to build with "cmake --build build" but I get a lot of errors.
$ cmake . -B build
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- The C compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring GL-Native with OpenGL renderer backend
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Checking for one of the modules 'glfw3'
-- Not building node bindings, dependencies not found. Run 'npm update'.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/imac/Work/GitHub/mapbox-gl-native/build
$ cmake --build build
...
[ 8%] Building CXX object CMakeFiles/mbgl-core.dir/src/mbgl/layermanager/circle_layer_factory.cpp.o
In file included from /Users/imac/Work/GitHub/mapbox-gl-native/src/mbgl/layermanager/circle_layer_factory.cpp:1:
In file included from /Users/imac/Work/GitHub/mapbox-gl-native/include/mbgl/layermanager/circle_layer_factory.hpp:3:
In file included from /Users/imac/Work/GitHub/mapbox-gl-native/include/mbgl/layermanager/layer_factory.hpp:3:
In file included from /Users/imac/Work/GitHub/mapbox-gl-native/include/mbgl/style/layer.hpp:3:
In file included from /Users/imac/Work/GitHub/mapbox-gl-native/include/mbgl/style/conversion.hpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:57:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:642:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:199:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tuple:283:5: error: static_assert failed due to
requirement '0UL < sizeof...(_Types)' "tuple_element index out of range"
static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
^ ~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tuple:457:43: note: in instantiation of template class
'std::__1::tuple_element<0, std::__1::__tuple_types<> >' requested here
typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:1007:10: note: in instantiation of template class
'std::__1::tuple_element<0, std::__1::tuple<> >' requested here
typename tuple_element<_Ip, tuple<_Tp...> >::type&
^
/Users/imac/Work/GitHub/mapbox-gl-native/include/mbgl/util/indexed_tuple.hpp:38:16: note: while substituting deduced template arguments into function template 'get'
[with _Ip = 0, _Tp = <>]
return std::get
/Users/imac/Work/GitHub/mapbox-gl-native/src/mbgl/layout/circle_layout.hpp:20:59: note: in instantiation of function template specialization
'mbgl::IndexedTuple
requested here
const bool sortFeaturesByKey = !unevaluatedLayout.get
^
NOTE: this is the first error there are many others (most of them " error: no matching function for call to 'get'")
Mapbox SDK versions:mapbox-gl-native master
iOS/macOS versions:iOS 14.0.1/macOS 10.15.7
Device/simulator models:
Xcode version:Version 12.0.1 (12A7300)
This is the result for: "gcc --version"
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
NOTE: I have an older version of mapbox environment (July 2019) that was perfectly compiling with XCode (compiling inside XCode) but as soon as I installed XCode 12 I started to have the same error.
Same. Latest command line tools won't build it anymore.
I managed to prevent this kind of errors by changing the two lines:
https://github.com/mapbox/mapbox-gl-native/blob/b8edc2399b9640498ccbbbb5b8f058c63d070933/include/mbgl/util/indexed_tuple.hpp#L33
https://github.com/mapbox/mapbox-gl-native/blob/b8edc2399b9640498ccbbbb5b8f058c63d070933/include/mbgl/util/indexed_tuple.hpp#L38
to:
return std::get<TypeIndex<I, Is...>::value>(*this);
@ystsoi I confirm it compiles but is this a "valid" change? I'm not expert at all in Templates, so I cannot understand if this change impact somehow the mapbox behaviour.
On my side even with the change above it does not compile:
/Users/projects/mapbox-gl-native/src/mbgl/style/expression/within.cpp:42:25: error: loop variable 'p' of type
'const mapbox::geometry::point<double>' creates a copy from type 'const mapbox::geometry::point<double>'
[-Werror,-Wrange-loop-analysis]
for (const auto p : ring) {
^
/Users/projects/mapbox-gl-native/src/mbgl/style/expression/within.cpp:42:14: note: use reference type 'const
mapbox::geometry::point<double> &' to prevent copying
for (const auto p : ring) {
^~~~~~~~~~~~~~
&
1 error generated.
@cbo1964 I am not an expert too, so better to test fully before deployment. I suppose that those lines intend to get an element from a tuple. And from the example in https://en.cppreference.com/w/cpp/utility/tuple/get , it seems that we can simply get an element by an index, like std::get<0>(t), instead of std::get<0, int, const char*, double>(t).
@Adraesh That kind of errors can be prevented by changing "const auto p" to "const auto& p".
@ystsoi working thank you!
I think this is a bug of clang with Xcode, and @ystsoi solution is correct.
and I got another way to compile through:
return std::get<TypeIndex<I, Is...>::value, Ts...>(((std::tuple<Ts...> &))*this);
Sentry issue: DOCS-FEEDBACK-2RM
ref https://docs.mapbox.com/ios/maps/guides/install/
DOesn't address xcode 12 issues
Most helpful comment
I managed to prevent this kind of errors by changing the two lines:
https://github.com/mapbox/mapbox-gl-native/blob/b8edc2399b9640498ccbbbb5b8f058c63d070933/include/mbgl/util/indexed_tuple.hpp#L33
https://github.com/mapbox/mapbox-gl-native/blob/b8edc2399b9640498ccbbbb5b8f058c63d070933/include/mbgl/util/indexed_tuple.hpp#L38
to:
return std::get<TypeIndex<I, Is...>::value>(*this);