popgenmethods / momi2

Infer demographic history with the Moran model
GNU General Public License v3.0
47 stars 11 forks source link

Builds failing on recent versions of macOS #50

Open jackkamm opened 2 years ago

jackkamm commented 2 years ago

Building the C/Cython extensions fails for me on recent versions of macOS. In particular, I get errors like:

building 'momi.convolution' extension
    /Users/kammj2/miniconda3/envs/momi2-py3.9/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/kammj2/miniconda3/envs/momi2-py3.9/include -arch x86_64 -I/Users/kammj2/miniconda3/envs/momi2-py3.9/include -fPIC -O2 -isystem /Users/kammj2/miniconda3/envs/momi2-py3.9/include -arch x86_64 -I/Users/kammj2/miniconda3/envs/momi2-py3.9/lib/python3.9/site-packages/numpy/core/include -I/Users/kammj2/miniconda3/envs/momi2-py3.9/include/python3.9 -c momi/convolution.c -o build/temp.macosx-10.9-x86_64-3.9/momi/convolution.o -fopenmp
    In file included from momi/convolution.c:34:
    /Users/kammj2/miniconda3/envs/momi2-py3.9/include/python3.9/Python.h:25:10: fatal error: 'stdio.h' file not found
    #include <stdio.h>
    ^~~~~~~~~
    1 error generated.
    error: command '/Users/kammj2/miniconda3/envs/momi2-py3.9/bin/clang' failed with exit code 1

I got the same error trying this on different permutations of brew vs. conda, and with different macOS versions (Catalina, Big Sur).

I also tried various workarounds detailed in the links below, such as updating Xcode and creating symlinks to /usr/local/include. I was not able to find a successful method, though the error message sometimes changed; for example, after adding symlinks to /usr/local/include, trying to install with homebrew Python yielded a different error message:

In file included from momi/convolution.c:34:
In file included from /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:
/usr/local/include/stdio.h:220:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE

Related links: