Skip to content

docker build fails with "Could NOT find Threads (missing: Threads_FOUND)" #170

Closed
@krinkinmu

Description

@krinkinmu

Hi There,

While following instructions in docs/building.md and trying to build Docker image I'm facing some errors when building ABSL:

1182.0 configure: cmake -DCMAKE_CXX_STANDARD=17 . -DCMAKE_TOOLCHAIN_FILE=/root/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/root/emsdk/node/18.20.3_64bit/bin/node;--experimental-wasm-threads
1182.4 -- Looking for pthread_create
1182.8 -- Looking for pthread_create - not found
1182.8 -- Looking for pthread_create in pthreads
1183.2 -- Looking for pthread_create in pthreads - not found
1183.2 -- Looking for pthread_create in pthread
1183.6 -- Looking for pthread_create in pthread - not found
1183.6 -- Check if compiler accepts -pthread
1184.0 -- Check if compiler accepts -pthread - no
1184.0 CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
1184.0   Could NOT find Threads (missing: Threads_FOUND)
1184.0 Call Stack (most recent call first):
1184.0   /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
1184.0   /usr/share/cmake-3.10/Modules/FindThreads.cmake:205 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
1184.0   CMakeLists.txt:75 (find_package)
1184.0 
1184.0 
1184.0 -- Configuring incomplete, errors occurred!
1184.0 See also "/root/abseil-cpp/CMakeFiles/CMakeOutput.log".
1184.0 See also "/root/abseil-cpp/CMakeFiles/CMakeError.log".

The error points to a problem wth pthread library, but does not seem to be a root cause. Debugging it a bit, I strongly suspect that the actual issue is that underneath emcmake cmake -DCMAKE_CXX_STANDARD=17 "." the command tries to run node JS tool installed as part of emsdk installation before ABSL. And in my case it seem to install node version 18.20.3 from a prebuilt binary. That prebuilt binary depends on a version of glibc that is too new for Ubuntu Bionic.

I was able to work around that issue in a couple of different ways:

  1. Option 1: use a newer Ubuntu version with a newer glibc. Specificially, updating to Ubuntu Focal, together with a few other mnor changes, seem to be enough to get over the glibc issue
  2. Option 2: pin node tool to version 16.20.0: ./emsdk install node-16.20.0-64bit && ./emsdk activate node-16.20.0-64bit.

If you think that any of those fixes are ok, I'm happy to prepare a pull request. If none of those options sound good, I happy to discuss and try other options.

Thank you.

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