libgomp and MacOsx - macos

I am using MacOS Mojave version 10.14.16 and I am trying to install http://www.rpl2.net/index.php (a programming language using Reverse Polish Notation as found on some HP calculators like the 48GX), supposed to work on MacOSX (they say "MacOS X (Xcode 3.1.4 + gfortran 4.5)").
So I have downloaded the latest stable release, cd to the folder, and wanted to run
./configure
make
make install
But the ./configure is failing due to "configure: error: Can not find libgomp !". There is no libgomp package I can install with brew (I already installed gcc which comes with gfortran and thought it would provide libgomp but apparently not).
Could someone help a poor applied mathematician trying to install a software on its macbook?
Thanks
EDIT
in my config.log I have this, maybe it will help:
configure:7433: checking for vim
configure:7449: found /usr/bin/vim
configure:7461: result: yes
configure:7507: checking for main in -lm
configure:7526: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lm >&5
configure:7526: $? = 0
configure:7535: result: yes
configure:7548: checking for pthread_mutex_init in -lc
configure:7573: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lc -lm >&5
configure:7573: $? = 0
configure:7582: result: yes
configure:7687: checking for omp_get_num_procs in -lgomp
configure:7712: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lgomp -lc -lm >&5
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:7712: $? = 1

You don't say how you installed GCC. If you did it using homebrew, and
brew install gcc
you should be able to see:
/usr/local/Cellar/gcc/10.2.0/lib/gcc/10/libgomp.dylib
which would mean you need to compile with:
gcc ... -L /usr/local/Cellar/gcc/10.2.0/lib/gcc/10 -l gomp ...
Failing that, you can always search for libgomp with:
find /usr -name "lib*gomp*lib"
You can test which gcc you are using with:
type gcc

Related

OpenMP with g++ MacOS on Sierra

I have a makefile with the following that I'm trying to make on macOS Sierra:
CPP = g++
CPPFLAGS = -m64 -fopenmp -O3
and I keep getting the error clang: error: unsupported option '-fopenmp'.
I did
brew install libomp
brew install llvm
brew install gcc
These all were successful but I still get the same error. Would appreciate any suggestions!
There are a number of options...
As you have installed llvm with homebrew, you can compile C++ code using OpenMP with:
/usr/local/Cellar/llvm/9.0.0/bin/clang++ -fopenmp main.cpp -o main
As you have installed GCC with homebrew, you can compile C++ code using OpenMP with:
/usr/local/bin/g++-9 -fopenmp main.cpp -o main
As you have installed libomp, you can use that with the Apple-supplied clang++ (note it is not in /usr/local because it is supplied by Apple) to compile C++ with OpenMP with:
/usr/bin/clang++ -I/usr/local/include -Xpreprocessor -fopenmp -L/usr/local/lib -lomp main.cpp -o main

clang: error: unsupported option '-fopenmp'. Change default compiler?

I am on a Mac but I am not a Mac user. I need to run a make command (actually make makewisdom) to compile a software, but my compiler does not recognize some commands:
$ make makewisdom
gcc -I/Users/username/presto/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include -I -I/opt/local/include -DUSEFFTW -DUSEMMAP -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -Wall -W -fPIC -O3 -ffast-math -Wno-unused-result -Wno-unused-but-set-variable -Wno-unused-but-set-parameter -fopenmp -o makewisdom makewisdom.c -L/opt/local/lib -lfftw3f
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [makewisdom] Error 1
I know the problem is with clang. I am reading lots of discussions (such this and this, and more), and trying to workaround the problem, but no luck yet. It maybe that I just need to set a different default compiler? (to, for example, gcc, whatever is the version I have installed):
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Can't find libunistring when building guile from nonstandard location

I'm trying to build Guile 2.2.
I've installed libunistring to /path/to/libunistring.
When I run
./configure --with-libunistring-prefix=/path/to/libunistring/
it fails, because it can't find libunistring.
configure:15954: checking for libunistring
configure:15976: gcc -std=gnu11 -o conftest -g -O2 conftest.c -lunistring >&5
conftest.c:158:21: fatal error: uniconv.h: No such file or directory
#include <uniconv.h>
How do I fix this?
The configure script is searching for /path/to/libunistring/lib64/. I believe you have only /path/to/libunistring/lib/.
% ln -s /path/to/libunistring/lib /path/to/libunistring/lib64

Alien::wxWidgets install fails on OSX 10

