Skip to content

with wasi-sdk-p2.cmake, the pthread can't be detected when build with CMake project #520

Open
@zhuyipeng

Description

@zhuyipeng

hi, all,

I am trying to compile mqtt into webassembly, cmake come out pthread detect error as followed showing. I went with wasi-sdk-pthread.cmake, pthread check passed.

does anyone encounter this issue? how should I fix it?

`cmake -DCMAKE_TOOLCHAIN_FILE=/mnt/d/UserData/z003n71c/workspace/wasi-sdk/build/install/share/cmake/wasi-sdk-p2.cmake -DWITH_TLS=OFF -DWITH_UNIX_SOCKETS=OFF ..
-- The C compiler identification is Clang 19.1.5
-- The CXX compiler identification is Clang 19.1.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /mnt/d/UserData/z003n71c/workspace/wasi-sdk/build/install/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /mnt/d/UserData/z003n71c/workspace/wasi-sdk/build/install/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- WITH_DLT = OFF
-- Could NOT find cJSON (missing: CJSON_INCLUDE_DIR CJSON_LIBRARY)
-- Optional dependency cJSON not found. Some features will be disabled.
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
CMake Error at /usr/local/cmake-4.0.0-rc3-linux-x86_64/share/cmake-4.0/Modules/FindPackageHandleStandardArgs.cmake:227 (message):
Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
/usr/local/cmake-4.0.0-rc3-linux-x86_64/share/cmake-4.0/Modules/FindPackageHandleStandardArgs.cmake:591 (_FPHSA_FAILURE_MESSAGE)
/usr/local/cmake-4.0.0-rc3-linux-x86_64/share/cmake-4.0/Modules/FindThreads.cmake:226 (find_package_handle_standard_args)
lib/CMakeLists.txt:97 (find_package)

-- Configuring incomplete, errors occurred!`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions