在 github 个操作上使用 MinGW 构建提升
Build boost with MinGW on github actions
我无法在 github 操作上安装 boost(在 windows-最新)。我在这里下载 .zip 和 运行 bootstrap(这没问题):
$uri = 'https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.zip'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $uri -OutFile C:\boost.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
cd C:\install\boost_1_68_0\tools\build
.\bootstrap.bat gcc (or mingw)
然后我安装了 boost,但是失败了:
cd C:\install\boost_1_68_0\tools\build
.\b2 install --prefix="C:\boost-build" toolset=gcc
$env:Path += ";C:\boost-build\bin"
cd C:\install\boost_1_68_0
& C:\boost-build\bin\b2.exe --build-dir="C:\install\boost_1_68_0\build" --with-system --with-program_options --with-serialization --with-test --build-type=complete -j2 --prefix="C:\boost" toolset=gcc install
一些日志:
searching for -lmingwex
2020-08-21T15:50:37.6440591Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingwex
2020-08-21T15:50:37.6460133Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
2020-08-21T15:50:37.6478829Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib\libmsvcrt.a when searching for -lmsvcrt
2020-08-21T15:50:37.6492262Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
2020-08-21T15:50:37.6493427Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcrt
2020-08-21T15:50:37.6557648Z collect2.exe: error: ld returned 1 exit status
2020-08-21T15:50:37.6559763Z
2020-08-21T15:50:37.6585411Z "g++" "-Wl,--out-implib,C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi\libboost_system-mgw81-mt-x32-1_68.dll.a" -o "C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi\libboost_system-mgw81-mt-x32-1_68.dll" -Wl,-h -Wl,libboost_system-mgw81-mt-x32-1_68.dll -shared -Wl,--start-group "C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi\error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -m32 -mthreads -march=i686
2020-08-21T15:50:39.0837098Z ...skipped <pC:\boost\lib>libboost_timer-mgw81-mt-x32-1_68.dll for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll...
2020-08-21T15:50:39.0851962Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\execution_monitor.o
2020-08-21T15:50:39.8118085Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\debug.o
2020-08-21T15:50:40.2338237Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_chrono-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:50:40.2421141Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\cpp_main.o
2020-08-21T15:50:42.3085102Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:50:42.3390490Z ...skipped <pC:\boost\lib>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll...
2020-08-21T15:50:42.3444885Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\decorator.o
2020-08-21T15:51:05.4241487Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\unit_test_parameters.o
2020-08-21T15:51:05.4369569Z ...skipped <pC:\boost\lib>libboost_program_options-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\program_options\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_program_options-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4384074Z ...skipped <pC:\boost\lib>libboost_serialization-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_serialization-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4385413Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_wserialization-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_serialization-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4410211Z ...skipped <pC:\boost\lib>libboost_wserialization-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_wserialization-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4467097Z ...skipped <pC:\boost\lib>libboost_system-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_system-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4480197Z ...skipped <pC:\boost\lib>libboost_chrono-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_chrono-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4481308Z ...skipped <pC:\boost\lib>libboost_timer-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4482701Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4562400Z ...skipped <pC:\boost\lib>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4750061Z gcc.archive C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_system-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.4894206Z common.copy C:\boost\lib\libboost_system-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.4911430Z C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_system-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.4913574Z 1 file(s) copied.
2020-08-21T15:51:05.5448927Z gcc.archive C:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_chrono-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.5612874Z common.copy C:\boost\lib\libboost_chrono-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.5629482Z C:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_chrono-mgw81-mt-x32-1_68.a
2020-08-21T15:51:08.7562611Z gcc.archive C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\debug\address-model-32\link-static\threading-multi\libboost_unit_test_framework-mgw81-mt-d-x32-1_68.a
2020-08-21T15:51:08.7845048Z common.copy C:\boost\lib\libboost_unit_test_framework-mgw81-mt-d-x32-1_68.a
2020-08-21T15:51:08.7845690Z C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\debug\address-model-32\link-static\threading-multi\libboost_unit_test_framework-mgw81-mt-d-x32-1_68.a
2020-08-21T15:51:08.7846336Z 1 file(s) copied.
2020-08-21T15:51:09.2309726Z ...failed updating 12 targets...
2020-08-21T15:51:09.2312270Z ...skipped 52 targets...
2020-08-21T15:51:09.2312837Z ...updated 15703 targets...
2020-08-21T15:51:09.2509339Z C:\install\boost_1_68_0
2020-08-21T15:51:09.2603988Z
2020-08-21T15:51:09.2604408Z
2020-08-21T15:51:09.2818352Z ##[error]Process completed with exit code 1.
Link to actions of my repo with full logs/code
你有什么提示或建议吗?
我面临的主要问题是库名称中有 -x64(或 x32),因此 find_package 无法找到所需的库(真正有用的是设置 -DBoost_DEBUG=开)。
Could NOT find Boost (missing: system) (found version "1.68.0")
将 Boost_ARCHITECTURE 设置为“-x64”,完成工作
set(Boost_ARCHITECTURE "-x64")
对于Github我也需要使用的动作
continue-on-error: true # to prevent failing workflow when step exit with errors (when installing boost)
if: success() || failure() # to run following steps even if previous step failed
所以如果你有类似的问题
- 使用 gcc 安装 boost
- 通过检查 BOOST_ROOT、BOOST_LIBRARIES
确保 cmake 找到提升
- 如果出现任何错误,请仔细查看错误消息并使用 Boost_DEBUG
这是我的代码:
name: build and run tests
on:
push:
branches: [ server ]
pull_request:
branches: [ server ]
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install PostgreSQL
run: |
Start-Process powershell -Verb runAs
choco install -y postgresql12
- name: Download Boost
shell: powershell
run: |
$uri = 'https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.zip'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $uri -OutFile C:\boost.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
- name: Unzip boost
run: Expand-Archive -LiteralPath 'C:\boost.zip' -DestinationPath C:\install\
- name: Run bootstrap
shell: powershell
run: |
cd C:\install\boost_1_68_0\tools\build\
.\bootstrap.bat gcc
- name: Install Boost
continue-on-error: true
shell: powershell
run: |
cd C:\install\boost_1_68_0\tools\build\
.\b2 --with-system --with-program_options --with-serialization --with-test --build-type=complete -j2 --prefix="C:\boost-build" toolset=gcc install
$env:Path += ";C:\boost-build\bin"
cd C:\install\boost_1_68_0
C:\boost-build\bin\b2.exe --with-system --with-program_options --with-serialization --with-test --build-type=complete -j2 --build-dir="C:\install\boost_1_68_0\build" --build-type=complete --prefix="C:\boost" toolset=gcc install
- name: Check libs names
if: success() || failure()
run: |
cd c:\boost\lib
Get-ChildItem
- name: Running cmake
if: success() || failure()
run: |
$env:BOOST_INCLUDEDIR = 'C:\boost\include'
$env:BOOST_LIBRARYDIR = 'C:\boost\lib'
$env:BOOST_ROOT = 'C:\boost'
mkdir build
cd build
cmake -DBOOST_ROOT=c:/boost -DBoost_DEBUG=ON -G "MinGW Makefiles" ..
- name: Running make (MinGW Makefiles)
if: success() || failure()
run: |
cd build
make
set(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
cmake_minimum_required(VERSION 3.1)
project(Server VERSION 0.0.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
...
if (WIN32)
# Here i'm setting boost paths based on BOOST_ROOT, you can skip this
set(Boost_NO_SYSTEM_PATHS TRUE)
if (Boost_NO_SYSTEM_PATHS)
set(BOOST_ROOT "${BOOST_ROOT}")
message(" > ${BOOST_ROOT}")
set(BOOST_INCLUDEDIR "${BOOST_ROOT}/include")
message(" > ${BOOST_INCLUDEDIR}")
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib")
message(" > ${BOOST_LIBRARYDIR}")
endif (Boost_NO_SYSTEM_PATHS)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_ARCHITECTURE "-x64")
endif (WIN32)
find_package(Boost 1.60.0 COMPONENTS REQUIRED program_options serialization system)
include_directories(${Boost_INCLUDE_DIR})
add_executable(Server ${FILES})
target_link_libraries(Server ${Boost_LIBRARIES} pthread)
我无法在 github 操作上安装 boost(在 windows-最新)。我在这里下载 .zip 和 运行 bootstrap(这没问题):
$uri = 'https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.zip'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $uri -OutFile C:\boost.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
cd C:\install\boost_1_68_0\tools\build
.\bootstrap.bat gcc (or mingw)
然后我安装了 boost,但是失败了:
cd C:\install\boost_1_68_0\tools\build
.\b2 install --prefix="C:\boost-build" toolset=gcc
$env:Path += ";C:\boost-build\bin"
cd C:\install\boost_1_68_0
& C:\boost-build\bin\b2.exe --build-dir="C:\install\boost_1_68_0\build" --with-system --with-program_options --with-serialization --with-test --build-type=complete -j2 --prefix="C:\boost" toolset=gcc install
一些日志:
searching for -lmingwex
2020-08-21T15:50:37.6440591Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingwex
2020-08-21T15:50:37.6460133Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
2020-08-21T15:50:37.6478829Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib\libmsvcrt.a when searching for -lmsvcrt
2020-08-21T15:50:37.6492262Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
2020-08-21T15:50:37.6493427Z C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcrt
2020-08-21T15:50:37.6557648Z collect2.exe: error: ld returned 1 exit status
2020-08-21T15:50:37.6559763Z
2020-08-21T15:50:37.6585411Z "g++" "-Wl,--out-implib,C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi\libboost_system-mgw81-mt-x32-1_68.dll.a" -o "C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi\libboost_system-mgw81-mt-x32-1_68.dll" -Wl,-h -Wl,libboost_system-mgw81-mt-x32-1_68.dll -shared -Wl,--start-group "C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi\error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -m32 -mthreads -march=i686
2020-08-21T15:50:39.0837098Z ...skipped <pC:\boost\lib>libboost_timer-mgw81-mt-x32-1_68.dll for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll...
2020-08-21T15:50:39.0851962Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\execution_monitor.o
2020-08-21T15:50:39.8118085Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\debug.o
2020-08-21T15:50:40.2338237Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_chrono-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:50:40.2421141Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\cpp_main.o
2020-08-21T15:50:42.3085102Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:50:42.3390490Z ...skipped <pC:\boost\lib>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll...
2020-08-21T15:50:42.3444885Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\decorator.o
2020-08-21T15:51:05.4241487Z gcc.compile.c++ C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi\unit_test_parameters.o
2020-08-21T15:51:05.4369569Z ...skipped <pC:\boost\lib>libboost_program_options-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\program_options\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_program_options-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4384074Z ...skipped <pC:\boost\lib>libboost_serialization-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_serialization-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4385413Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_wserialization-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_serialization-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4410211Z ...skipped <pC:\boost\lib>libboost_wserialization-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\serialization\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_wserialization-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4467097Z ...skipped <pC:\boost\lib>libboost_system-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_system-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4480197Z ...skipped <pC:\boost\lib>libboost_chrono-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_chrono-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4481308Z ...skipped <pC:\boost\lib>libboost_timer-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4482701Z ...skipped <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\timer\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_timer-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4562400Z ...skipped <pC:\boost\lib>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll.a for lack of <pC:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\release\address-model-32\threading-multi>libboost_prg_exec_monitor-mgw81-mt-x32-1_68.dll.a...
2020-08-21T15:51:05.4750061Z gcc.archive C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_system-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.4894206Z common.copy C:\boost\lib\libboost_system-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.4911430Z C:\install\boost_1_68_0\build\boost\bin.v2\libs\system\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_system-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.4913574Z 1 file(s) copied.
2020-08-21T15:51:05.5448927Z gcc.archive C:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_chrono-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.5612874Z common.copy C:\boost\lib\libboost_chrono-mgw81-mt-x32-1_68.a
2020-08-21T15:51:05.5629482Z C:\install\boost_1_68_0\build\boost\bin.v2\libs\chrono\build\gcc-8.1.0\release\address-model-32\link-static\threading-multi\libboost_chrono-mgw81-mt-x32-1_68.a
2020-08-21T15:51:08.7562611Z gcc.archive C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\debug\address-model-32\link-static\threading-multi\libboost_unit_test_framework-mgw81-mt-d-x32-1_68.a
2020-08-21T15:51:08.7845048Z common.copy C:\boost\lib\libboost_unit_test_framework-mgw81-mt-d-x32-1_68.a
2020-08-21T15:51:08.7845690Z C:\install\boost_1_68_0\build\boost\bin.v2\libs\test\build\gcc-8.1.0\debug\address-model-32\link-static\threading-multi\libboost_unit_test_framework-mgw81-mt-d-x32-1_68.a
2020-08-21T15:51:08.7846336Z 1 file(s) copied.
2020-08-21T15:51:09.2309726Z ...failed updating 12 targets...
2020-08-21T15:51:09.2312270Z ...skipped 52 targets...
2020-08-21T15:51:09.2312837Z ...updated 15703 targets...
2020-08-21T15:51:09.2509339Z C:\install\boost_1_68_0
2020-08-21T15:51:09.2603988Z
2020-08-21T15:51:09.2604408Z
2020-08-21T15:51:09.2818352Z ##[error]Process completed with exit code 1.
Link to actions of my repo with full logs/code
你有什么提示或建议吗?
我面临的主要问题是库名称中有 -x64(或 x32),因此 find_package 无法找到所需的库(真正有用的是设置 -DBoost_DEBUG=开)。
Could NOT find Boost (missing: system) (found version "1.68.0")
将 Boost_ARCHITECTURE 设置为“-x64”,完成工作
set(Boost_ARCHITECTURE "-x64")
对于Github我也需要使用的动作
continue-on-error: true # to prevent failing workflow when step exit with errors (when installing boost)
if: success() || failure() # to run following steps even if previous step failed
所以如果你有类似的问题
- 使用 gcc 安装 boost
- 通过检查 BOOST_ROOT、BOOST_LIBRARIES 确保 cmake 找到提升
- 如果出现任何错误,请仔细查看错误消息并使用 Boost_DEBUG
这是我的代码:
name: build and run tests
on:
push:
branches: [ server ]
pull_request:
branches: [ server ]
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install PostgreSQL
run: |
Start-Process powershell -Verb runAs
choco install -y postgresql12
- name: Download Boost
shell: powershell
run: |
$uri = 'https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.zip'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $uri -OutFile C:\boost.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
- name: Unzip boost
run: Expand-Archive -LiteralPath 'C:\boost.zip' -DestinationPath C:\install\
- name: Run bootstrap
shell: powershell
run: |
cd C:\install\boost_1_68_0\tools\build\
.\bootstrap.bat gcc
- name: Install Boost
continue-on-error: true
shell: powershell
run: |
cd C:\install\boost_1_68_0\tools\build\
.\b2 --with-system --with-program_options --with-serialization --with-test --build-type=complete -j2 --prefix="C:\boost-build" toolset=gcc install
$env:Path += ";C:\boost-build\bin"
cd C:\install\boost_1_68_0
C:\boost-build\bin\b2.exe --with-system --with-program_options --with-serialization --with-test --build-type=complete -j2 --build-dir="C:\install\boost_1_68_0\build" --build-type=complete --prefix="C:\boost" toolset=gcc install
- name: Check libs names
if: success() || failure()
run: |
cd c:\boost\lib
Get-ChildItem
- name: Running cmake
if: success() || failure()
run: |
$env:BOOST_INCLUDEDIR = 'C:\boost\include'
$env:BOOST_LIBRARYDIR = 'C:\boost\lib'
$env:BOOST_ROOT = 'C:\boost'
mkdir build
cd build
cmake -DBOOST_ROOT=c:/boost -DBoost_DEBUG=ON -G "MinGW Makefiles" ..
- name: Running make (MinGW Makefiles)
if: success() || failure()
run: |
cd build
make
set(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
cmake_minimum_required(VERSION 3.1)
project(Server VERSION 0.0.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
...
if (WIN32)
# Here i'm setting boost paths based on BOOST_ROOT, you can skip this
set(Boost_NO_SYSTEM_PATHS TRUE)
if (Boost_NO_SYSTEM_PATHS)
set(BOOST_ROOT "${BOOST_ROOT}")
message(" > ${BOOST_ROOT}")
set(BOOST_INCLUDEDIR "${BOOST_ROOT}/include")
message(" > ${BOOST_INCLUDEDIR}")
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib")
message(" > ${BOOST_LIBRARYDIR}")
endif (Boost_NO_SYSTEM_PATHS)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_ARCHITECTURE "-x64")
endif (WIN32)
find_package(Boost 1.60.0 COMPONENTS REQUIRED program_options serialization system)
include_directories(${Boost_INCLUDE_DIR})
add_executable(Server ${FILES})
target_link_libraries(Server ${Boost_LIBRARIES} pthread)