fatal error: 'omp.h' file not found - macos

I'm trying to compile my OpenMP program, but it doesn't work, this error message shows:
fatal error: 'omp.h' file not found
I've tried the solutions for this problem here, but nothing worked with me.
please help
I'm Mac user

You probably need to reinstall with:
brew reinstall gcc --without-multilib
Then you need to make sure you use the homebrew version of gcc (rather than anything Apple supplies) by running gcc-5 rather than plain gcc. You can check its name and version by running the following because homebrew normally always installs everything to /usr/local/bin:
ls /usr/local/bin/gcc*
Finally, you need to add the -fopenmp flag to your compiler invocation to tell the compiler to do the OpenMP thing.
So, your command will look like:
gcc-5 -fopenmp program.c -o program

Related

Error while trying trying to run make command

I am trying to install a program and when I run make or make -f Makefile (following the installation instructions) I get the following output:
g77 -O5 -Wall -c prep_output.f -o prep_output.o
dyld: Symbol not found: ___keymgr_global
Referenced from: /usr/local/bin/g77
Expected in: /usr/lib/libSystem.B.dylib
make: *** [prep_output.o] Abort trap: 6
I am working on a macOS Mojave 10.14.6. Following some other proposed solutions in similar problems, I've already installed Command line tools in my Xcode but that didn't do the trick. Any suggestions please??
Thanks in advance
EDIT:
I got rid of g77 and installed a compatible version of gcc (gcc8) through MacPorts. After running the make command I get the following:
g77 -O5 -Wall -c prep_output.f -o prep_output.o
make: g77: No such file or directory
make: *** [prep_output.o] Error 1
So I guess the program still needs the g77 setup? This is the program btw ([http://www.cfht.hawaii.edu/~arnouts/LEPHARE/install.html]). Is there a way to rely to the gfortran compiler for building the program?
Thanks in advance
P.S. I noticed that when I install g77 I get the following error:
x usr/local/: Can't set user=0/group=0 for usr/local`
`tar: Error exit delayed from previous errors.
However it still installs g77..
The error message indicates that your installation of g77 is broken. This has nothing to do with make or the particular project you're trying to build, except inasmuch as the project is trying to use g77 in the first place. That is a bit surprising, actually, since g77 has been obsolete for years (gfortran is the current GNU Fortran compiler), but I'm uncertain what exactly to expect from XCode in this area.
On the other hand, since the full path to the binary is /usr/local/bin/g77, I'm further inclined to think that you're not using XCode for this at all. Possibly you've dumped a g77 built on some other system into your /usr/local/bin, and it's not compatible with your Mojave system.
Your best bet is probably to
Get rid of your broken g77 installation.
Install Fink or MacPorts, or a similar project.
Install the Fink / MacPorts / whatever package for gfortran (maybe gcc-gfortran or similar in some of those) to get a working Fortran compiler.
Rely on that compiler to build your project.

Cython compilation errors: '-mno-fused-madd'

Whenever I compile Cython code (using pyximport) and frequently when I install packages from source (with pip) I get
clang: warning: argument unused during compilation: '-mno-fused-madd'
What is this warning and what can I do to prevent it? I suspect I may not be able to prevent when pip triggers it, but is thre at least some way to configure pyximport to avoid it?
OS X 10.9, Python 2.7.5, Xcode clang 500.2.79
The answer before didn't work for me, but it worked this to tell clang to ignore these error messages:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
Solution found in clang error: unknown argument: '-mno-fused-madd' (python package installation failure)
-mno-fused-madd is a gcc cpu target option. It is for enabling/disabling the generation of the fused multiply/add instructions (FMACs. Common in DSPs).
Since this is gcc-specific, clang gives a warning that it doesn't understand the option.
If you really don't want to see this warning you could try setting the default compiler by
env CC=/usr/bin/gcc pip install ...
This should also work for pyximport too (But I haven't tried).

RVM installation of ruby-2.0.0-p247 fails on OSX 10.7

I've been trying to install Ruby 2 on my machine running OSX 10.7 via rvm, but run into compilation issues no matter what I try.
So far, I've tried using the OSX GCC Installer, have reinstalled Xcode twice (tried the DMG first, then the App store), and have reinstalled the command line tools.
Compilation fails for both gcc and clang.
Here is what it is failing on (from ~/.rvm/src/ruby-2.0.0-p247/config.log):
configure:3776: checking whether the C compiler works
configure:3798: /usr/bin/clang --I/usr/local/opt/freetype/include -L/usr/local/opt/freetype/lib conftest.c >&5
clang: error: unsupported option '--I/usr/local/opt/freetype/include'
This causes ./configure to output checking whether the C compiler works... no.
As far as I can see, the correct syntax for the option should be -I, rather than --I - how can I get configure to use the correct option?
EDIT: Compiling from source without using rvm results in the same issue.
It turns out that my CPPFLAGS environment variable was the culprit.
Running CPPFLAGS='-I/usr/local/opt/freetype/include' rvm install ruby-2.0.0-p247 did the trick.

ld: library not found for -lgsl

I'm working in OSX and I'm attempting to run a make file and when I try I get the following:
ld: library not found for -lgsl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [harm] Error 1
Earlier I found out the I needed to get the gsl library and I used mac ports and typed:
sudo port install gsl
into my command line window and it seemed to isntall okay. Is the missing lgsl not configured correctly or does it not come with gsl? I tried googling lgsl but didn't get much. I've only been at programming a few days and I don't know if I was supposed to set a path, or even really how to do that.
Thanks for any help you guys could offer.
I just wanted to say that I had the exact problem on OSX. Rather than setting an environment variable, I used an additional compiler flag -L/opt/local/lib, which then lets one use -lgsl. I reference this answer.
I got the same issue and here is how I fixed it:
export LIBRARY_PATH=/usr/local/Cellar/gsl/1.16/lib/
I had previously installed gsl using:
brew install gsl
You need to add the path for where the macports installed the gsl library to your LD_LIBRARY_PATH environment variable (or most likely into the build script environment). I believe macports stores things in /opt/local/lib

How to build boost with mpi support on homebrew?

According to this post (https://github.com/mxcl/homebrew/pull/2953), the flag "--with-mpi" should enable boost_mpi build support for the related homebrew formula, so I am trying to install boost via homebrew like this:
brew install boost --with-mpi
However, the actual boost mpi library is not being build and can not be found.
There is currently some work being done around this, according to: https://github.com/mxcl/homebrew/pull/15689
In summary, I can currently build boost, but it seems the "--with-mpi" flag is being ignored. Could someone please check, if I should be able to build boost (with mpi support) on Mac OS X Mountain Lion (10.8)?
The (verbose) output generates these lines:
MPI auto-detection failed: unknown wrapper compiler mpic++
Please report this error to the Boost mailing list: http://www.boost.org
You will need to manually configure MPI support.
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
Not sure how exactly I can fix this and get the mpi stuff to be build - any ideas?
Just in case this helps anyone else along the line, here's how I fixed this. The main error is MPI auto-detection failed: unknown wrapper compiler mpic++, any typing mpic++ at the command line verified that it was not working properly for me. I used brew to install open-mpi, but the same error was showing in the verbose output for installing boost. A run of brew doctor showed that openmpi was not linked properly, so I fixed those errors and reran brew -v install boost --with-mpi --without-single and it finally built and installed all of the libraries without a problem
To anyone that comes across this, the package migrated to boost-python and boost-mpi separate from boost. Use brew install boost-mpi
Just get it worked on OSX 10.11.5. I've tried brew, but with no luck.
Suppose you already have gcc installed. Here are what I've done:
1. Find and disable (but do not remove) clang
clang alway cause headaches. There would be a lot of warnings when building Boost.
which clang, which should give you /usr/bin/clang
Rename it: sudo mv clang clang_mac_remove, also for clang++: sudo mv clang++ clang++_mac_remove. You can change the names back if you need them in future.
2. Install OpenMPI
If you already installed using brew, uninstall first. Becasue it would have used clang as the compiler wrapper by default. You need to change the wrapper to gcc.
Download the package.
Specify the wrapper compiler to gcc and g++:
./configure CC=gcc CXX=g++ F77=ifort FC=ifort --prefix=/usr/local
Below may take a long time.
make all
sudo make install
Reference: https://wiki.helsinki.fi/display/HUGG/Open+MPI+install+on+Mac+OS+X
3. Install Boost MPI
Download the package.
Run ./bootstrap.sh (can open it first and specify the toolset to gcc, otherwise, the default option is darwin for mac).
Add using mpi ; in project-config.jam file. Then ./b2 —with-mpi will only build the mpi library.
Then, all built libraries can be found in the folder ~/Downloads/boost_1_61_0/stage/lib.
Copy or move them to /usr/local/lib or any other commonly used library path.
Reference: http://www.boost.org/doc/libs/1_61_0/doc/html/mpi/getting_started.html
4. Compile with Boost MPI
LIBRARY DIR = -L/usr/local/lib
INCLUDE = -I/usr/local/include/
LINKER = -lboost_mpi -lboost_serialization
e.g.
mpic++ -std=c++11 -I/usr/local/include/ -c boost_test.cpp -L/usr/local/lib -lboost_mpi -lboost_serialization
Good luck!

Resources