Build Boost Library under Linux

Source: Internet
Author: User

Download source code

Boost_1_66_0.tar.gz

Generate compilation Tools

# tar axf boost_1_66_0.tar.gz# cd boost_1_66_0# yum install gcc gcc-c++ python-devel cmake -y# ./bootstrap.sh

Compiling a 64-bit boost library

# ./b2 install --with-system --with-thread --with-date_time --with-regex --with-serialization --with-python link=shared runtime-link=shared threading=multi debug

Setting up the Boost dynamic library load path

# tee /etc/ld.so.conf.d/boost-x86_64.conf << EOF/usr/local/libEOF# ldconfig

Cmakelists Sample Example

# vim CMakeLists.txtcmake_minimum_required(VERSION 2.8)project(test)### 此处的动态库名必须和BOOST_PYTHON_MODULE()中定义的保持一致,即最后生成的库必须名为hello.soset(SRC main.cpp)add_library(hello SHARED ${SRC})set_target_properties(hello PROPERTIES PREFIX "")#dependenciesINCLUDE(FindPkgConfig)pkg_check_modules(PYTHON REQUIRED python)include_directories(/usr/local/include ${PYTHON_INCLUDE_DIRS})link_directories(/usr/local/lib)target_link_libraries(hello boost_python)

Build Boost Library under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.