我一直在尝试为使用jlibtorrent进行编译的raspberry pi交叉编译boost build。我将the officially provided cross compiler与以下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。还有什么我想念的吗?
您可以找到修改后的存储库in my github repositories。我正在使用swig/build-linux-armv7.sh
进行构建。
答案 0 :(得分:1)
该调用(std :: map :: find())已在C ++ 14中添加(请参见docs)。我也看到您也在命令行中传递了-std=c++14
。您确定您的GCC支持C ++ 14吗?看来有点老了。
libtorrent的当前稳定分支仅需要C ++ 11支持,如果这是您正在构建的分支,则编译器支持检测here可能有问题。如果您是从libtorrent master
构建的,则需要适当的C ++ 14支持。因此,在这种情况下,您可能要使用稳定版。
答案 1 :(得分:0)
由于@Arvid,我设法使用了当前的libtorrent稳定分支(RC_1_2)和以下果酱文件来编译它,您可以在其中找到here。
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;