【问题标题】:How to build boost with boost_thread_win32-mt-s (crosscompile with mingw)如何使用 boost_thread _win32-mt-s 构建 boost(与 mingw 交叉编译)
【发布时间】:2017-11-24 18:11:44
【问题描述】:

我无法使用 MinGW 在 Linux for Windows 上构建 Boost(我无法创建 boost_thread_win32-mt-s)。

这是一个操作系统版本:

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

这是mingw的一个版本:

# i586-mingw32msvc-g++ --version
i586-mingw32msvc-g++ (GCC) 4.2.1-sjlj (mingw32-2)

我下载了 Boost 1.50 版。 我尝试构建它:

echo "using gcc : 4.2 : i586-mingw32msvc-g++ ;" > user-config.jam
./bootstrap.sh
./b2 --user-config=user-config.jam \
     --with-thread \
     --with-system \
     -sNO_BZIP2=1 \
     -sNO_ZLIB=1 \
     --layout=tagged \
     --build-type=complete \
     link=static,shared \
     runtime-link=static,shared \
     threading=single,multi \
     toolset=gcc \
     target-os=windows \
     address-model=32 \
     release stage

之后:

# pwd
/usr/src/boost_1_50_0/stage/lib
# ls -1
libboost_system-mt-s.a
libboost_system-mt.a
libboost_system-mt.dll
libboost_system-mt.dll.a
libboost_system-s.a
libboost_system.a
libboost_system.dll
libboost_system.dll.a

为什么我不能构建“boost_thread_win32-mt-s”或其他“boost_thread_XXX”?

【问题讨论】:

    标签: c++ linux windows boost mingw


    【解决方案1】:

    我解决了这个问题。我忘了说Win的线程模型(threadapi=win32)

    解决方案:

    echo "using gcc : 4.2 : i586-mingw32msvc-g++ ;" > user-config.jam
    ./bootstrap.sh
    ./b2 --user-config=user-config.jam \
         --with-thread \
         --with-system \
         -sNO_BZIP2=1 \
         -sNO_ZLIB=1 \
         --layout=tagged \
         --build-type=complete \
         link=static,shared \
         runtime-link=static,shared \
         threading=single,multi \
         toolset=gcc \
         target-os=windows \
         threadapi=win32 \
         address-model=32 \
         release stage
    

    谢谢!

    【讨论】:

      猜你喜欢
      • 2011-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-26
      相关资源
      最近更新 更多