saghul / pycares

Python interface for c-ares
https://pypi.org/project/pycares/
MIT License
165 stars 73 forks source link

C compilation errors when attempting to install #104

Closed cakoose closed 4 years ago

cakoose commented 4 years ago

MacOS 10.14 Python 3.8.0 (via pyenv)

When I try to "pip install" I get errors, starting with:

$ python -m pip install pycares
Collecting pycares
  Using cached https://files.pythonhosted.org/packages/85/de/cd46a73e43e206a6ad1e9cf9cc893c3ed1b21caf57f1e0a8d9a119d290eb/pycares-3.0.0.tar.gz
Requirement already satisfied: cffi>=1.5.0 in /Users/kannan/.pyenv/versions/3.8.0/lib/python3.8/site-packages (from pycares) (1.13.1)
Requirement already satisfied: pycparser in /Users/kannan/.pyenv/versions/3.8.0/lib/python3.8/site-packages (from cffi>=1.5.0->pycares) (2.19)
Installing collected packages: pycares
    Running setup.py install for pycares ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/kannan/.pyenv/versions/3.8.0/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/my/y8wwfhzs3d5b9_kntpc38ssm0000gp/T/pip-install-yfk1d6vv/pycares/setup.py'"'"'; __file__='"'"'/private/var/folders/my/y8wwfhzs3d5b9_kntpc38ssm0000gp/T/pip-install-yfk1d6vv/pycares/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/my/y8wwfhzs3d5b9_kntpc38ssm0000gp/T/pip-record-963lj52u/install-record.txt --single-version-externally-managed --compile
         cwd: /private/var/folders/my/y8wwfhzs3d5b9_kntpc38ssm0000gp/T/pip-install-yfk1d6vv/pycares/
    Complete output (2178 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14-x86_64-3.8
    creating build/lib.macosx-10.14-x86_64-3.8/pycares
    copying src/pycares/errno.py -> build/lib.macosx-10.14-x86_64-3.8/pycares
    copying src/pycares/_version.py -> build/lib.macosx-10.14-x86_64-3.8/pycares
    copying src/pycares/__init__.py -> build/lib.macosx-10.14-x86_64-3.8/pycares
    copying src/pycares/utils.py -> build/lib.macosx-10.14-x86_64-3.8/pycares
    copying src/pycares/__main__.py -> build/lib.macosx-10.14-x86_64-3.8/pycares
    running build_ext
    generating cffi module 'build/temp.macosx-10.14-x86_64-3.8/_cares.c'
    creating build/temp.macosx-10.14-x86_64-3.8
    building '_cares' extension
    creating build/temp.macosx-10.14-x86_64-3.8/build
    creating build/temp.macosx-10.14-x86_64-3.8/build/temp.macosx-10.14-x86_64-3.8
    creating build/temp.macosx-10.14-x86_64-3.8/deps
    creating build/temp.macosx-10.14-x86_64-3.8/deps/c-ares
    creating build/temp.macosx-10.14-x86_64-3.8/deps/c-ares/src
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -DHAVE_CONFIG_H=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE=1 -I/Users/kannan/.pyenv/versions/3.8.0/include/python3.8 -Ideps/c-ares/src -Ideps/c-ares/src/config_darwin -c build/temp.macosx-10.14-x86_64-3.8/_cares.c -o build/temp.macosx-10.14-x86_64-3.8/build/temp.macosx-10.14-x86_64-3.8/_cares.o
    In file included from build/temp.macosx-10.14-x86_64-3.8/_cares.c:28:
    In file included from /Users/kannan/.pyenv/versions/3.8.0/include/python3.8/Python.h:25:
    In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
            unsigned char   *_base;
                            ^
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null
            unsigned char   *_base;
                            ^
                              _Nullable

Full error: https://gist.github.com/cakoose/566d5d6965bdadd9afc8329e20ae1875

I saw another thread that suggested doing brew uninstall c-ares, but I didn't have c-ares installed.

saghul commented 4 years ago

Thanks for the report, I'll take a look.

saghul commented 4 years ago

I added GH Actions for testing macOS and cannot reproduce the problem: https://github.com/saghul/pycares/commit/ce31c6d9492915198b7a6d4e8eaad3243a00447a/checks?check_suite_id=356017093

I plan to release binary wheels for macOS too, so this should be a problem of the past, soon.

ibexnet commented 3 years ago

anybody has fixed this issue? I ‘m under osx 10.14 with latest python3. Unistalling c-ares with brew not solve the problem. I can install pycares with python2 but I need it under python3, please can someone give me some suggestion to fix the problem?

saghul commented 3 years ago

The latest version (4.0.0) should now work.