NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.27k stars 14.25k forks source link

Build failure: `pkgsCross.mingwW64.abseil-cpp` and `pkgsCross.mingw32.abseil-cpp` #338152

Open JonBoyleCoding opened 2 months ago

JonBoyleCoding commented 2 months ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build pkgsCross.mingwW64.abseil-cpp or pkgsCross.mingw32.abseil-cpp

Build log

Relevant parts:

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- 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
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Found Threads: TRUE
[ 27%] Building CXX object absl/base/CMakeFiles/base.dir/internal/unscaledcycleclock.cc.obj
[ 27%] Linking CXX shared library ../../bin/libabsl_debugging_internal.dll
[ 27%] Built target int128
/build/source/absl/base/internal/thread_identity.cc:18:10: fatal error: pthread.h: No such file or directory
   18 | #include <pthread.h>
      |          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [absl/base/CMakeFiles/base.dir/build.make:122: absl/base/CMakeFiles/base.dir/internal/thread_identity.cc.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 27%] Built target debugging_internal
[ 27%] Building CXX object absl/debugging/CMakeFiles/stacktrace.dir/stacktrace.cc.obj

Full gist: https://gist.github.com/JonBoyleCoding/8543895df19d229a2cc34db07e6e70dc

Additional context

Looks like it's unable to find the relevant pthreads library, or at least the headers. This is required for protobuf to build.

Notify maintainers

@GaetanLepage

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.0-117-generic, Ubuntu, 22.04.4 LTS (Jammy Jellyfish), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.3`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/home/jonathan/.nix-defexpr/channels/nixpkgs`

Add a :+1: reaction to issues you find important.

JonBoyleCoding commented 2 months ago

Just to note - I also have a flake that uses nixpkgs with crossSystem.config set to x86-w64-mingw32 and have the same issue.

GaetanLepage commented 2 months ago

I was indeed able to reproduce the issue.

As far as I went (abseil-cpp_202103), the error is always present. Hence, this is not a recent regression. I am not familiar at all with this architecture and cross-compilation in general.

I was not able to find any interesting information online either.