clang: error: : errorunsupported option '-fopenmp' on Mac OSX El Capitan building XGBoost

前端 未结 4 812
情歌与酒
情歌与酒 2020-12-04 22:10

I\'m trying to build XGBoost package for Python following these instructions:

Here is the complete solution to use OpenMP-enabled compilers to instal

相关标签:
4条回答
  • 2020-12-04 22:41

    Sir, perhaps you should use

    cd xgboost; cp make/minimum.mk ./config.mk; make -j4

    instead of

    cd xgboost; cp make/config.mk ./config.mk; make -j4

    as per the "Build On OSX" Section of build document

    0 讨论(0)
  • 2020-12-04 22:51

    To solve this issue I did the following: I realized I had gcc 6 installed, so I ran:

    export CC=gcc-6
    

    But it didn't work by itself, so I had to also:

    export CXX=g++-6
    

    This solved it for me. I'm in a Macbook Pro running macOS Sierra. You can also make those changes directly on XGBoost's Makefile if you want. For more info about this: https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_on_Mac_OSX?lang=en

    0 讨论(0)
  • 2020-12-04 22:54

    You installed gcc with Homebrew, yet the error is from clang. That should simply mean that your default compiler still points to clang instead of the newly installed gcc. If you read the comments in the Makefile, you'll see the following lines:

    # choice of compiler, by default use system preference.
    # export CC = gcc
    # export CXX = g++
    # export MPICXX = mpicxx
    

    and in your case, you don't want the system one.
    Note: gcc for the system points to clang:

    $ which gcc
    /usr/bin/gcc
    $ gcc --version
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 7.3.0 (clang-703.0.29)
    Target: x86_64-apple-darwin15.4.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    

    Instead, point those variables to something in /usr/local/bin, e.g.:

    $ export CC=/usr/local/bin/gcc
    

    and similar for the other two variables, CXX and MPICXX, e.g.:

    $ export CC=/usr/local/bin/gcc;CXX=/usr/local/bin/g++;MPICXX=/usr/local/bin/mpicxx
    
    0 讨论(0)
  • 2020-12-04 22:54

    Unable to compile the native libxgboost.dylib library, maybe check this workaround

    0 讨论(0)
提交回复
热议问题