Closed ahojukka5 closed 2 years ago
Good question. I don't know. I guess I managed to handle BLAS dependency by adding OpenBLAS to dependency list, but I think we also need LAPACK. I think the question is that is there BLAS and/or LAPACK development files available inside the cross-compile environment?
Do you have any pointers about how to tweak the build to point to LAPACK? When I build Gmsh this error message is in the logs:
$ grep -i blas -A1 ~/.julia/packages/Gmsh/eZVOZ/deps/usr/logs/gmsh.log
-- Could NOT find BLAS (missing: BLAS_LIBRARIES)
CMake Warning at CMakeLists.txt:495 (message):
Could not find Blas or Lapack: most meshing algorithms will not be
functional
and presumably as a result, when I try to generate a mesh, I get
Error : Singular value decomposition requires LAPACK
and then a segfault. I'm building on a cluster, so my linear algebra libraries are installed in non-standard locations. Do you have pointers about how I can point Gmsh/BinaryBuilder to the right directories/libraries? I see the cmake command here but I can't figure out where that file is so I can edit it.
I think the right way to go is to use binary dependencies, just like with OpenBLAS
Here is an example how to use julia Lapack: https://github.com/TeroFrondelius/umat_binaries_builder/blob/242ebd1c3f1d04bc2780d0d0b684c23a46ea1008/build_tarballs.jl#L76
I think what I'm struggling with is how to edit build_tarballs.jl
. That file is part of GmshBuilder, but it's not clear to me how that gets called when I run ]add Gmsh
(or ]build Gmsh
). It doesn't appear to be anywhere in my .julia directory, for example:
$ find ~/.julia -name build_tarballs.jl
$
The only mention of GmshBuilder is here, which appears to only be used to download the source code:
$ grep -R -i GmshBuilder ~/.julia
/home/jkrometi/.julia/packages/Gmsh/eZVOZ/deps/build.jl:bin_prefix = "https://github.com/ahojukka5/GmshBuilder/releases/download/v4.4.1"
I can of course clone the GmshBuilder repo and edit build_tarballs.jl
. But how do I get that local version to be used when I run ]add Gmsh
? I apologize if this is a silly question but what Julia is doing under the hood here is very opaque to me.
(In addition, it's maybe worth mentioning that I have also Gmsh installed separately. So if I can just point Gmsh.jl to that installation, I'm also happy to do that.)
The package downloads pre-build binaries from here: https://github.com/ahojukka5/GmshBuilder/releases/tag/v4.4.1. The changes in building binaries should be made there. Download the tar file and check the structure. Use ln
to link missing libraries.
Oh I see now. It's just downloading prebuilt binaries and the Linux version is missing BLAS/LAPACK:
$ wget https://github.com/ahojukka5/GmshBuilder/releases/download/v4.4.1/gmsh.v4.4.1.x86_64-linux-gnu.tar.gz
$ mkdir gmsh.v4.4.1.x86_64-linux-gnu
$ tar xzf gmsh.v4.4.1.x86_64-linux-gnu.tar.gz -C gmsh.v4.4.1.x86_64-linux-gnu/
$ egrep -i 'blas|lapack' gmsh.v4.4.1.x86_64-linux-gnu/logs/gmsh.log
-- Could NOT find BLAS (missing: BLAS_LIBRARIES)
Could not find Blas or Lapack: most meshing algorithms will not be
By contrast, the Mac version has BLAS/LAPACK:
$ wget https://github.com/ahojukka5/GmshBuilder/releases/download/v4.4.1/gmsh.v4.4.1.x86_64-apple-darwin14.tar.gz
$ mkdir gmsh.v4.4.1.x86_64-apple-darwin14
$ tar xzf gmsh.v4.4.1.x86_64-apple-darwin14.tar.gz -C gmsh.v4.4.1.x86_64-apple-darwin14
$ egrep -i 'blas|lapack' gmsh.v4.4.1.x86_64-apple-darwin14/logs/gmsh.log
-- Found Blas[veclib]
-- Found Lapack[veclib]
-- * Build options: 64Bit Blas[veclib] Dlopen Lapack[veclib] Mesh TetGen/BR
I have been working with a colleague on some code using Gmsh and it was working for him and not for me. I assumed this was because he was on a desktop and I was on a cluster. But it turns out to be because he's on a Mac and I'm on Linux. I guess I need to edit build.jl to point it to the source tarball instead or maybe bypass all of this and just point to my external installation.
Okay it appears to be working now after the following steps (here $gmshdir
is where I wanted gmsh ultimately installed):
wget wget http://gmsh.info/src/gmsh-4.4.1-source.tgz #download
tar xzf v4.4.1.tar.gz #untar
cd gmsh-4.4.1-source
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$gmshdir -DDEFAULT=0 -DENABLE_BUILD_SHARED=1 -DENABLE_MESH=1 ..
lib
to lib64
since my installation created lib64
but Gmsh.jl looks for lib
:
ln -s 'lib64' $gmshdir/lib
~/.julia/packages/Gmsh/eZVOZ
is where Gmsh.jl was installed in my case):
cd ~/.julia/packages/Gmsh/eZVOZ/deps
rm -rf usr
ln -s "$gmshdir" usr
I could have not removed all of deps/usr
and instead just symlinked the gmsh library itself but it just seemed cleaner/safer to symlink the whole directory.
Thank you both for your help with this!
Hmm, so you didn't use a cross-compiling environment used in BinaryBuilder to make the binary at all?
No, I didn't - I just made sure that Julia and gmsh were built with the same compiler and other dependencies and it seemed to work, at least in initial testing. Is not using BinaryBuilder going to come back to bite me at some point? (Note: Not using BinaryBuilder was not a strategic choice - I just haven't used it before and figured I could build gmsh pretty easily on my own, so I just went ahead with that.)
Likely not, but it doesn't generalize. Thus we cannot use it to create binaries that should work for all. If we generate the binaries using BinaryBuilder, we can then distribute the binaries and everyone can easily install Gmsh.jl.
It looks like this is still an issue with the JLL binary? My students tell me that the Mac version has LAPACK but the Linux version gives a "LU factorization and substitution requires LAPACK" error.
I don't see any mention of a LAPACK or OpenBLAS dependency in the Yggdrasil build script, it seems like this needs to be added?
Should this issue be re-opened?
Did they run on master? There haven't been a release of thsi package in a while. Edit: https://github.com/JuliaRegistries/General/pull/63264
Thanks! Yes, updating to the latest version fixed the problem.
Can you use Blas/Lapack from LinearAlgebra, I mean the one that comes with julia?