简体   繁体   中英

Cross compiling libtorrent for raspberry pi 3 model B

I've been trying to cross compile jlibtorrent for the raspberry pi which uses boost build for compiling. I am using the officially provided cross compiler with the following 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
    ;

I basically copied the existing configuration for linux-x86 and replaced the compiler, but I'm getting the following compilation error:

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);

My only guess is that the version of the cross compiler (4.9.3) is not compatible with libtorrent, because I saw in the linux-32-config.jam that it uses g++-5. Is there anything else I am missing? You can find the modified repository in my github repositories . I am using swig/build-linux-armv7.sh for building.

that call (std::map::find()) was added in C++14 (see docs ). I see you pass in -std=c++14 on the command line as well. Are you sure your GCC supports C++14? It seems a bit old for that.

The current stable branch of libtorrent only requires C++11 support, if that is the branch you're building, there may be something wrong with the compiler support detection here . If you are building from libtorrent master , it requires proper C++14 support. So in that case you may want to use the stable release.

Thanks to @Arvid I managed to compile it using the current stable branch for libtorrent (RC_1_2) and the following jam file, which you can find 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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