Problems using OpenMP

Steve Kargl sgk at troutmask.apl.washington.edu
Thu Jun 1 02:45:30 UTC 2017


On Wed, May 31, 2017 at 08:56:18PM -0500, Pedro Giffuni wrote:
> 
> FWIW, I tried using OpenMP in a port (hypre) and I thought the option 
> would be something as simple as this:
> 
> OPENMP_CONFIGURE_WITH=    openmp
> OPENMP_CONFIGURE_USES=    compiler:openmp
> 
> Unfortunately that is not enough:
> 
> ...
> 
> In file included from ./_hypre_utilities.h:16:
> ./HYPRE_utilities.h:29:10: fatal error: 'omp.h' file not found
> #include <omp.h>
>           ^~~~~~~
> --- amg_linklist.o ---
> ...
> 
> And the file is here:
> 
> /usr/local/lib/gcc5/gcc/x86_64-portbld-freebsd11.0/5.4.0/include/omp.h
> /usr/local/llvm39/lib/clang/3.9.1/include/omp.h
> 
> Which is not really clean to include :(. Any suggestion?
> 

This is similar to the problem with having to find -Wl,-L/usr/local/... to 
find gfortran's shared libraries.  For gfortran you can do

#! /bin/sh
LD_LIBRARY_PATH=$HOME/work/lib
export LD_LIBRARY_PATH
LD_RUN_PATH=$HOME/work/lib
export LD_RUN_PATH
PATH=$HOME/work/bin:$PATH
gfortran $@

gcc has a C_INCLUDE_PATH environmental variable.  Don't know if this
works with gfortran or if there is a GFORTRAN_INCLUDE_PATH.


This does not work with flang as she does not support LD_LIBRARY_PATH or
LD_RUN_PATH.  For openmp, and in particularly for the old fashion omp.h
file, you'll need to add an appropriate -I/path/to/omp... stuff to your
FFLAGS.  You can add -I/usr/local/flang/include to /usr/local/bin/flang
as it is a simple Bourne shell script.

-- 
Steve
20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4
20161221 https://www.youtube.com/watch?v=IbCHE-hONow


More information about the freebsd-ports mailing list