astropy: Unknown type name `pthread_mutex_t` when building `astropy` from source

Description

Encountered the following error when trying to build astropy v6.1.4 from source:

      astropy/io/fits/hdu/compressed/src/compression.c:16:1: error: unknown type name 'pthread_mutex_t'
         16 | pthread_mutex_t Fitsio_Lock;
            | ^~~~~~~~~~~~~~~
      error: command 'C:\\msys64\\mingw64\\bin/gcc.EXE' failed with exit code 1

Expected behavior

astropy should compile without issue.

How to Reproduce

  1. Started in latest version of MSYS2 (MINGW64) on Windows 10.
  2. Installed Python 3.11 in addition to as many relevant compilers as possible:
  • pacman -S
    • base_devel
    • mingw-w64-x86_64-python-pip
    • mingw-w64-x86_64-cmake
    • mingw-w64-x86_64-cfitsio
    • mingw-w64-x86_64-cython
    • mingw-w64-x86_64-gcc-libgfortran
    • mingw-w64-x86_64-gcc-fortran
    • mingw-w64-x86_64-ninja
    • mingw-w64-x86_64-openblas
    • mingw-w64-x86_64-toolchain
  1. Built numpy v1.26.4, scipy v1.14.1, and pyerfa v2.0.1.4 from source in the MINGW64 environment using pip install . in the cloned repositories.
  2. Attempt to install astropy v6.1.4 by also running pip install . in the cloned repository.

Versions

N/A, as this is a question related to the installation.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

I’ve never done so on another repo before, but would be happy to try! I’ll have a read on how to submit one to your group, and holler again if I can’t figure out how.

@tieneupin - yes, I was just wondering if there was instructions in the docs or somewhere else that we forgot to remove. Anyway, we agree this is no more needed, see #17223 to remove it.

@saimn - yes I’m pretty sure that block can be removed

Hi @pllim , thanks for the quick reply.

In truth, I am attempting to build it from source as part of a troubleshooting exercise to use healpy, which depends on astropy and its libraries. Someone was able to build it successfully on MSYS2, so I am trying to replicate what they did. I can see that it is possible to indeed install astropy 6.1.4 on Windows 10 directly using pip.

That being said, I was also eventually able to resolve the error I reported above. The file astropy/io/fits/hdu/compressed/src/compression.c was missing a #include <pthread.h> at the start of the document. Adding this line allowed astropy to compile itself correctly on MINGW64.