繁体   English   中英

树莓派 3 model B 的交叉编译 libtorrent

[英]Cross compiling libtorrent for raspberry pi 3 model B

我一直在尝试为使用boost build进行编译的树莓派交叉编译jlibtorrent 我正在使用带有以下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 repositories 中找到修改后的存储库。 我正在使用swig/build-linux-armv7.sh进行构建。

该调用 (std::map::find()) 被添加到 C++14 中(参见文档)。 我看到你也在命令行上传递了-std=c++14 您确定您的 GCC 支持 C++14 吗? 这似乎有点老了。

libtorrent 当前的稳定分支只需要 C++11 支持,如果这是您正在构建的分支,则此处的编译器支持检测可能有问题。 如果您从 libtorrent master构建,则需要适当的 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;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM