Действия github: windows-latest не может открыть gomp.libC++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Действия github: windows-latest не может открыть gomp.lib

Сообщение Anonymous »

У меня есть проект на C++&cmake, в котором я использую действия GitHub для сборки и тестирования на последних платформах Ubuntu 22.04 и Windows.
К сожалению, последняя версия Windows компоновщик завершается с ошибкой
LINK : fatal error LNK1181: cannot open input file 'gomp.lib'

пока сборка Ubuntu прошла успешно.
Это мой yaml:
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-work ... atform.yml
name: CMake build and test on Windows

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
name: build and test
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-tea ... ild-matrix
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "bin-output-dir=${{ github.workspace }}/bin" >> "$GITHUB_OUTPUT"

- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }} -G "Visual Studio 17 2022" -A x64
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-S ${{ github.workspace }}

- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ env.BUILD_TYPE }}

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --verbose -C ${{ env.BUILD_TYPE }} -LE "^disabled$" -L WD

Кто-нибудь знает, как это исправить?
ИЗМЕНИТЬ
Добавлен корневой CMakeLists (что немного грязно, если честно):
# Works with 3.17 and tested through 3.29
cmake_minimum_required(VERSION 3.17...3.29)

# Set outputs directories.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

# Project name and a few useful settings. Other commands can pick up the results
project(
MyProject
VERSION 0.1
LANGUAGES CXX)

# Only do these if this is the main project, and not if it is included through add_subdirectory
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Optionally set things like CMAKE_CXX_STANDARD, CMAKE_POSITION_INDEPENDENT_CODE here
set(CMAKE_CXX_STANDARD 17)
IF (WIN32)
# set stuff for windows
set(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS}")
ELSE ()
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wfloat-conversion -Wno-deprecated-copy -Wno-maybe-uninitialized -pedantic -O3 -fprofile-arcs -ftest-coverage -fopenmp${CMAKE_CXX_FLAGS}")
ENDIF ()
# Let's ensure -std=c++xx instead of -std=g++xx
set(CMAKE_CXX_EXTENSIONS OFF)

# Let's nicely support folders in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Testing only available if this is the main app
# Note this needs to be done in the main CMakeLists
# since it calls enable_testing, which must be in the
# main CMakeLists.
include(CTest)
endif ()

# add dependencies
include(cmake/CPM.cmake)
CPMAddPackage("gh:nlohmann/json@3.11.3")
CPMAddPackage("gh:gabime/spdlog@1.13.0")
CPMAddPackage(
GITLAB_REPOSITORY libeigen/eigen
GIT_TAG 3.4
OPTIONS "EIGEN_BUILD_DOC OFF"
"EIGEN_BUILD_PKGCONFIG OF"
"EIGEN_BUILD_DOC OFF"
)

include_directories(
${CMAKE_SOURCE_DIR}/${FolderSource} # Find headers from source folder
${csv_SOURCE_DIR}/single_include # Issue #139 for this repo
)

# The compiled library code is here
add_subdirectory(src)

# The executable code is here
add_subdirectory(apps)

# Testing only available if this is the main app
# Emergency override MODERN_CMAKE_BUILD_TESTING provided as well
if ((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MODERN_CMAKE_BUILD_TESTING)
AND BUILD_TESTING)
add_subdirectory(tests)
endif ()


И тогда каждая библиотека, которую я компилирую, имеет следующий вид:
# Optionally glob, but only for CMake 3.12 or later:
set(HEADER_LIST "${WingDesigner_SOURCE_DIR}/include/utils/logging_helper.hpp;${WingDesigner_SOURCE_DIR}/include/utils/path_helper.hpp;${WingDesigner_SOURCE_DIR}/include/utils/csv_helper.hpp")
# Make an automatic library - will be static or dynamic based on user setting
add_library(utils logging_helper.cpp path_helper.cpp csv_helper.cpp ${HEADER_LIST})
# We need this directory, and users of our library will need it too
target_include_directories(utils PUBLIC ../../include)
target_link_libraries(utils PRIVATE spdlog::spdlog Eigen3::Eigen csv gomp)
target_compile_features(utils PUBLIC cxx_std_17)

# IDEs should put the headers in a nice place
source_group(
TREE "${PROJECT_SOURCE_DIR}/include"
PREFIX "Header Files"
FILES ${HEADER_LIST})


Подробнее здесь: https://stackoverflow.com/questions/785 ... n-gomp-lib
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»