Menu

#278 omp_get_thread_num() prevent from building 7.6.0

v7.6.0
closed
nobody
None
1
2021-08-29
2020-03-01
No

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,

Discussion

  • Volker Wichmann

    Volker Wichmann - 2020-03-01

    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

     
  • Anonymous

    Anonymous - 2020-03-01

    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 -fopenmp and some references during the building process like SHLIB_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 fopenm. 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

     
  • Alberto Lazaro

    Alberto Lazaro - 2020-03-01

    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 -fopenmp and some references during the building process like SHLIB_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

     
  • Alberto Lazaro

    Alberto Lazaro - 2020-03-01

    (Sorry for double posting)

     
  • Volker Wichmann

    Volker Wichmann - 2020-03-02

    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

     
  • Alberto Lazaro

    Alberto Lazaro - 2020-03-02

    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,

     
  • Alberto Lazaro

    Alberto Lazaro - 2020-03-02

    A link for a propused solution: https://github.com/gprMax/gprMax/issues/134
    I'll let you know in case it works.

     
  • Anonymous

    Anonymous - 2020-03-20

    ...with commit [1240ff] saga should also compile without having omp installed again!
    stay healthy and safe, olaf...

     

    Related

    Commit: [1240ff]

  • Alberto Lazaro

    Alberto Lazaro - 2020-03-21

    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,

     
  • Volker Wichmann

    Volker Wichmann - 2021-08-29

    I'm closing this as the original bug (building without OpenMP) has been fixed.

     
  • Volker Wichmann

    Volker Wichmann - 2021-08-29
    • status: unread --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB