C++ 针对raspberry pi 3模型B的交叉编译libtorrent
我一直在尝试交叉编译用于编译的raspberry pi。我正在使用以下C++ 针对raspberry pi 3模型B的交叉编译libtorrent,c++,boost,libtorrent,boost-build,libtorrent-rasterbar,C++,Boost,Libtorrent,Boost Build,Libtorrent Rasterbar,我一直在尝试交叉编译用于编译的raspberry pi。我正在使用以下config.jam: import os ; using gcc : arm : arm-linux-gnueabihf-g++ : <cxxflags>-fPIC <cxxflags>-std=c++14 <cxxflags>-fno-strict-aliasing <cxxflags>-fvisibility=hidden <
config.jam
:
import os ;
using gcc : arm : arm-linux-gnueabihf-g++ :
<cxxflags>-fPIC
<cxxflags>-std=c++14
<cxxflags>-fno-strict-aliasing
<cxxflags>-fvisibility=hidden
<linkflags>-m32
<linkflags>-static-libstdc++
<linkflags>-static-libgcc
<linkflags>"-z noexecstack"
# debug information
<cxxflags>-g
<cxxflags>-gdwarf-4
<cxxflags>-ggdb
;
导入操作系统;
使用gcc:arm:arm-linux-gnueabihf-g++:
-fPIC
-std=c++14
-fno严格混叠
-可视性=隐藏
-m32
-静态libstdc++
-静态libgcc
“-z noexecstack”
#调试信息
-g
-gdwarf-4
-ggdb
;
我基本上复制了linux-x86的现有配置,并替换了编译器,但出现以下编译错误:
libtorrent/src/entry.cpp: In member function 'libtorrent::entry& libtorrent::entry::operator[](libtorrent::string_view)':
libtorrent/src/entry.cpp:86:33: error: no matching function for call to
'std::map<std::basic_string<char>, libtorrent::entry, libtorrent::aux::strview_less, std::allocator<std::pair<const std::basic_string<char>, libtorrent::entry> > >::find(libtorrent::string_view&)'
auto const i = dict().find(key);
libtorrent/src/entry.cpp:在成员函数“libtorrent::entry&libtorrent::entry::operator[](libtorrent::string_view)中:
libtorrent/src/entry.cpp:86:33:错误:没有用于调用的匹配函数
'std::map::find(libtorrent::string_view&)'
自动常量i=dict().find(键);
我唯一的猜测是交叉编译器的版本(4.9.3)与libtorrent不兼容,因为我在linux-32-config.jam中看到它使用g++-5。我还缺什么吗?
您可以找到修改后的存储库。我正在用于构建。该调用(std::map::find())是在C++14中添加的(请参阅)。我看到您也在命令行上传入了-std=c++14
。你确定你的GCC支持C++14吗?这似乎有点过时了
libtorrent当前的稳定分支只需要C++11支持,如果这是您正在构建的分支,那么编译器支持检测可能有问题。如果您是从libtorrent
master
构建,则需要适当的C++14支持。因此,在这种情况下,您可能需要使用稳定版本。感谢@Arvid,我使用libtorrent的当前稳定分支(RC_1_2)和下面的jam文件编译了它,您可以找到它
导入操作系统;
使用gcc:arm:arm-linux-gnueabihf-g++:
-fPIC
-std=c++11
-fno严格混叠
-可视性=隐藏
-静态libstdc++
-静态libgcc
“-z noexecstack”
#调试信息
-g
-gdwarf-4
-ggdb;
我更改了-std=c++14
,删除了-m32
,并从当前的稳定分支(我猜是RC_1_2?)构建,现在确实可以编译了。非常感谢:)作为一个有点无关的便条。JAMFLASH工具集不包含C++版本-FPIC、-G和-static -*。您可以在b2命令行上通过以下命令控制:debug symbols=on runtime link=static cxxstd=14。此外,LyTrTrand尊重C++别名规则,因此在技术上不必禁用它们。
import os ;
using gcc : arm : arm-linux-gnueabihf-g++ :
<cxxflags>-fPIC
<cxxflags>-std=c++11
<cxxflags>-fno-strict-aliasing
<cxxflags>-fvisibility=hidden
<linkflags>-static-libstdc++
<linkflags>-static-libgcc
<linkflags>"-z noexecstack"
# debug information
<cxxflags>-g
<cxxflags>-gdwarf-4
<cxxflags>-ggdb;