Hi,
I'm trying to compile SAGA 7.6.0 and 7.6.1 with GDAL 3.0.4 and PROJ 6.3.1 based on Homebrew OSGeo4Mac formula in macOS Catalina and I'm finding the following issue:
crs_transform_shapes.cpp:315:17: error: use of undeclared identifier 'omp_get_thread_num'
int Thread = omp_get_thread_num();
^
1 error generated.
crs_transform_grid.cpp:372:21: error: use of undeclared identifier 'omp_get_thread_num'
if( !m_Projector[omp_get_thread_num()].Get_Projection(xSource, ySource = yTarget) )
^
make[4]: *** [crs_transform_shapes.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
1 error generated.
make[4]: *** [crs_transform_grid.lo] Error 1
I thought it could be related to OpenMP, but I'm using these flags for the building process. One of them is "disable OpenMP" as it's recommended in the "Compile from source" guide.
--disable-dependency-tracking
--disable-openmp
--disable-libfire
--enable-shared
--enable-debug
--enable-gui
Besides, I'm running 7.5.0 version built from the same formula without any issue. May it come from a change in 7.6.0 branch? Could you suggest me a fix or workaround?
Thank you,
Anonymous
I apologise, I forgot to include the URL of the building formula, just in case.
https://github.com/OSGeo/homebrew-osgeo4mac/blob/master/Formula/osgeo-saga.rb
I'm also adding output from the building process from when I extracted the message
https://circleci.com/api/v1.1/project/github/OSGeo/homebrew-osgeo4mac/6247/output/107/0?file=true&allocation-id=5e53b991359ae3731e4985f6-0-build%2F197B6795
Thank you in advance for your effort maintaining and improving SAGA. It's awesome!
Hi Alberto,
seems like we have, somehow unintended, made OpenMP a build requirement for SAGA 7.6.0 (while implementing multithreading within the proj4 tools). Until then, the code could also be build without OpenMP.
Is there any reason that you want to disable OpenMP? I had hoped that OpenMP support is better on MacOSX in the meantime.
Best regards,
Volker
Hi Voker,
Thanks a lot for the quick replay. To be honest, I'm really looking forward to get OpenMP functionality in macOS, but I haven't been sure how to do it and so I sticked up with the guide in this wiki.
In macOS, I've used "libomp" to get OpenMP for some R packages, where I needed to add a flag
-fopenmpand some references during the building process likeSHLIB_OPENMP_CFLAGS=-fopenmp. The reference can be seen in this URL.Similarly, in the
configure.acfile from SAGA 7.6.1 I saw a mention to the lib "gomp" which also leads tofopenm. However, I don't really know how to go on.Would you know how I should do or could you give some advices?
Best regards,
Alberto
Hi Voker,
Thanks a lot for the quick replay. To be honest, I'm really looking forward to get OpenMP functionality in macOS, but I haven't been sure how to do it and so I sticked up with the guide in this wiki.
In macOS, I've used "libomp" to get OpenMP for some R packages, where I needed to add a flag
-fopenmpand some references during the building process likeSHLIB_OPENMP_CFLAGS=-fopenmp. The reference can be seen in this URL.Similarly, in the configure.ac file from SAGA 7.6.1 I saw a mention to the lib "gomp" which also leads to
fopenmp. However, I don't really know how to go on.Would you know how I should do or could you give some advices?
Best regards,
Alberto
(Sorry for double posting)
Hi Alberto,
usually it is sufficient to have OpenMP installed on your system. In "configure.ac" there is a test for this (line 34):
AC_CHECK_LIB([gomp], [omp_get_num_threads], GOMPFOUND=1,,)
If it evaluates to "true", the required compiler flags get set (line 171):
GOMPFLAGS="-fopenmp -lgomp"
To summarize: in order to build with OpenMP it should be enough to have the "libgomp" installed and to omit the --disable-openmp configure flag.
Best regards,
Volker
Hi Volker,
I see. I reckon in macOS the library is called "libomp", instead of libgomp and maybe that's why it isn't found?. I will try to symlink them to "libomp" in order to give a new try and I'll let you know.
Cheers,
A link for a propused solution: https://github.com/gprMax/gprMax/issues/134
I'll let you know in case it works.
...with commit [1240ff] saga should also compile without having omp installed again!
stay healthy and safe, olaf...
Related
Commit: [1240ff]
Hi Olaf,
Thank you very much for the effort. That's great!
I am afraid I haven't been able to figure a fix out for macOS flags to build with OpenMP yet.
Best regards,
I'm closing this as the original bug (building without OpenMP) has been fixed.