abess-team/abess

openmp wasn't detected on mac with installed llvm and libomp

yqy6611 opened this issue · 3 comments

Describe the bug

I have installed llvm and libomp successfully and set configure arguments, yet openmp still couldn't be detected.

Code for Reproduction

install.packages('abess', type = 'source')

Desktop (please complete the following information):

  • OS: macOS sonoma
  • R Version: 4.4.1
  • Package Version: 0.4.9

Screenshots

  • installing source package ‘abess’ ...
    ** package ‘abess’ successfully unpacked and MD5 sums checked
    ** using staged installation
    checking whether the C++ compiler works... yes
    checking for C++ compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether the compiler supports GNU C++... yes
    checking whether /opt/homebrew/opt/llvm/bin/clang++ accepts -g... yes
    checking for /opt/homebrew/opt/llvm/bin/clang++ option to enable C++11 features... none needed
    checking how to run the C++ preprocessor... /opt/homebrew/opt/llvm/bin/clang++ -E
    checking for gcc... /opt/homebrew/opt/llvm/bin/clang
    checking whether the compiler supports GNU C... yes
    checking whether /opt/homebrew/opt/llvm/bin/clang accepts -g... yes
    checking for /opt/homebrew/opt/llvm/bin/clang option to enable C11 features... none needed
    checking how to run the C preprocessor... /opt/homebrew/opt/llvm/bin/clang -E
    Spectra library exists.
    Complier code exists in src/ directory. Install R package according to the complier code.
    checking whether OpenMP will work in a package... no
    OpenMP is unavailable on this Mac OSX system. Training speed may be suboptimal.
    To use all CPU cores for training jobs, you should install OpenMP by running

           brew install libomp
    

configure: creating ./config.status
config.status: creating src/Makevars

Attached is my ~/.R/Makevars:

CC=/opt/homebrew/opt/llvm/bin/clang
CXX=/opt/homebrew/opt/llvm/bin/clang++
CFLAGS += -Xclang -fopenmp
LDFLAGS += -L/opt/homebrew/opt/libomp/lib -lomp
CPPFLAGS += -I/opt/homebrew/opt/libomp/include

@yqy6611 Thanks for the report. It may take some time to fix this issue. However, we’ve found that abess can run quickly without using OpenMP, so you should still be able to use abess as usual for most tasks.

@Mamba413 Well noted.