交叉编译用于树莓派3模型B的libtorrent



我一直在尝试为树莓派交叉编译jlibtorrent,它使用boost构建进行编译。我使用的是官方提供的带有以下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
;

我基本上复制了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);

我唯一的猜测是,交叉编译器(4.9.3(的版本与libtorrent不兼容,因为我在linux-32-config.jam中看到它使用了g++-5。我还缺什么吗?您可以在我的github存储库中找到修改后的存储库。我正在使用swig/build-linux-armv7.sh进行建筑。

该调用(std::map::find(((是在C++14中添加的(请参阅文档(。我看到您也在命令行中传入了-std=c++14。你确定你的GCC支持C++14吗?这似乎有点过时了。

libtorrent的当前稳定分支只需要C++11支持,如果这是您正在构建的分支,那么这里的编译器支持检测可能有问题。如果您是从libtorrentmaster构建的,那么它需要适当的C++14支持。因此,在这种情况下,您可能希望使用稳定版本。

多亏了@Arvid,我成功地使用libtorrent(RC_1_2(的当前稳定分支和下面的jam文件编译了它,您可以在这里找到它。

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;

最新更新