It's basically the same as this one which didn't really ended up.
I'm facing the same issue and I went a bit further. I had to change the code to allow a newer Macos sdk (10.11). So it compiled for a while but then failed whith this:
❯❯❯ perl build
Building Alien-wxWidgets
/Users/guiohm/.cpan/build/Alien-wxWidgets-0.67-rVjMTK/wxWidgets-3.0.2/bld/bk-deps clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -c -o wxtiff_tif_lzma.o -DNDEBUG -I../src/jpeg -I/Users/guiohm/.cpan/build/Alien-wxWidgets-0.67-rVjMTK/wxWidgets-3.0.2/bld/src/tiff/libtiff -I../src/tiff/libtiff -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -I/Users/guiohm/.cpan/build/Alien-wxWidgets-0.67-rVjMTK/wxWidgets-3.0.2/bld/lib/wx/include/osx_cocoa-unicode-3.0 -I../include -Wall -Wundef -O2 -fno-strict-aliasing -fno-common ../src/tiff/libtiff/tif_lzma.c
../src/tiff/libtiff/tif_lzma.c:38:10: fatal error: 'lzma.h' file not found
#include "lzma.h"
^
1 error generated.
make: *** [wxtiff_tif_lzma.o] Error 1
system: make all: 512 at build line 68.
❯❯❯ brew search
lzma is now part of the xz formula.
❯❯❯ brew info
xz: stable 5.2.2 (bottled)
General-purpose data compression with high compression ratio
http://tukaani.org/xz/
/usr/local/Cellar/xz/5.2.2 (91 files, 1.4M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/xz.rb
==> Options
--universal
Build a universal binary
❯❯❯ brew install xz
Warning: xz-5.2.2 already installed
❯❯❯ find / -name "lzma.h"
/usr/local/Cellar/xz/5.2.2/include/lzma.h
/usr/local/include/lzma.h
❯❯❯ ll /usr/local/include/lzm*
lrwxr-xr-x 1 guiohm admin 31 Oct 11 15:58 /usr/local/include/lzma -> ../Cellar/xz/5.2.2/include/lzma
lrwxr-xr-x 1 guiohm admin 33 Oct 11 15:58 /usr/local/include/lzma.h -> ../Cellar/xz/5.2.2/include/lzma.h
The weird thing is when I checked the config logs:
This one (./wxWidgets-3.0.2/bld/src/tiff/config.log) has other errors than lzma, for instance:
configure:18047: checking for lzma_code in -llzma
configure:18072: clang -o conftest -g -O2 -Wall -W -stdlib=libc++ conftest.c -llzma -ljpeg -lz >&5
configure:18072: $? = 0
configure:18081: result: yes
configure:18096: checking lzma.h usability
configure:18096: clang -c -g -O2 -Wall -W conftest.c >&5
configure:18096: $? = 0
configure:18096: result: yes
configure:18096: checking lzma.h presence
configure:18096: clang -E conftest.c
configure:18096: $? = 0
configure:18096: result: yes
configure:18096: checking for lzma.h
configure:18096: result: yes
configure:18199: checking for X
configure:18307: clang -E conftest.c
conftest.c:89:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
^
1 error generated.
configure:18307: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "LibTIFF Software"
| #define PACKAGE_TARNAME "tiff"
See the full version.
Ans it's more or less the same with ./wxWidgets-3.0.2/bld/config.log.
When I changed the code to allow os10.10 SDK, it was previously expecting up to 10.8 or maybe 10.9. I suppose the whole issue comes now from this.
Should I try to fetch an old MacOS SDK?
Basically, I just want to compile Slic3r --gui from source, which requires Wx, which requires wxwidgets.
The problem here is that libtiff configure detects lzma.h under /usr/local because it doesn't use -isysroot, but its compilation does, because of the SDK option, and fails to find it. The right thing to do would be to use -I/usr/local/include explicitly in wxWidgets configure, but for now you should be able to work around this by doing export CPATH=/usr/local/include LIBRARY_PATH=/usr/local/lib to bypass it.
Alternatively (and IMHO preferably), do brew install tiff jpeg png (not sure that the formulae names are correct, please check them) to avoid building the builtin versions of these libraries in the first place.
Running brew install xz fixed the issue for me.
See https://stackoverflow.com/a/37594849/6381715

Install xgboost on Mac - ld: library not found

I am trying to install OpenMP enabled xgboost on my mac. I installed gcc with no problem:
brew install gcc --without-multilib
then cloned git repository:
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/config.mk ./config.mk
but I get an error when I do
make -j4
Here is the error I get. I'd appreciate if you can help fixing this problem:
c++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -o xgboost build/cli_main.o build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit.a -pthread -lm -fopenmp
c++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -fopenmp -shared -o lib/libxgboost.so build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit.a -pthread -lm -fopenmp
clangclang: : warningwarning: : argument unused during compilation: '-pthread'argument unused during compilation: '-pthread'
ld: library not found for -lgomp
ld: library not found for -lgomp
clang: error: clanglinker command failed with exit code 1 (use -v to see invocation):
error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libxgboost.so] Error 1
make: *** Waiting for unfinished jobs....
make: *** [xgboost] Error 1
I have the same issue and solved it by:
brew install clang-omp
export CC=clang-omp
export CXX=clang-omp++
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/config.mk ./config.mk; make -j4
cd python-package
sudo python setup.py install
If you used pip to install xgboost before, then delete the previous installed xgboost from your project. Then use
pip install xgboost
to install it again.
A new versions of OSX has a Clang as a default c\c++ compiler. Therefore your c++ command refers to clang++.
You should define a CC\CXX environmental variables for your make command like this CC=gcc CXX=g++ make -j
Also you can build an OpenMP for clang OpenMPrt and customise your shell environment (I didn't try this by own)
(I have no mac at this moment to check this solution; just linux)

Resources