Issue when running tests
Hey there, I just downloaded the code for polyscope. As a first starter, I wanted to run the test files
so I typed in
apt-get install xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev
since I am on an ubuntu machine and then
cd test
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j4 && ./bin/polyscope-test --gtest_catch_exceptions=0
I got the following error message:
In file included from /home/jakob/polyscope/test/src/array_adaptors_test.cpp:14: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h: In instantiation of ‘struct polyscope::InnerType<glm::vec<3, float, glm::packed_highp> >’: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:744:45: required by substitution of ‘template<class O, unsigned int D, class T, class C_RES, class C1> std::vector<T> polyscope::adaptorF_convertArrayOfVectorToStdVectorImpl(polyscope::PreferenceT<1>, const T&) [with O = glm::vec<3, float, glm::packed_highp>; unsigned int D = 3; T = std::vector<std::array<double, 3> >; C_RES = <missing>; C1 = <missing>]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:778:63: required from ‘std::vector<T> polyscope::adaptorF_convertArrayOfVectorToStdVector(const T&) [with O = glm::vec<3, float, glm::packed_highp>; unsigned int D = 3; T = std::vector<std::array<double, 3> >]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:1028:59: required from ‘std::vector<T> polyscope::standardizeVectorArray(const T&) [with O = glm::vec<3, float, glm::packed_highp>; unsigned int D = 3; T = std::vector<std::array<double, 3> >]’ /home/jakob/polyscope/test/src/array_adaptors_test.cpp:290:3: required from here /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:143:65: error: ‘this’ pointer is null [-Werror=nonnull] 143 | typedef typename std::remove_reference<decltype((*(T*)nullptr)[0])>::type type; | ~~~~~~~~~~~~~~^ In file included from /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec3.hpp:431, from /home/jakob/polyscope/src/../deps/glm/glm/./ext/vector_bool3.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/vec3.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/glm.hpp:117, from /home/jakob/polyscope/test/src/array_adaptors_test.cpp:4: /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec3.inl:168:46: note: in a call to non-static member function ‘T& glm::vec<3, T, Q>::operator[](glm::vec<3, T, Q>::length_type) [with T = float; glm::qualifier Q = glm::packed_highp; glm::vec<3, T, Q>::length_type = int]’ 168 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & vec<3, T, Q>::operator[](typename vec<3, T, Q>::length_type i) | ^~~~~~~~~~~~ In file included from /home/jakob/polyscope/test/src/array_adaptors_test.cpp:14: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h: In instantiation of ‘struct polyscope::InnerType<glm::vec<2, float, glm::packed_highp> >’: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:744:45: required by substitution of ‘template<class O, unsigned int D, class T, class C_RES, class C1> std::vector<T> polyscope::adaptorF_convertArrayOfVectorToStdVectorImpl(polyscope::PreferenceT<1>, const T&) [with O = glm::vec<2, float, glm::packed_highp>; unsigned int D = 2; T = std::vector<{anonymous}::UserVector2XY>; C_RES = <missing>; C1 = <missing>]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:778:63: required from ‘std::vector<T> polyscope::adaptorF_convertArrayOfVectorToStdVector(const T&) [with O = glm::vec<2, float, glm::packed_highp>; unsigned int D = 2; T = std::vector<{anonymous}::UserVector2XY>]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:1028:59: required from ‘std::vector<T> polyscope::standardizeVectorArray(const T&) [with O = glm::vec<2, float, glm::packed_highp>; unsigned int D = 2; T = std::vector<{anonymous}::UserVector2XY>]’ /home/jakob/polyscope/test/src/array_adaptors_test.cpp:298:3: required from here /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:143:65: error: ‘this’ pointer is null [-Werror=nonnull] 143 | typedef typename std::remove_reference<decltype((*(T*)nullptr)[0])>::type type; | ~~~~~~~~~~~~~~^ In file included from /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec2.hpp:398, from /home/jakob/polyscope/src/../deps/glm/glm/./ext/vector_bool2.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/vec2.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/glm.hpp:116, from /home/jakob/polyscope/test/src/array_adaptors_test.cpp:4: /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec2.inl:104:46: note: in a call to non-static member function ‘T& glm::vec<2, T, Q>::operator[](glm::vec<2, T, Q>::length_type) [with T = float; glm::qualifier Q = glm::packed_highp; glm::vec<2, T, Q>::length_type = int]’ 104 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & vec<2, T, Q>::operator[](typename vec<2, T, Q>::length_type i) | ^~~~~~~~~~~~ In file included from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:9, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h: In instantiation of ‘struct polyscope::InnerType<glm::vec<3, float, glm::packed_highp> >’: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:744:45: required by substitution of ‘template<class O, unsigned int D, class T, class C_RES, class C1> std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVectorImpl(polyscope::PreferenceT<1>, const T&) [with O = glm::vec<3, float, glm::packed_highp>; unsigned int D = 3; T = std::vector<glm::vec<3, float, glm::packed_highp> >; C_RES = <missing>; C1 = <missing>]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:778:63: required from ‘std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVector(const T&) [with O = glm::vec<3, float, glm::packed_highp>; unsigned int D = 3; T = std::vector<glm::vec<3, float, glm::packed_highp> >]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:1028:59: required from ‘std::vector<_RealType> polyscope::standardizeVectorArray(const T&) [with O = glm::vec<3, float, glm::packed_highp>; unsigned int D = 3; T = std::vector<glm::vec<3, float, glm::packed_highp> >]’ /home/jakob/polyscope/src/../include/polyscope/point_cloud.ipp:10:76: required from ‘polyscope::PointCloud* polyscope::registerPointCloud(std::string, const T&) [with T = std::vector<glm::vec<3, float, glm::packed_highp> >; std::string = std::__cxx11::basic_string<char>]’ /home/jakob/polyscope/test/src/basics_test.cpp:87:66: required from here /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:143:65: error: ‘this’ pointer is null [-Werror=nonnull] 143 | typedef typename std::remove_reference<decltype((*(T*)nullptr)[0])>::type type; | ~~~~~~~~~~~~~~^ In file included from /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec3.hpp:431, from /home/jakob/polyscope/src/../deps/glm/glm/./ext/vector_bool3.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/vec3.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/glm.hpp:117, from /home/jakob/polyscope/src/../include/polyscope/utilities.h:16, from /home/jakob/polyscope/src/../include/polyscope/color_management.h:4, from /home/jakob/polyscope/src/../include/polyscope/render/color_maps.h:6, from /home/jakob/polyscope/src/../include/polyscope/affine_remapper.h:4, from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:4, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec3.inl:168:46: note: in a call to non-static member function ‘T& glm::vec<3, T, Q>::operator[](glm::vec<3, T, Q>::length_type) [with T = float; glm::qualifier Q = glm::packed_highp; glm::vec<3, T, Q>::length_type = int]’ 168 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & vec<3, T, Q>::operator[](typename vec<3, T, Q>::length_type i) | ^~~~~~~~~~~~ In file included from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:9, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h: In instantiation of ‘struct polyscope::InnerType<glm::vec<2, float, glm::packed_highp> >’: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:744:45: required by substitution of ‘template<class O, unsigned int D, class T, class C_RES, class C1> std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVectorImpl(polyscope::PreferenceT<1>, const T&) [with O = glm::vec<2, float, glm::packed_highp>; unsigned int D = 2; T = std::vector<glm::vec<2, float, glm::packed_highp> >; C_RES = <missing>; C1 = <missing>]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:778:63: required from ‘std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVector(const T&) [with O = glm::vec<2, float, glm::packed_highp>; unsigned int D = 2; T = std::vector<glm::vec<2, float, glm::packed_highp> >]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:1028:59: required from ‘std::vector<_RealType> polyscope::standardizeVectorArray(const T&) [with O = glm::vec<2, float, glm::packed_highp>; unsigned int D = 2; T = std::vector<glm::vec<2, float, glm::packed_highp> >]’ /home/jakob/polyscope/src/../include/polyscope/point_cloud.ipp:82:84: required from ‘polyscope::PointCloudParameterizationQuantity* polyscope::PointCloud::addParameterizationQuantity(std::string, const T&, polyscope::ParamCoordsType) [with T = std::vector<glm::vec<2, float, glm::packed_highp> >; std::string = std::__cxx11::basic_string<char>]’ /home/jakob/polyscope/test/src/basics_test.cpp:172:50: required from here /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:143:65: error: ‘this’ pointer is null [-Werror=nonnull] 143 | typedef typename std::remove_reference<decltype((*(T*)nullptr)[0])>::type type; | ~~~~~~~~~~~~~~^ In file included from /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec2.hpp:398, from /home/jakob/polyscope/src/../deps/glm/glm/./ext/vector_bool2.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/vec2.hpp:5, from /home/jakob/polyscope/src/../deps/glm/glm/glm.hpp:116, from /home/jakob/polyscope/src/../include/polyscope/utilities.h:16, from /home/jakob/polyscope/src/../include/polyscope/color_management.h:4, from /home/jakob/polyscope/src/../include/polyscope/render/color_maps.h:6, from /home/jakob/polyscope/src/../include/polyscope/affine_remapper.h:4, from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:4, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /home/jakob/polyscope/src/../deps/glm/glm/./ext/../detail/type_vec2.inl:104:46: note: in a call to non-static member function ‘T& glm::vec<2, T, Q>::operator[](glm::vec<2, T, Q>::length_type) [with T = float; glm::qualifier Q = glm::packed_highp; glm::vec<2, T, Q>::length_type = int]’ 104 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR T & vec<2, T, Q>::operator[](typename vec<2, T, Q>::length_type i) | ^~~~~~~~~~~~ In file included from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:9, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h: In instantiation of ‘struct polyscope::InnerType<std::array<long unsigned int, 2> >’: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:744:45: required by substitution of ‘template<class O, unsigned int D, class T, class C_RES, class C1> std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVectorImpl(polyscope::PreferenceT<1>, const T&) [with O = std::array<long unsigned int, 2>; unsigned int D = 2; T = std::vector<std::array<long unsigned int, 2> >; C_RES = <missing>; C1 = <missing>]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:778:63: required from ‘std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVector(const T&) [with O = std::array<long unsigned int, 2>; unsigned int D = 2; T = std::vector<std::array<long unsigned int, 2> >]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:1028:59: required from ‘std::vector<_RealType> polyscope::standardizeVectorArray(const T&) [with O = std::array<long unsigned int, 2>; unsigned int D = 2; T = std::vector<std::array<long unsigned int, 2> >]’ /home/jakob/polyscope/src/../include/polyscope/surface_mesh.ipp:298:86: required from ‘polyscope::SurfaceGraphQuantity* polyscope::SurfaceMesh::addSurfaceGraphQuantity(std::string, const P&, const E&) [with P = std::vector<glm::vec<3, float, glm::packed_highp> >; E = std::vector<std::array<long unsigned int, 2> >; std::string = std::__cxx11::basic_string<char>]’ /home/jakob/polyscope/test/src/basics_test.cpp:559:44: required from here /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:143:65: error: ‘this’ pointer is null [-Werror=nonnull] 143 | typedef typename std::remove_reference<decltype((*(T*)nullptr)[0])>::type type; | ~~~~~~~~~~~~~~^ In file included from /usr/include/c++/11/tuple:39, from /usr/include/c++/11/bits/unique_ptr.h:37, from /usr/include/c++/11/bits/locale_conv.h:41, from /usr/include/c++/11/locale:43, from /usr/include/c++/11/iomanip:43, from /home/jakob/polyscope/src/../include/polyscope/utilities.h:7, from /home/jakob/polyscope/src/../include/polyscope/color_management.h:4, from /home/jakob/polyscope/src/../include/polyscope/render/color_maps.h:6, from /home/jakob/polyscope/src/../include/polyscope/affine_remapper.h:4, from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:4, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /usr/include/c++/11/array:186:7: note: in a call to non-static member function ‘std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = long unsigned int; long unsigned int _Nm = 2; std::array<_Tp, _Nm>::reference = long unsigned int&; std::array<_Tp, _Nm>::size_type = long unsigned int]’ 186 | operator[](size_type __n) noexcept | ^~~~~~~~ In file included from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:9, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h: In instantiation of ‘struct polyscope::InnerType<std::array<long int, 8> >’: /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:744:45: required by substitution of ‘template<class O, unsigned int D, class T, class C_RES, class C1> std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVectorImpl(polyscope::PreferenceT<1>, const T&) [with O = std::array<long int, 8>; unsigned int D = 4; T = std::vector<std::array<long unsigned int, 4> >; C_RES = <missing>; C1 = <missing>]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:778:63: required from ‘std::vector<_RealType> polyscope::adaptorF_convertArrayOfVectorToStdVector(const T&) [with O = std::array<long int, 8>; unsigned int D = 4; T = std::vector<std::array<long unsigned int, 4> >]’ /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:1028:59: required from ‘std::vector<_RealType> polyscope::standardizeVectorArray(const T&) [with O = std::array<long int, 8>; unsigned int D = 4; T = std::vector<std::array<long unsigned int, 4> >]’ /home/jakob/polyscope/src/../include/polyscope/volume_mesh.ipp:10:101: required from ‘polyscope::VolumeMesh* polyscope::registerTetMesh(std::string, const V&, const C&) [with V = std::vector<glm::vec<3, float, glm::packed_highp> >; C = std::vector<std::array<long unsigned int, 4> >; std::string = std::__cxx11::basic_string<char>]’ /home/jakob/polyscope/test/src/basics_test.cpp:740:29: required from here /home/jakob/polyscope/src/../include/polyscope/standardize_data_array.h:143:65: error: ‘this’ pointer is null [-Werror=nonnull] 143 | typedef typename std::remove_reference<decltype((*(T*)nullptr)[0])>::type type; | ~~~~~~~~~~~~~~^ In file included from /usr/include/c++/11/tuple:39, from /usr/include/c++/11/bits/unique_ptr.h:37, from /usr/include/c++/11/bits/locale_conv.h:41, from /usr/include/c++/11/locale:43, from /usr/include/c++/11/iomanip:43, from /home/jakob/polyscope/src/../include/polyscope/utilities.h:7, from /home/jakob/polyscope/src/../include/polyscope/color_management.h:4, from /home/jakob/polyscope/src/../include/polyscope/render/color_maps.h:6, from /home/jakob/polyscope/src/../include/polyscope/affine_remapper.h:4, from /home/jakob/polyscope/src/../include/polyscope/curve_network.h:4, from /home/jakob/polyscope/test/src/basics_test.cpp:4: /usr/include/c++/11/array:186:7: note: in a call to non-static member function ‘std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](std::array<_Tp, _Nm>::size_type) [with _Tp = long int; long unsigned int _Nm = 8; std::array<_Tp, _Nm>::reference = long int&; std::array<_Tp, _Nm>::size_type = long unsigned int]’ 186 | operator[](size_type __n) noexcept | ^~~~~~~~ cc1plus: note: unrecognized command-line option ‘-Wno-unused-private-field’ may have been intended to silence earlier diagnostics cc1plus: all warnings being treated as errors make[2]: *** [CMakeFiles/polyscope-test.dir/build.make:90: CMakeFiles/polyscope-test.dir/src/array_adaptors_test.cpp.o] Fehler 1 make[2]: *** Auf noch nicht beendete Prozesse wird gewartet … cc1plus: note: unrecognized command-line option ‘-Wno-unused-private-field’ may have been intended to silence earlier diagnostics cc1plus: all warnings being treated as errors make[2]: *** [CMakeFiles/polyscope-test.dir/build.make:104: CMakeFiles/polyscope-test.dir/src/basics_test.cpp.o] Fehler 1 make[1]: *** [CMakeFiles/Makefile2:291: CMakeFiles/polyscope-test.dir/all] Fehler 2 make: *** [Makefile:146: all] Fehler 2
Any idea, what the problem could be there ?,
My system is Ubuntu 22.04
Could this effect the functionality of the library ?
And how can I fox this ?
Hi!
Thank you for pointing this out. This must be a new warning getting checked in some compiler version. It's actually just a warning, but since the tests compile with -Werror the warning gets treated as an error. I suspect if you remove that -Werror build flag everything will work just fine :) There is almost certainly no problem with the library here.
The issue is some funky expressions like (*(T*)nullptr) that appear deep in our template code to generically construct an object of the desired type for the sake of evaluating a template parameter... there is some more proper C++-builtin way to do this, but I can't recall what it is right now. I will have to come back to this to fix it.
Werror flags should be gone, and the (*(T*)nullptr) pattern is removed too.