Skip to content

BLD: compiler recognition on MacOS #3109

@tylerjereddy

Description

@tylerjereddy

Expected behavior

Build system automagically handles both clang and "genuine" gcc on MacOS. This command should work with spack built gcc compiler toolchain loaded on macOS 10.15.7: python setup.py develop

Actual behavior

The build system thinks it is using clang but it is actually using gcc built with clang by spack (not the "alias" you would normally have on a "normal" mac machine).

gcc: error: unrecognized command line option '-stdlib=libc++'
error: command '/Users/treddy/github_projects/spack/opt/spack/darwin-catalina-x86_64/clang-11.0.0-apple/gcc-8.3.0-fxj4m5svuktydrjgtfkbxyifibwf6wsi/bin/gcc' failed with exit status 1

Code to reproduce the behavior

python setup.py develop

Python 3.7.4, though not likely relevant. Latest develop branch.

Hacky work around, that hints at part of code involved:

--- a/package/setup.py
+++ b/package/setup.py
@@ -286,9 +286,9 @@ def extensions(config):
     cpp_extra_link_args=[]
     # needed to specify c++ runtime library on OSX
     if platform.system() == 'Darwin' and using_clang():
-        cpp_extra_compile_args.append('-stdlib=libc++')
+        #cpp_extra_compile_args.append('-stdlib=libc++')
         cpp_extra_compile_args.append('-mmacosx-version-min=10.9')
-        cpp_extra_link_args.append('-stdlib=libc++')
+        #cpp_extra_link_args.append('-stdlib=libc++')
         cpp_extra_link_args.append('-mmacosx-version-min=10.7')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions