BOOST_HAS_PTHREADS not set with emscripten
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- cmake, cpp, wasm
- Domain
- build-system, compilers
Research direction
Start with the provided CMake FetchContent example using Boost 1.87.0 and Emscripten, then inspect the config logic that determines BOOST_HAS_PTHREADS for this compiler. Compare the resulting configuration with the Windows-specific path producing the thread_mutex.hpp errors. Done means the example configures and compiles without the __declspec errors, with the pthread capability detected correctly.
Written by the indexing model from the issue text.
Description
This looks like a regression on #402
Minimal example to reproduce with cmake:
cmake_minimum_required(VERSION 3.27)
project(boost_wasm_test)
set(CMAKE_CXX_STANDARD 20)
include(FetchContent)
FetchContent_Declare(
Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.7z
EXCLUDE_FROM_ALL
)
set(BOOST_INCLUDE_LIBRARIES geometry)
FetchContent_MakeAvailable(Boost)
add_executable(boost_wasm_test main.cpp)
target_link_libraries(boost_wasm_test Boost::geometry)
target_compile_options(boost_wasm_test PRIVATE -pthread)
target_link_options(boost_wasm_test PRIVATE -pthread)
(main.cpp is just generic hello world)
I get lots of errors like
In file included from /home/m/Documents/Linos/boost_wasm_test/build_emscripten/_deps/boost-src/libs/container/src/synchronized_pool_resource.cpp:14:
/home/m/Documents/Linos/boost_wasm_test/build_emscripten/_deps/boost-src/libs/container/include/boost/container/detail/thread_mutex.hpp:109:12: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
109 | extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *);
Which indicates, that BOOST_HAS_PTHREADS is not properly set.
Or am I using CMake wrong?
I am on emscripten v3.1.61
Same result with latest emscripten 4.04
- Dominant language
- C++
- Stars
- 80
- Forks
- 184
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/config
-
Add check for pmr default_ressource related functionsPossibly taken @sdebionne claimed this 310 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
msvc::no_unique_addressPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
objectionary/eo-graphs#80 ·
-
bug C/C++ code
Difficulty 1/5 Under an hour Newbie friendliness 78/100
webarkit/WebARKitLib#85 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
[request] vsg/1.1.16Openupstream update
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
conan-io/conan-center-index#31142 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100