2020-12-27函數
在龍芯Fedora28上編譯 FlightGear 2019.1.1 時遇到 從輸出所省略的額外重尋址溢出
錯誤,錯誤信息以下:ui
[ 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
。最終解決以下:code
在 CMakeList.txt
中添加一行(我添加在了第55行):ip
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mxgot")
從新 cmake && make 經過。string