Giter VIP home page Giter VIP logo

Comments (30)

piotrek1543 avatar piotrek1543 commented on May 12, 2024 15

@Clovel after installing gcc --without-multilib try to run gcc specific version compiler:
gcc-7 -fopenmp hello_par.c -o hello_par

from lightgbm.

bartleusink avatar bartleusink commented on May 12, 2024 13

Compiling LightGBM with gcc-6 on OSX works:

brew install cmake gcc
cmake -DCMAKE_CXX_COMPILER=g++-6 CMakeLists.txt
make

from lightgbm.

brianpenghe avatar brianpenghe commented on May 12, 2024 9

brew install gcc --without-multilib

It generated this error:
Error: invalid option: --without-multilib

from lightgbm.

henryiii avatar henryiii commented on May 12, 2024 8

By the way, non-Apple LLVM on macOS works just fine, as well. Just use brew install llvm (that'll get 5.0, with OpenMP), and set up the environment for the compiler in /usr/local/opt/llvm.
In Sierra, with Apple Clang based on 3.9, and High Sierra, with Apple Clang based on 4.0, the OpenMP library is disabled on the built-in compiler. (even though the -fopenmp-targets option slipped through!)

from lightgbm.

Clovel avatar Clovel commented on May 12, 2024 6

Hi !

I'm trying to install gcc --without-multilib too, but the option seems to have disappeared from brew. The command given by @guolinke does'n work any more.

BTW, im on High Sierra, 10.13.1.

Any luck that you guys have a solution ?

Thanks,
Clovel

from lightgbm.

Yorko avatar Yorko commented on May 12, 2024 5

@bartleusink Thank you!
For me it finally worked.

If anybody's interested: I had to additionally link brew to gcc so that g++-6 is in path.

sudo chown -R $USER /usr/local/
brew link --overwrite gcc

from lightgbm.

Jemma1um avatar Jemma1um commented on May 12, 2024 5

@Clovel
I can't install with option of "--without-multilib" either.
But it's funny that, after I changed " gcc -fopenmp ...... " to " gcc-7 -fopenmp ......", it doesn't return clang error and works!
@piotrek1543 Thank you!

from lightgbm.

Yassunaga avatar Yassunaga commented on May 12, 2024 5

After installing gcc with
brew install gcc
You can run brew install gcc again and it will show its version.
After that, use
gcc-x -fopenmp file_name.c -o file_name
Replacing the "x" for the version shown in the terminal, using only the first number.

from lightgbm.

BeatriceGR avatar BeatriceGR commented on May 12, 2024 1

@Yorko Hi. I tried doing the brew link --overwrite gcc and got this error
Error: No such keg: /usr/local/Cellar/gcc

do you know why?

from lightgbm.

stajahlee avatar stajahlee commented on May 12, 2024 1

@piotrek1543 THANK YOU! Only solution after fighting for hours.

from lightgbm.

robcunha avatar robcunha commented on May 12, 2024 1

try with only -openmp...

from lightgbm.

Saroopashree avatar Saroopashree commented on May 12, 2024 1

Try compiling your .c file using gcc-6

gcc-6 hello.c -o hello -fopenmp

The above command worked for me in my OSX-10.15.2(Catalina) machine after binging with this problem for days

from lightgbm.

guolinke avatar guolinke commented on May 12, 2024

Actually, It is not tested on OSX now. Will fix soon

from lightgbm.

Yorko avatar Yorko commented on May 12, 2024

Maybe it'll work with Clang updated, I'll try.

from lightgbm.

chivee avatar chivee commented on May 12, 2024

hi, @Yorko , we currently doesn't have clear plan to support OSX (but it should have). However, this issue is caused by that OpenMP is needed by lightGBM for building, please refer to https://clang-omp.github.io/ for the instuctions

from lightgbm.

chivee avatar chivee commented on May 12, 2024

I'll close this issue first, please feel free to reopen if the problem still there after installing OpenMP properly.

from lightgbm.

sooheon avatar sooheon commented on May 12, 2024

On mac os sierra, installing OpenMPI with with homebrew and following instructions still resulted in same error. Installing using C++11 mode and with C++ MPI bindings (these were flags for the homebrew recipe) did not fix the error.

from lightgbm.

chivee avatar chivee commented on May 12, 2024

hi @sooheon , i'm not quite sure that you are confusing openMP with openMPI(or just an typo) which doesn't needed by lightGBM by default.
since I don't have an sierra , I'm not quite sure that apple clang has openMP supported on sierra. the 10.11 OSX has the clang version accord to ~3.7, and openMP was default supported since 3.8.

if you using gcc as your default compiler on sierra. the build should succeed.

from lightgbm.

sooheon avatar sooheon commented on May 12, 2024

Thank you I was indeed confusing OpenMPI and OpenMP

from lightgbm.

chivee avatar chivee commented on May 12, 2024

@bartleusink , thanks for your sharing

from lightgbm.

ktorimaru avatar ktorimaru commented on May 12, 2024

Same problem as BeatricGR! Any ideas?

from lightgbm.

guolinke avatar guolinke commented on May 12, 2024

@BeatriceGR @ktorimaru
Use following command to install gcc in osx:

brew install gcc --without-multilib

from lightgbm.

tanmayGIT avatar tanmayGIT commented on May 12, 2024

Please have a look at :
https://stackoverflow.com/a/50313990/3465857

from lightgbm.

itzzmeanmol avatar itzzmeanmol commented on May 12, 2024

Can anyone solve my issue:
clang: error: unsupported option '-fopenmp'

I am totally new to terminal and want to use openmp but I am getting above error; I copied and run all the above commands (as mentioned above) but the problem persists. Currently, I am using high Sierra 10.13.6.

from lightgbm.

chivee avatar chivee commented on May 12, 2024

@itzzmeanmol , we're testing compiler with Clang.

would you give a shot of the latest instruction doc

from lightgbm.

linonetwo avatar linonetwo commented on May 12, 2024

So in cmakelist we should set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp -std=c++17")?

from lightgbm.

yinhaosen avatar yinhaosen commented on May 12, 2024

@Yassunaga it works but why does specifying the version helps lol

from lightgbm.

Clovel avatar Clovel commented on May 12, 2024

@yinhaosen because calling gcc defaults to clang on macOS. You need to call GNU gcc

from lightgbm.

 avatar commented on May 12, 2024

Hi,

I have the same problem:

clang: error: unsupported option '-fopenmp'

If I do
brew install gcc:
gcc 9.2.0 is already installed, it's just not linked

gcc-9 -o omp_hello -fopenmp omp_hello.c

-bash: gcc-9: command not found

so
brew link gcc
but

Linking /usr/local/Cellar/gcc/9.2.0... 
Error: Could not symlink bin/gfortran
Target /usr/local/bin/gfortran
already exists. You may want to remove it:
  rm '/usr/local/bin/gfortran'

To force the link and overwrite all conflicting files:
  brew link --overwrite gcc

To list all files that would be deleted:
  brew link --overwrite --dry-run gcc

But I need to use Fortran as well! Could you help me??
Kind regards,
Nico

from lightgbm.

brunoamorim13 avatar brunoamorim13 commented on May 12, 2024

After trying to run with gcc-9 I'm getting the following message:

Undefined symbols for architecture x86_64: "std::ios_base::Init::Init()", referenced from: __static_initialization_and_destruction_0(int, int) in cczeen3H.o "std::ios_base::Init::~Init()", referenced from: __static_initialization_and_destruction_0(int, int) in cczeen3H.o "std::cout", referenced from: _main in cczeen3H.o "std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from: _main in cczeen3H.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status

What can I do to try and run with the -fopenmp?

from lightgbm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.