Closed gareth-nx closed 7 months ago
Try using --profile release
.
I noticed this too when compiling with fpm, but I was unable to replicate the problem when I wrote the example tutorials for Gmsh, which I compiled manually. I think fpm is doing something wrong in the background but I haven't found time to look into it.
A bash script build example
#!/bin/bash
GMSH_LIB=../../build # path to libgmsh.so
FCFLAGS="-g -Wpedantic -Wpedantic -Wno-unused-function -Wno-maybe-uninitialized"
FLINKER="-L${GMSH_LIB} -Wl,-rpath=${GMSH_LIB} -lgmsh"
TEST="t14"
rm -f *.mod *.o *.msh
gfortran $FCFLAGS -o $TEST.o ../../src/gmsh.f90 $TEST.f90 $FLINKER
./$TEST.o
I was able to get it to work by adding --profile release
to fpm AND passing the --link-flag
option explicitly, like this:
# Path to the "lib" directory in the gmsh sdk
GMSH_SDK_LIB=/home/gareth/LocalInstalls/gmesh/gmesh_sdk/gmsh-git-Linux64-sdk/lib
export LD_LIBRARY_PATH=$GMSH_SDK_LIB:$LD_LIBRARY_PATH
## Works with release build, segfaults with debug build
FPM_PROFILE=release # debug
fpm build --link-flag "-L$GMSH_SDK_LIB" --profile $FPM_PROFILE
fpm run --example t13 --profile $FPM_PROFILE --link-flag "-L$GMSH_SDK_LIB" --runner cp -- example/fortran/ && pushd example/fortran/ && ./t13 && rm t13 && popd
The script is run in the gmsh-fpm
top directory. It fails if I use a debug
build or if I remove the --link-flag
option in the final line.
It might be good to add these flags to the README instructions, at least until the other issues are sorted out?
Just to be clear -- when it works I get a GUI popup with the mesh, and the terminal output below:
+ mkdir -p build/dependencies
gmsh.f90 done.
libgmsh.a done.
t13.f90 done.
t15.f90 done.
t10.f90 done.
t9.f90 done.
t12.f90 done.
t18.f90 done.
t1.f90 done.
t16.f90 done.
t2.f90 done.
t5.f90 done.
t17.f90 done.
t20.f90 done.
t11.f90 done.
t8.f90 done.
t6.f90 done.
t7.f90 done.
t19.f90 done.
t14.f90 done.
t21.f90 done.
t4.f90 done.
t3.f90 done.
main.f90 done.
t13 done.
t15 done.
t10 done.
t9 done.
t12 done.
t18 done.
t1 done.
t16 done.
t2 done.
t5 done.
t17 done.
t20 done.
t11 done.
t8 done.
t6 done.
t7 done.
t19 done.
t14 done.
t21 done.
t4 done.
t3 done.
gmsh done.
[100%] Project compiled successfully.
Project is up to date
~/Code_Experiments/fortran/gmsh-fpm/gmsh-fpm/example/fortran ~/Code_Experiments/fortran/gmsh-fpm/gmsh-fpm ~/Code_Experiments/fortran/gmsh-fpm/gmsh-fpm ~/Code_Experiments/fortran/gmsh-fpm/gmsh-fpm ~/Code_Experiments/fortran/gmsh-fpm/gmsh-fpm ~/Code_Experiments/fortran/gmsh-fpm/gmsh-fpm ~/Code_Experiments/fortran/gmsh-fpm/gmsh-fpm
Info : Clearing all models and views...
Info : Done clearing all models and views
Info : Reading '../t13_data.stl'...
Info : 1580 facets in solid 0 Created by Gmsh
Info : Done reading '../t13_data.stl'
Info : Classifying surfaces (angle: 40)...
Info : Found 11 model surfaces
Info : Found 12 model curves
Info : Done classifying surfaces (Wall 0.0137293s, CPU 0.070607s)
Info : Creating geometry of discrete curves...
Info : Done creating geometry of discrete curves (Wall 9.885e-05s, CPU 0.000509s)
Info : Creating geometry of discrete surfaces...
Info : [ 20%] Discrete surface 4 is planar, simplifying parametrization
Info : [ 70%] Discrete surface 9 is planar, simplifying parametrization
Info : [ 80%] Discrete surface 10 is planar, simplifying parametrization
Info : [ 90%] Discrete surface 11 is planar, simplifying parametrization
Info : [100%] Discrete surface 12 is planar, simplifying parametrization
Info : Done creating geometry of discrete surfaces (Wall 0.0355313s, CPU 0.182178s)
Info : Meshing 1D...
Info : [ 0%] Meshing curve 14 (Discrete curve)
Info : [ 10%] Meshing curve 15 (Discrete curve)
Info : [ 20%] Meshing curve 16 (Discrete curve)
Info : [ 30%] Meshing curve 17 (Discrete curve)
Info : [ 40%] Meshing curve 18 (Discrete curve)
Info : [ 50%] Meshing curve 19 (Discrete curve)
Info : [ 50%] Meshing curve 20 (Discrete curve)
Info : [ 60%] Meshing curve 21 (Discrete curve)
Info : [ 70%] Meshing curve 22 (Discrete curve)
Info : [ 80%] Meshing curve 23 (Discrete curve)
Info : [ 90%] Meshing curve 24 (Discrete curve)
Info : [100%] Meshing curve 25 (Discrete curve)
Info : Done meshing 1D (Wall 0.00558438s, CPU 0.037403s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 2 (Discrete surface, Frontal-Delaunay)
Info : [ 10%] Meshing surface 3 (Discrete surface, Frontal-Delaunay)
Info : [ 10%] Triangle not found for first derivative at uv=(-0.442636,0.607606) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.26179,-0.757267) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.432464,-0.616638) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(-0.563291,0.500538) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(-0.289088,0.735323) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.27984,-0.743783) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.69775,-0.373345) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(-0.707197,0.364865) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(-0.00138224,0.14449) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(-0.464239,0.588471) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.450343,-0.600803) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(-0.544676,0.517092) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.530775,-0.529425) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.333673,0.0217095) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.0869144,0.301251) on discrete surface 3
Info : [ 10%] Meshing surface 3 (Discrete surface, MeshAdapt)
Info : [ 10%] Triangle not found for first derivative at uv=(-0.442636,0.607606) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.26179,-0.757267) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(0.432464,-0.616638) on discrete surface 3
Info : [ 10%] Triangle not found for first derivative at uv=(-0.563291,0.500538) on discrete surface 3
Info : [ 20%] Meshing surface 4 (Discrete surface, Frontal-Delaunay)
Info : [ 30%] Meshing surface 5 (Discrete surface, Frontal-Delaunay)
Info : [ 30%] Triangle not found for first derivative at uv=(-0.714411,-0.642864) on discrete surface 5
Info : [ 30%] Triangle not found for first derivative at uv=(0.714411,0.642864) on discrete surface 5
Info : [ 40%] Meshing surface 6 (Discrete surface, Frontal-Delaunay)
Info : [ 50%] Meshing surface 7 (Discrete surface, Frontal-Delaunay)
Info : [ 60%] Meshing surface 8 (Discrete surface, Frontal-Delaunay)
Info : [ 70%] Meshing surface 9 (Discrete surface, Frontal-Delaunay)
Info : [ 80%] Meshing surface 10 (Discrete surface, Frontal-Delaunay)
Info : [ 90%] Meshing surface 11 (Discrete surface, Frontal-Delaunay)
Info : [100%] Meshing surface 12 (Discrete surface, Frontal-Delaunay)
Info : Done meshing 2D (Wall 0.46171s, CPU 0.466386s)
Info : Meshing 3D...
Info : 3D Meshing 1 volume with 1 connected component
Info : Tetrahedrizing 3823 nodes...
Info : Done tetrahedrizing 3831 nodes (Wall 0.0396563s, CPU 0.039654s)
Info : Reconstructing mesh...
Info : - Creating surface mesh
Info : - Identifying boundary edges
Info : - Recovering boundary
Info : Done reconstructing mesh (Wall 0.0813547s, CPU 0.078091s)
Warning : No tetrahedra in region 1
Info : 3D refinement terminated (4222 nodes total):
Info : - 0 Delaunay cavities modified for star shapeness
Info : - 0 nodes could not be inserted
Info : - 0 tetrahedra created in 2.5638e-05 sec. (0 tets/s)
Error : No elements in volume 1
Info : Writing 't13.msh'...
Info : Done writing 't13.msh'
-------------------------------------------------------
Version : 4.11.0-git-32bdc2514
License : GNU General Public License
Build OS : Linux64-sdk
Build date : 20220908
Build host : gmsh.info
Build options : 64Bit ALGLIB[contrib] ANN[contrib] Bamg Blas[petsc] Blossom Cgns DIntegration Dlopen DomHex Eigen[contrib] Fltk Gmm[contrib] Hxt Jpeg Kbipack Lapack[petsc] LinuxJoystick MathEx[contrib] Med Mesh Metis[contrib] Mmg Mpeg Netgen ONELAB ONELABMetamodel OpenCASCADE OpenCASCADE-CAF OpenGL OpenMP OptHom PETSc Parser Plugins Png Post QuadMeshingTools QuadTri Solver TetGen/BR Voro++[contrib] WinslowUntangler Zlib
FLTK version : 1.4.0
PETSc version : 3.14.4 (real arithmtic)
OCC version : 7.6.1
MED version : 4.1.0
Packaged by : geuzaine
Web site : https://gmsh.info
Issue tracker : https://gitlab.onelab.info/gmsh/gmsh/issues
-------------------------------------------------------
Thanks for your help.
This is now fixed and a continuous integration workflow of the Fortran examples with the latest Gmsh SDK has been added on GitHub.
This is my initial attempt at using
gmsh-fpm
.I downloaded the gmsh SDK, and separately cloned the
gmsh-fpm
source code.I then compile by running the following from within the gmsh-fpm directory:
where
$GMSH_SDK_LIB
is the location of the SDK files.These steps seem to work fine (output below).
But then it fails when I try to run an example:
with output:
I also tried a workaround by adding
--link_flag
to the command.This also failed, but in a different way.
Any suggestions as to what I'm doing wrong? Thanks!