GLM causing build failures

For code related discussions and questions
Post Reply
samuraicrow
Greenhorn
Posts: 10
Joined: 15 Sep 2015, 17:50

GLM causing build failures

Post by samuraicrow » 01 Oct 2018, 00:59

Greetings!

Does someone here know how to specify the C++ version used by the build? GLM's own test code fails to build under C++14 but builds under C++11. I'm building on an ARM7-based octa-core computer (ODroid XU4) using GCC version 7.3.0 on an Ubuntu Kernel build of Armbian Linux.

Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3755
Joined: 03 Aug 2006, 19:39

Re: GLM causing build failures

Post by Per » 01 Oct 2018, 07:18

Both cmake and autoconf build systems should set the c++ version to c++11 already. What are the build failure messages you see?

samuraicrow
Greenhorn
Posts: 10
Joined: 15 Sep 2015, 17:50

Re: GLM causing build failures

Post by samuraicrow » 01 Oct 2018, 10:23

This one is pretty common:

Code: Select all

/usr/bin/c++  -DHAVE_CONFIG_H -DQT_CORE_LIB -DQT_NO_DEBUG -DUTF8PROC_STATIC -DYY_NO_UNISTD_H -I. -I../. -I../3rdparty -I../3rdparty/glm -I../3rdparty/miniupnp -isystem /usr/include/arm-linux-gnueabihf/qt5 -isystem /usr/include/arm-linux-gnueabihf/qt5/QtCore -isystem /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I../3rdparty/micro-ecc/.. -I../3rdparty/sha2/.. -fstack-protector-strong  -Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual -Winit-self -Wnoexcept -Woverloaded-virtual -Wstrict-null-sentinel -Wwrite-strings -Wpointer-arith -Wmissing-noreturn -Wnon-virtual-dtor -Wnull-dereference -Wduplicated-cond -Walloc-zero -Walloca-larger-than=1024 -Wrestrict -Wfloat-conversion -Werror -Wno-logical-op -Wno-float-conversion -Wno-sign-compare -Wno-format-security -Wno-unused-parameter -Wno-format-truncation -O2 -g -DNDEBUG -fPIC   -fPIC -std=gnu++11 -MD -MT lib/framework/CMakeFiles/framework.dir/geometry.cpp.o -MF lib/framework/CMakeFiles/framework.dir/geometry.cpp.o.d -o lib/framework/CMakeFiles/framework.dir/geometry.cpp.o -c ../lib/framework/geometry.cpp
In file included from ../3rdparty/glm/glm/detail/type_vec2.hpp:9:0,
                 from ../3rdparty/glm/glm/vec2.hpp:8,
                 from ../lib/framework/vector.h:33,
                 from ../lib/framework/geometry.h:24,
                 from ../lib/framework/geometry.cpp:1:
../3rdparty/glm/glm/detail/_swizzle.hpp: In instantiation of ‘const T& glm::detail::_swizzle_base0<T, N>::elem(std::size_t) const [with T = int; int N = 2; std::size_t = unsigned int]’:
../3rdparty/glm/glm/detail/_swizzle.hpp:31:65:   required from ‘glm::vec<2, T, Q> glm::detail::_swizzle_base1<2, T, Q, E0, E1, -1, -2, Aligned>::operator()() const [with T = int; glm::qualifier Q = (glm::qualifier)0; int E0 = 0; int E1 = 1; bool Aligned = false]’
../3rdparty/glm/glm/detail/_swizzle.hpp:156:69:   required from ‘glm::detail::_swizzle<N, T, Q, E0, E1, E2, E3>::operator glm::vec<N, T, Q>() const [with int N = 2; T = int; glm::qualifier Q = (glm::qualifier)0; int E0 = 0; int E1 = 1; int E2 = -1; int E3 = -2]’
../lib/framework/vector.h:118:35:   required from here
../3rdparty/glm/glm/detail/_swizzle.hpp:15:61: error: cast from ‘const char*’ to ‘const int*’ increases required alignment of target type [-Werror=cast-align]
   GLM_FUNC_QUALIFIER T const& elem(size_t i) const{ return (reinterpret_cast<const T*>(_buffer))[i]; }
                                                            ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
Changing line 20 from char _buffer[1]; to int _buffer[1]; in glm/detail/_swizzle.hpp seemed to fix those 5 errors. Now I'm showing others.

Post Reply