Boost library will cross compile the source code to download books



A good memory is not as good as a bad pen. I’ll record the transplant of boost library.


1. Download address of boost library version 1.66.0, with book c + + boost library development guide:


2. Cross compiling

Current environment:

Compile script:


if [ -e ${mfile} ];then
    rm ${mfile}
    echo "rm ${mfile}"

#--With libraries specifies which boost libraries to compile. If all, all will be compiled,
#If you just want to compile part of the library, you can write the name of the library and separate it with a, sign

#--with-libraries=system,filesystem,regex \

./ \
--with-libraries=all \

if [ -e ${mfile} ];then
    mhost="mips-linux-gnu-g++ -fPIC"
    sed -i "/using gcc/c using gcc : mips : ${mhost} ; " ${mfile}

echo "After 5s start compile"
sleep 5s

echo "Afer 5s start install"
sleep 5s
./b2 install


Then move the required library files to the embedded system (select according to the needs of your own library, and consider the embedded disk size),

Or you can directly put the library files into the root file system of the Ubuntu host, re create the next image, and then burn the system to the embedded device.

Then create several symbolic links, as shown by the red arrow in the following figure.


3. Test code

Current environment:


// test1 -- ( boost::this_thread::sleep() ) -- Success


void wait(int seconds) 

void thread() 
    for (int i = 0; i < 5; ++i) 
        std::cout << i << std::endl; 

int main() 
    boost::thread t(thread); 




    mips-linux-gnu-g++ -I.  my_boost_test.cpp -L./lib  -lboost_thread -lboost_system -o boost_app








Recommended Today

Process management of simulating Supervisor

preface Simulation supervisor process management demo (simple implementation) Yes, it’s wheel building! The purpose is to learn! Screenshot: In the figure, I have implemented oneCopyThe function of the subprocess. If it is used to increase or decrease the number of consumers in AMQP, I think it will be very useful. realization 1. Start the child […]