smealum / SPACECRAFT

SPACECRAFT
53 stars 2 forks source link

Compilation error #9

Open muridaerattus opened 6 months ago

muridaerattus commented 6 months ago
Scanning dependencies of target spacecraft
[  2%] Building CXX object CMakeFiles/spacecraft.dir/src/Application.cpp.o
In file included from /home/muridaerattus/SPACECRAFT/extlibs/headers/glm/detail/func_packing.hpp:193,
                 from /home/muridaerattus/SPACECRAFT/extlibs/headers/glm/packing.hpp:32,
                 from /home/muridaerattus/SPACECRAFT/extlibs/headers/glm/glm.hpp:111,
                 from /home/muridaerattus/SPACECRAFT/src/utils/glm.h:2,
                 from /home/muridaerattus/SPACECRAFT/src/render/Shader.h:13,
                 from /home/muridaerattus/SPACECRAFT/src/render/Camera.h:4,
                 from /home/muridaerattus/SPACECRAFT/src/Application.h:14,
                 from /home/muridaerattus/SPACECRAFT/src/Application.cpp:2:
/home/muridaerattus/SPACECRAFT/extlibs/headers/glm/detail/func_packing.inl: In function ‘glm::uint glm::packUnorm2x16(const vec2&)’:
/home/muridaerattus/SPACECRAFT/extlibs/headers/glm/detail/func_packing.inl:41:35: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   41 |    return reinterpret_cast<uint&>(Topack);
      |                                   ^~~~~~
/home/muridaerattus/SPACECRAFT/extlibs/headers/glm/detail/func_packing.inl: In function ‘glm::uint glm::packSnorm2x16(const vec2&)’:
/home/muridaerattus/SPACECRAFT/extlibs/headers/glm/detail/func_packing.inl:53:37: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   53 |    return reinterpret_cast<uint32&>(Topack);
      |                                     ^~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [CMakeFiles/spacecraft.dir/build.make:82: CMakeFiles/spacecraft.dir/src/Application.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:123: CMakeFiles/spacecraft.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:103: CMakeFiles/run.dir/rule] Error 2
make: *** [Makefile:137: run] Error 2

Compiled in release mode on Linux (Crostini, ChromeOS's virtualized Debian 11).

muridaerattus commented 6 months ago

Removing -wError ignores the above error, but after compilation, gives a very long list of lines akin to

/usr/bin/ld: CMakeFiles/spacecraft.dir/src/Application.cpp.o: relocation R_X86_64_32S against symbol `_Z9shaderMapB5cxx11' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: CMakeFiles/spacecraft.dir/src/Chunk.cpp.o: relocation R_X86_64_32 against symbol `_ZZN9SingletonI11TileTextureE11getInstanceEvE1I' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: CMakeFiles/spacecraft.dir/src/MiniWorld.cpp.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE

when linking the executable. Adding -fPIE does not change this message.