Repository: assimp/assimp

Issue #5145: Bug: Can't build on latest arch linux
Created: 2023-06-19T06:36:46Z
Describe the bug
Can't build on latest arch linux after updating my system I just couldn't build it also several other libraries too .. not sure if it's arch or assimp .. any ways tested it with the latest arch:base-devel docker image and it doesn't compile .. it give this error message :
FAILED: code/CMakeFiles/assimp.dir/AssetLib/FBX/FBXAnimation.cpp.o
/usr/bin/c++ -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_M3D_EXPORTER -DASSIMP_BUILD_NO_M3D_IMPORTER -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0 -DOPENDDLPARSER_BUILD -DRAPIDJSON_HAS_STDSTRING=1 -DRAPIDJSON_NOMEMBERITERATORCLASS -Dassimp_EXPORTS -I/home/thegeeko/repos/assimp/build/include -I/home/thegeeko/repos/assimp/build -I/home/thegeeko/repos/assimp/include -I/home/thegeeko/repos/assimp/code -I/home/thegeeko/repos/assimp/. -I/home/thegeeko/repos/assimp/contrib/zlib -I/home/thegeeko/repos/assimp/build/contrib/zlib -I/home/thegeeko/repos/assimp/code/../contrib/pugixml/src -I/home/thegeeko/repos/assimp/code/../contrib/rapidjson/include -I/home/thegeeko/repos/assimp/code/../contrib -I/home/thegeeko/repos/assimp/code/../contrib/unzip -I/home/thegeeko/repos/assimp/code/../contrib/openddlparser/include -I/home/thegeeko/repos/assimp/code/../include -I/home/thegeeko/repos/assimp/build/code/../include -I/home/thegeeko/repos/assimp/code/.. -fvisibility=hidden -fno-strict-aliasing -Wall  -std=gnu++17 -fPIC -Wall -Werror -MD -MT code/CMakeFiles/assimp.dir/AssetLib/FBX/FBXAnimation.cpp.o -MF code/CMakeFiles/assimp.dir/AssetLib/FBX/FBXAnimation.cpp.o.d -o code/CMakeFiles/assimp.dir/AssetLib/FBX/FBXAnimation.cpp.o -c /home/thegeeko/repos/assimp/code/AssetLib/FBX/FBXAnimation.cpp
/home/thegeeko/repos/assimp/code/AssetLib/FBX/FBXAnimation.cpp: In constructor ‘Assimp::FBX::AnimationCurve::AnimationCurve(uint64_t, const Assimp::FBX::Element&, const std::string&, const Assimp::FBX::Document&)’:
/home/thegeeko/repos/assimp/code/AssetLib/FBX/FBXAnimation.cpp:63:20: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
   63 |     const Element &KeyTime = GetRequiredElement(sc, "KeyTime");
      |                    ^~~~~~~
/home/thegeeko/repos/assimp/code/AssetLib/FBX/FBXAnimation.cpp:63:48: note: the temporary was destroyed at the end of the full expression ‘Assimp::FBX::GetRequiredElement((* & sc), std::__cxx11::basic_string<char>(((const char*)"KeyTime"), std::allocator<char>()), 0)’
   63 |     const Element &KeyTime = GetRequiredElement(sc, "KeyTime");
      |                              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/home/thegeeko/repos/assimp/code/AssetLib/FBX/FBXAnimation.cpp:64:20: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
   64 |     const Element &KeyValueFloat = GetRequiredElement(sc, "KeyValueFloat");
      |                    ^~~~~~~~~~~~~
/home/thegeeko/repos/assimp/code/AssetLib/FBX/FBXAnimation.cpp:64:54: note: the temporary was destroyed at the end of the full expression ‘Assimp::FBX::GetRequiredElement((* & sc), std::__cxx11::basic_string<char>(((const char*)"KeyValueFloat"), std::allocator<char>()), 0)’
   64 |     const Element &KeyValueFloat = GetRequiredElement(sc, "KeyValueFloat");
      |                                    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

To Reproduce
Steps to reproduce the behavior:

docker pull archlinux:base-devel
docker run -i -t archlinux:base-devel /bin/bash
git clone --depth 1 https://github.com/assimp/assimp.git
mkdir build && cd build && cmake .. && make

Platform (please complete the following information):

OS: Linux 6.3.8-arch1-1 SMP PREEMPT_DYNAMIC +0000 x86_64 GNU/Linux
Version master

Duplicate issue #5264: Bug: "error: possibly dangling reference to a temporary [-Werror=dangling-reference]"
Created: 2023-10-04T02:40:47Z
Hi, I am trying to install Assimp for Code::Blocks using MinGW-w64 so that I may learn the ins and outs of OpenGL, however, upon trying to build the program after generating the necessary files with CMake I receive a number of warnings (displayed as errors as a result of the CMake configuration) that mention the possibility of dangling references in the FBXParser.cpp implementation file. I have tried unchecking the configuration flag in CMake to allow building without these warnings being treated as errors but it seems that I do not have the necessary header files in the include folder.
To reproduce this behavior simply configure and generate the necessary Assimp files using CMake then attempt building the project file in Code::Blocks with "all" selected as the build target.
Expected behavior: a properly built library with necessary header files and linked libraries (.dlls -- these seem to have been built correctly).
Screenshots
If applicable, add screenshots to help explain your problem.
Platform (please complete the following information):
Windows 11
Code::Blocks svn 13344
MinGW w64 (g++ 13.1.0)
CMake 3.26.3
||=== Build: all in Assimp (compiler: GNU GCC MinGW64 Compiler) ===|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector<aiVector3t >&, const Element&)':|
FBXParser.cpp|675|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|675|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector<aiColor4t >&, const Element&)':|
FBXParser.cpp|755|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|755|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector<aiVector2t >&, const Element&)':|
FBXParser.cpp|834|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|834|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector&, const Element&)':|
FBXParser.cpp|900|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|900|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector&, const Element&)':|
FBXParser.cpp|965|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|965|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector&, const Element&)':|
FBXParser.cpp|1028|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|1028|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector&, const Element&)':|
FBXParser.cpp|1092|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|1092|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
FBXParser.cpp||In function 'void Assimp::FBX::ParseVectorDataArray(std::vector&, const Element&)':|
FBXParser.cpp|1153|error: possibly dangling reference to a temporary [-Werror=dangling-reference]|
FBXParser.cpp|1153|note: the temporary was destroyed at the end of the full expression 'Assimp::FBX::GetRequiredElement((* & scope), std::__cxx11::basic_string(((const char*)"a"), std::allocator()), (& el))'|
build.make|2211|code/CMakeFiles/assimp.dir/AssetLib/FBX/FBXParser.cpp.obj] Error 1|
Makefile2|203|code/CMakeFiles/assimp.dir/all] Error 2|
[C:\Users\User\Desktop\assimp-master\build\Makefile|135|all] Error 2|
||=== Build failed: 11 error(s), 0 warning(s) (0 minute(s), 23 second(s)) ===|

Closing comment (2023-10-04T12:02:43Z): Duplicate of #5145 #5196