FlightGear 从输出所省略的额外重寻址溢出
2020-12-27
在龙芯Fedora28上编译 FlightGear 2019.1.1 时遇到 从输出所省略的额外重寻址溢出
错误,错误信息如下:
[ 98%] Linking CXX executable fgfs
CMakeFiles/fgfs.dir/__/Scripting/NasalCanvas.cxx.o:在函数‘to_nasal_helper(Context*, osg::BoundingBoxImpl<osg::Vec3f> const&)’中:
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:90:(.text+0x238): 截断重寻址至相符: R_MIPS_CALL16 针对 _Unwind_Resume@@GCC_3.0
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:84:(.text+0x28c): 截断重寻址至相符: R_MIPS_CALL16 针对 _Unwind_Resume@@GCC_3.0
CMakeFiles/fgfs.dir/__/Scripting/NasalCanvas.cxx.o:在函数‘f_createCanvas(nasal::CallContext const&)’中:
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:127:(.text+0x4e4): 截断重寻址至相符: R_MIPS_CALL16 针对 std::allocator<char>::allocator()@@GLIBCXX_3.4
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:127:(.text+0x508): 截断重寻址至相符: R_MIPS_CALL16 针对 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:127:(.text+0x580): 截断重寻址至相符: R_MIPS_CALL16 针对 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:127:(.text+0x594): 截断重寻址至相符: R_MIPS_CALL16 针对 std::allocator<char>::~allocator()@@GLIBCXX_3.4
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:127:(.text+0x5fc): 截断重寻址至相符: R_MIPS_CALL16 针对 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:127:(.text+0x61c): 截断重寻址至相符: R_MIPS_CALL16 针对 std::allocator<char>::~allocator()@@GLIBCXX_3.4
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:127:(.text+0x634): 截断重寻址至相符: R_MIPS_CALL16 针对 _Unwind_Resume@@GCC_3.0
CMakeFiles/fgfs.dir/__/Scripting/NasalCanvas.cxx.o:在函数‘f_createWindow(nasal::CallContext const&)’中:
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:137:(.text+0x6d0): 截断重寻址至相符: R_MIPS_CALL16 针对 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()@@GLIBCXX_3.4.21
/home/loongson/下载/flightgear/flightgear-2019.1.1/src/Scripting/NasalCanvas.cxx:137:(.text+0x7a4): 从输出所省略的额外重寻址溢出
collect2: 错误:ld 返回 1
make[2]: *** [src/Main/CMakeFiles/fgfs.dir/build.make:7427:src/Main/fgfs] 错误 1
make[1]: *** [CMakeFiles/Makefile2:2133:src/Main/CMakeFiles/fgfs.dir/all] 错误 2
make: *** [Makefile:163:all] 错误 2
大佬指点后得知需要添加cxxflag -mxgot
。最终解决如下:
在 CMakeList.txt
中添加一行(我添加在了第55行):
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mxgot")
重新 cmake && make 通过。