Include file search path problem building py-grpcio with setuptools

Enrico Maria Crisostomo enrico.m.crisostomo at gmail.com
Mon Apr 2 16:12:11 UTC 2018


Hi,

When building py-grpcio I'm getting this error:

:notice:build --->  Building py27-grpcio
:debug:build Executing proc-pre-org.macports.build-build-0
:debug:build Executing org.macports.build (py27-grpcio)
:debug:build Environment:
:debug:build CC='/usr/bin/clang'
:debug:build CC_PRINT_OPTIONS='YES'
:debug:build CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_enrico_repos_github_macports-ports_python_py-grpcio/py27-grpcio/work/.CC_PRINT_OPTIONS'
:debug:build CFLAGS='-arch x86_64'
:debug:build CPATH='/opt/local/include'
:debug:build CXX='/usr/bin/clang++'
:debug:build CXXFLAGS='-arch x86_64'
:debug:build F90FLAGS='-m64'
:debug:build FCFLAGS='-m64'
:debug:build FFLAGS='-m64'
:debug:build LDFLAGS='-arch x86_64'
:debug:build LIBRARY_PATH='/opt/local/lib'
:debug:build MACOSX_DEPLOYMENT_TARGET='10.13'
:debug:build OBJC='/usr/bin/clang'
:debug:build OBJCFLAGS='-arch x86_64'
:info:build Executing:  cd "/opt/local/var/macports/build/_Users_enrico_repos_github_macports-ports_python_py-grpcio/py27-grpcio/work/grpcio-1.10.0" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build
:debug:build system:  cd "/opt/local/var/macports/build/_Users_enrico_repos_github_macports-ports_python_py-grpcio/py27-grpcio/work/grpcio-1.10.0" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build
... snip ...
:info:build running build_ext
:info:build In file included from src/boringssl/err_data.c:18:
:info:build In file included from /opt/local/include/openssl/err.h:115:
:info:build /opt/local/include/openssl/e_os2.h:276:11: error: 'OPENSSL_EXPORT' macro redefined [-Werror,-Wmacro-redefined]
:info:build #  define OPENSSL_EXPORT extern
:info:build           ^
:info:build third_party/boringssl/include/openssl/base.h:178:9: note: previous definition is here
:info:build #define OPENSSL_EXPORT
:info:build         ^ 

Since grpcio includes boringssl sources (an openssl fork), I think the compiler include files search path is too wide and should not contain /opt/local/include/openssl.  Examining setup.py I haven't been able to tell why are openssl header files pulled in as well.  For reference, this is where include paths are set:

    CORE_INCLUDE = ('include', '.',)
    BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
    ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),)
    CARES_INCLUDE = (
        os.path.join('third_party', 'cares'),
        os.path.join('third_party', 'cares', 'cares'),)
    if 'darwin' in sys.platform:
      CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_darwin'),)
    if 'freebsd' in sys.platform:
      CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_freebsd'),)
    if 'linux' in sys.platform:
      CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_linux'),)
    if 'openbsd' in sys.platform:
      CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_openbsd'),)

I'm not sure about how I should proceed.  How is the compiler include file search path set up in this case?  The /opt/local/include/openssl path should come from MacPorts, but I don't know where it's set and how I can override it.

Thank in advance,
-- 
Enrico


More information about the macports-dev mailing list