homebrew-core
homebrew-core copied to clipboard
GRASS 8.2 (new formula)
Added a new formula for GRASS GIS 8.2.0.
@carlocab Thank you for your detailed suggestions! I will work them and follow-up with another PR.
Please don't make a new pull request. Just push your changes here.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@alexm98 (perhaps also @nilason): is anything missing here? Would be a pity to see this PR lost.
@alexm98 (perhaps also @nilason): is anything missing here? Would be a pity to see this PR lost.
I agree. And by the look of it this is not far from working.
Just a note: --enable-macosx-app is broken. At the moment there is no way to make yourself a proper Mac app using GRASS sources.
The https://github.com/OSGeo/grass/blob/main/macosx/app/Info.plist.in is for example modernised however and may be used to make an "app-shell" (see https://github.com/nilason/grass-conda/blob/df392f3814b9cb0a908d4361a87ab9f7283d6b54/build-grass.sh#L163).
I don't know whether it is expected in brew world to create an *.app, just making grass available through command line is pretty straightforward.
Other examples to take cues from is https://github.com/macports/macports-ports/blob/master/gis/grass/Portfile (which includes above mentioned app-shell creation) and https://github.com/OSGeo/grass/pull/2661 for config settings.
In GRASS source dir: do ./configure --help for available options. E.g. no need for ffmpeg.
Also, why gcc, and not clang?
I suppose you need libomp for --with-openmp.
@nilason
gccis added only as a build dependency so that we can use the libraries and headers foropenmp. The problem is that if I only uselibomp, there will be noGOMP_parallel_startthat is checked for. We still build usingclang.
"--with-openmp",
"--with-openmp-includes=#{Formula["gcc"].opt_include}",
"--with-openmp-libs=#{Formula["gcc"].opt_lib}/gcc/current",
checking whether to use OpenMP... "yes"
checking for location of OpenMP includes... /opt/homebrew/opt/gcc/include
checking omp.h usability... yes
checking omp.h presence... yes
checking for omp.h... yes
checking for location of OpenMP library... /opt/homebrew/opt/gcc/lib/gcc/current
checking for GOMP_parallel_start... no
checking for GOMP_parallel_start in -lgomp... yes
As opposed to using libomp, ./configure will not find GOMP_parallel_start:
"--with-openmp-includes=#{Formula["libomp"].opt_include}",
"--with-openmp-libs=#{Formula["libomp"].opt_lib}",
checking whether to use OpenMP... "yes"
checking for location of OpenMP includes... /opt/homebrew/opt/libomp/include
checking omp.h usability... yes
checking omp.h presence... yes
checking for omp.h... yes
checking for location of OpenMP library... /opt/homebrew/opt/libomp/lib
checking for GOMP_parallel_start... no
checking for GOMP_parallel_start in -lgomp... no
configure: error: *** Unable to locate OpenMP library
Altough, if we look at the GitHub actions for the last commit where gcc libraries and headers we're used for openmp support, the build fails.
checking whether to use OpenMP... "yes"
checking for location of OpenMP includes... /opt/homebrew/opt/gcc/include
checking omp.h usability... no
checking omp.h presence... no
checking for omp.h... no
configure: error: *** Unable to locate OpenMP includes.
This does not happen on my machine with:
"--with-openmp",
"--with-openmp-includes=#{Formula["gcc"].opt_include}",
"--with-openmp-libs=#{Formula["gcc"].opt_lib}/gcc/current",
I have no experience with homebrew, so I cannot tell how things are or should be (just have to make that clear).
I would test with adding
depends_on "libomp" => :build
dropping:
depends_on "gcc" => :build
keep:
"--with-openmp"
but try with dropping:
"--with-openmp-includes="
"--with-openmp-libs=
in case they will be found by default.
I have no experience with homebrew, so I cannot tell how things are or should be (just have to make that clear).
I would test with adding
depends_on "libomp" => :builddropping:depends_on "gcc" => :buildkeep:
"--with-openmp"but try with dropping:
"--with-openmp-includes=""--with-openmp-libs=in case they will be found by default.
This does not seem to work though. Still not able to find GOMP_parallel_start
checking whether to use OpenMP... "yes"
checking for location of OpenMP includes...
checking omp.h usability... yes
checking omp.h presence... yes
checking for omp.h... yes
checking for location of OpenMP library...
checking for GOMP_parallel_start... no
checking for GOMP_parallel_start in -lgomp... no
configure: error: *** Unable to locate OpenMP library.
Adding gcc as a build depency but without pointing to the openmp libs and includes has the same effect.
Let us return to OpenMP later. Will it work without setting it at all?
Is capital LIB intentional:
"--with-libs=#{HOMEBREW_PREFIX}/LIB",
?
It does work without openmp support. Altough as you mentioned, the --enable-macosx-app does not create a proper macos .app.
Is capital LIB intentional:
"--with-libs=#{HOMEBREW_PREFIX}/LIB",?
Totally unintentional.
Please correct it and try with openmp again
Please correct it and try with openmp again
Does not work with libomp nor gcc. It seems that not finding GOMP_parallel_start is still the problem
Looks like the library is not found.
Find out what you have installed: find /opt/homebrew -name "*omp.dylib" (or wherever you have HOMEBREW_PREFIX).
It is possible it is located in:
--with-openmp-libs=#{HOMEBREW_PREFIX}/lib/libomp
config.log might also give you important information on where configure looks for the lib. (If you don't mind, please share the config.log).
Looks like the library is not found. Find out what you have installed:
find /opt/homebrew -name "*omp.dylib"(or wherever you have HOMEBREW_PREFIX).It is possible it is located in:
--with-openmp-libs=#{HOMEBREW_PREFIX}/lib/libompconfig.log might also give you important information on where configure looks for the lib. (If you don't mind, please share the config.log).
I can use find to find the libraries:
/opt/homebrew/lib/libomp.dylib
/opt/homebrew/Cellar/llvm/15.0.3/lib/libomp.dylib
/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current/libgomp.dylib
/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/12/libgomp.dylib
/opt/homebrew/Cellar/libomp/15.0.5/lib/libomp.dylib
/opt/homebrew/Cellar/libomp/15.0.3/lib/libomp.dylib
/opt/homebrew/Cellar/libomp/14.0.6/lib/libomp.dylib
At some point in the config.log however:
configure:14608: checking whether to use OpenMP
configure:14610: result: "yes"
configure:14630: checking for location of OpenMP includes
configure:14637: result:
configure:14656: checking omp.h usability
configure:14656: gcc -c -g -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk -I/opt/homebrew/include conftest.c >&5
configure:14656: $? = 0
configure:14656: result: yes
configure:14656: checking omp.h presence
configure:14656: gcc -E -I/opt/homebrew/include conftest.c
configure:14656: $? = 0
configure:14656: result: yes
configure:14656: checking for omp.h
configure:14656: result: yes
configure:14680: checking for location of OpenMP library
configure:14687: result:
configure:14706: checking for GOMP_parallel_start
configure:14706: gcc -o conftest -g -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk -I/opt/homebrew/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk -Wl,-rpath,${prefix}/GRASS-8.3.app/Contents/MacOS/lib,-rpath,${GISBASE}/lib -L/opt/homebrew/lib conftest.c >&5
Undefined symbols for architecture arm64:
"_GOMP_parallel_start", referenced from:
_main in conftest-196a3b.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:14706: $? = 1
The OpenMP issue starts to look like a limitation/bug in Grass configure. Will look into this. Meanwhile, let me suggest you to reopen the PR, if possible; drop for the time being openmp (so far only of relatively limited use in grass, not a must); and optionally manually create .app using https://github.com/OSGeo/grass/blob/main/macosx/app/Info.plist.in and https://github.com/OSGeo/grass/blob/main/macosx/app/AppIcon.icns.
Looks like the library is not found. Find out what you have installed:
find /opt/homebrew -name "*omp.dylib"(or wherever you have HOMEBREW_PREFIX).It is possible it is located in:
--with-openmp-libs=#{HOMEBREW_PREFIX}/lib/libompconfig.log might also give you important information on where configure looks for the lib. (If you don't mind, please share the config.log).
Ok so it seems that
"--with-openmp",
"--with-openmp-includes=#{HOMEBREW_PREFIX}/opt/libomp/include",
"--with-openmp-libs=#{HOMEBREW_PREFIX}/opt/libomp/lib",
And also replacing -lgomp flag to -lomp in configure (since the libraries found in Formula["libomp"] are available for usage with gcc and not clang)
inreplace "configure", "-lgomp", "-lomp"
This way, I can get GRASS to compile "with openmp support".
checking whether to use OpenMP... "yes"
checking for location of OpenMP includes... /opt/homebrew/opt/libomp/include
checking omp.h usability... yes
checking omp.h presence... yes
checking for omp.h... yes
checking for location of OpenMP library... /opt/homebrew/opt/libomp/lib
checking for GOMP_parallel_start... no
checking for GOMP_parallel_start in -lomp... yes
GRASS is now configured for: aarch64-apple-darwin22.1.0
Source directory: /private/tmp/grass-20221128-24155-veqspd/grass-8.2.0
Build directory: /private/tmp/grass-20221128-24155-veqspd/grass-8.2.0
Installation directory: ${prefix}/GRASS-8.2.app/Contents/MacOS
Startup script in directory:${exec_prefix}/bin
C compiler: clang -g -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk
C++ compiler: clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk
Building shared libraries: yes
OpenGL platform: Aqua
MacOSX application: yes
MacOSX architectures:
MacOSX SDK: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk
BLAS support: yes
BZIP2 support: yes
C++ support: yes
Cairo support: yes
DWG support: no
FFTW support: yes
FreeType support: yes
GDAL support: yes
GEOS support: yes
LAPACK support: no
Large File support (LFS): yes
libLAS support: no
MySQL support: yes
NetCDF support: yes
NLS support: yes
ODBC support: yes
OGR support: yes
OpenCL support: yes
OpenGL support: yes
OpenMP support: yes
PDAL support: yes
PNG support: yes
POSIX thread support: yes
PostgreSQL support: yes
Readline support: yes
Regex support: yes
SQLite support: yes
TIFF support: yes
X11 support: yes
Zstandard support: yes
However, when I open the GRASS application resulted and run a command using nprocs, such as r.neighbors it will tell me that GRASS is compiled without OpenMP support.
you should probably include a llvm package instead of gcc
... probably together with libomp
@alexm98 Please try with https://github.com/OSGeo/grass/pull/2692.