Search code examples
c++boostlibtorrentboost-buildlibtorrent-rasterbar

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.


Solution

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