Compile errors with CGAL 4.14

161 views
Skip to first unread message

Morgan Hough

unread,
Aug 18, 2019, 12:54:53 PM8/18/19
to iso2mesh-users
Hi Qianqian,

I am using Fedora 30 and following the instructions for downloading and compiling iso2mesh:

git clone --recurse-submodules https://github.com/fangq/iso2mesh.git
 cd iso2mesh
 rm -rf bin/*.mex* bin/*.exe
 cd tools
 make clean
 make

since the current CGAL is 4.14 on fc30 I think I am getting the following error:

[mhough@fedora-flip tools]$ make
if test -f cgalmesh/CMakeLists.txt; then cd cgalmesh && cmake . && cd ..; fi
-- __cplusplus is 201402
--   --> Do not link with Boost.Thread
-- Boost version: 1.69.0
-- Boost include dirs: /usr/include
-- Boost libraries:    
-- Build type: Release
-- USING CXXFLAGS = ' -O2 -DNDEBUG'
-- USING EXEFLAGS = ' '
-- Targetting Unix Makefiles
-- Using /usr/bin/c++ compiler.
-- Requested component: ImageIO
-- Requested component: MPFR
-- Requested component: GMP
-- Boost version: 1.69.0
-- Found Intel TBB
CMake Deprecation Warning at /usr/lib64/cmake/CGAL/UseTBB.cmake:8 (message):
  This file UseTBB.cmake is deprecated, and the function
  `CGAL_target_use_TBB` from CGAL_target_use_TBB.cmake should be used
  instead.
Call Stack (most recent call first):
  CMakeLists.txt:50 (include)


-- Configuring done
-- Generating done
-- Build files have been written to: /home/mhough/Documents/MATLAB/iso2mesh/tools/cgalmesh
make -C cgalmesh --no-print-directory
[ 25%] Building CXX object CMakeFiles/mesh_polyhedral_domain.dir/mesh_polyhedral_domain.cpp.o
/home/mhough/Documents/MATLAB/iso2mesh/tools/cgalmesh/mesh_polyhedral_domain.cpp:1:10: fatal error: CGAL/AABB_intersections.h: No such file or directory
    1 | #include <CGAL/AABB_intersections.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [CMakeFiles/mesh_polyhedral_domain.dir/build.make:63: CMakeFiles/mesh_polyhedral_domain.dir/mesh_polyhedral_domain.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/mesh_polyhedral_domain.dir/all] Error 2
make[1]: *** [Makefile:84: all] Error 2
make: *** [commons/Makefile_common.mk:68: cgalmesh] Error 2

A quick check shows:

[mhough@fedora-flip tools]$ ls /usr/include/CGAL/AABB_*
/usr/include/CGAL/AABB_face_graph_triangle_primitive.h
/usr/include/CGAL/AABB_halfedge_graph_segment_primitive.h
/usr/include/CGAL/AABB_polyhedral_oracle.h
/usr/include/CGAL/AABB_polyhedron_segment_primitive.h
/usr/include/CGAL/AABB_polyhedron_triangle_primitive.h
/usr/include/CGAL/AABB_primitive.h
/usr/include/CGAL/AABB_segment_primitive.h
/usr/include/CGAL/AABB_traits.h
/usr/include/CGAL/AABB_tree.h
/usr/include/CGAL/AABB_triangle_primitive.h
/usr/include/CGAL/AABB_triangulation_3_cell_primitive.h
/usr/include/CGAL/AABB_triangulation_3_triangle_primitive.h

and since I see references on your website to CGAL 3.x I am guessing this is maybe a change with 4.x? 

For iso2mesh v1.9 what would you consider the supported CGAL version? 

Thanks in advance for your time. 

Cheers,

-Morgan

Morgan Hough

unread,
Aug 18, 2019, 4:35:15 PM8/18/19
to iso2mesh-users
Hi Qianqian,

Now I see that the fix is rather trivial.

If I modify iso2mesh/tools/cgalmesh/mesh_polyhedral_domain.cpp

from CGAL/AABB_intersections.h to CGAL/intersections.h

I can build everything until meshfix now with the following error:

home/mhough/Documents/MATLAB/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:3439:10: fatal error: slu_cdefs.h: No such file or directory
 3439 | #include <slu_cdefs.h>
      |          ^~~~~~~~~~~~~
compilation terminated.

I haven't had a chance to run a pipeline with these built mex tools or search for issues with slu_cdefs.h but I thought I would update my previous post with this info for now.

Cheers,

-Morgan

Qianqian Fang

unread,
Aug 18, 2019, 5:06:54 PM8/18/19
to iso2mes...@googlegroups.com, Morgan Hough
On 8/18/19 4:35 PM, Morgan Hough wrote:
Hi Qianqian,

Now I see that the fix is rather trivial.

If I modify iso2mesh/tools/cgalmesh/mesh_polyhedral_domain.cpp

from CGAL/AABB_intersections.h to CGAL/intersections.h


hi Morgan

thanks for the update. On my Ubuntu 16.04 box, AABB_intersections.h exists in CGAL 4.7, but I assume at some point it was renamed. Need to add a macro to make it compatible to newer CGAL versions, but I had a hard time tracking when this rename was made. will update if I find out.


I can build everything until meshfix now with the following error:

home/mhough/Documents/MATLAB/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:3439:10: fatal error: slu_cdefs.h: No such file or directory
 3439 | #include <slu_cdefs.h>
      |          ^~~~~~~~~~~~~
compilation terminated.


the slu_cdefs.h is part of SuperLU. For some reason, I found that the folder in my system under iso2mesh/tools/meshfix/ has a similar structure compared to this

https://github.com/alecjacobson/meshfix/tree/master/JMeshExt-1.0alpha_src

which contains SuperLU (https://github.com/alecjacobson/meshfix/tree/master/JMeshExt-1.0alpha_src/OpenNL3.2.1)

instead of resembling my meshfix fork

https://github.com/fangq/meshfix

I don't fully remember whether I explicitly changed the meshfix submodule to other sources, or SuperLU was supposed to be added as a submodule under meshfix/JMeshxxx/OpenNLxxx/

do you want to try adding the SuperLU submodule first? if it does not work, perhaps checkout the https://github.com/alecjacobson/meshfix/ to replace my meshfix fork?


I haven't had a chance to run a pipeline with these built mex tools or search for issues with slu_cdefs.h but I thought I would update my previous post with this info for now.


just one clarification - the tools compiled by the source files in this folder are not mex files, they are simply binary executables and renamed in mex suffix to allow them co-exist on multiple platforms.

Qianqian


--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iso2mesh-users/6ac6f8fd-b159-4037-92d6-d292bb437cb1%40googlegroups.com.


Qianqian Fang

unread,
Aug 18, 2019, 5:27:30 PM8/18/19
to iso2mes...@googlegroups.com, Morgan Hough
On 8/18/19 5:06 PM, Qianqian Fang wrote:
I can build everything until meshfix now with the following error:

home/mhough/Documents/MATLAB/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:3439:10: fatal error: slu_cdefs.h: No such file or directory
 3439 | #include <slu_cdefs.h>
      |          ^~~~~~~~~~~~~
compilation terminated.


the slu_cdefs.h is part of SuperLU. For some reason, I found that the folder in my system under iso2mesh/tools/meshfix/ has a similar structure compared to this


hi Morgan,

I know what to do. you need to add SuperLU-devel to BuildRequires; in Debian/Ubuntu, the missing header file is provided by libsuperlu-dev

by the way, it has been a while since we met last year, hope everything is going well!

Qianqian

Morgan Hough

unread,
Aug 18, 2019, 6:56:58 PM8/18/19
to iso2mesh-users
Hey Qianqian,

Thanks. Really helpful. There are so many meshfix projects aren't there:)

Using the system SuperLU, I think I need to append SuperLU in the include path to slu_cdefs.h in nl_single_file.c but now I am getting some error about lblas now. It's late here in London so I will follow up on this later

What I want is to do is run brain2mesh on Fedora/Octave. I know need to download loadnii.m. Is that not freely distributable? Does the octave-image package provide imfill and imdilate?  

Yes, love to catch up sometime. Congrats on the R01! Bummed I missed the MCX '19 workshop. Will MCX '20 be at biophotonics next year? 

Cheers,

-Morgan
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mes...@googlegroups.com.

Qianqian Fang

unread,
Aug 18, 2019, 7:59:26 PM8/18/19
to iso2mes...@googlegroups.com, Morgan Hough
On 8/18/19 6:56 PM, Morgan Hough wrote:
Hey Qianqian,

Thanks. Really helpful. There are so many meshfix projects aren't there:)

Using the system SuperLU, I think I need to append SuperLU in the include path to slu_cdefs.h in nl_single_file.c but now I am getting some error about lblas now. It's late here in London so I will follow up on this later


yes, I think if you follow the trail, it will need a few additional dependencies. I think the packages will be different on Debian/Ubuntu.



What I want is to do is run brain2mesh on Fedora/Octave. I know need to download loadnii.m. Is that not freely distributable? Does the octave-image package provide imfill and imdilate? 


I see.

load_nii.m itself is open-source and part of a BSD licensed toolbox

https://www.mathworks.com/matlabcentral/fileexchange/8797-tools-for-nifti-and-analyze-image

but the support for .nii.gz depends on MATLAB's jvm, which I suppose is not available on Octave.

a workaround is to call unzip.m to call unzip the .nii.gz to a temp file, and then load with load_nii (alternatively, you can use my ZMat toolbox to decompress the file stream in memory).


I added my own nii parser to iso2mesh this summer (as part of the JNIfTI specification I worked on)

https://github.com/fangq/iso2mesh/blob/master/nii2jnii.m
copied from
https://github.com/fangq/jnifti/blob/master/lib/matlab/nii2jnii.m

but it needs memmapfile which is not yet supported in octave, only a draft version available

https://savannah.gnu.org/bugs/?54788


it appears that imfill/imdilate are already supported in octave-image, but I admit I've never tested brain2mesh on Octave. I will try it out tomorrow and let you know if I need to change anything to make it compatible.


Yes, love to catch up sometime. Congrats on the R01! Bummed I missed the MCX '19 workshop. Will MCX '20 be at biophotonics next year?


for MCX'20, I haven't decided yet. At minimum, we will run a short version (~3 hr) at fNIRS2020 in Boston next year. If you come to Boston again, let me know.

Qianqian


To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iso2mesh-users/f495ef31-a79e-4176-ae50-382d98a604c1%40googlegroups.com.


Qianqian Fang

unread,
Aug 21, 2019, 4:45:00 PM8/21/19
to iso2mes...@googlegroups.com, Morgan Hough
On 8/18/19 6:56 PM, Morgan Hough wrote:
Hey Qianqian,

Thanks. Really helpful. There are so many meshfix projects aren't there:)

Using the system SuperLU, I think I need to append SuperLU in the include path to slu_cdefs.h in nl_single_file.c but now I am getting some error about lblas now. It's late here in London so I will follow up on this later

What I want is to do is run brain2mesh on Fedora/Octave. I know need to download loadnii.m. Is that not freely distributable? Does the octave-image package provide imfill and imdilate? 


hi Morgan

just want to let you know that I was able to run brain2mesh on Octave 4.2.2. A few changes are needed.

The first thing I did was to convert .nii.gz files into the JNIfTI format (https://github.com/fangq/jnifti) that I recently developed. here is the commit

https://github.com/fangq/brain2mesh/commit/eb9ebb722dd77138050ac291e4c6390994e18d89


The github version of iso2mesh already supports reading/writing text and binary based JNIFTI files (loadjnifti.m and savejnifti.m), so you no longer need to install load_nii.m. However, to reduce file sizes, I applied compression to the .jnii files (they are basically plain JSON files!), to decompress these files on Octave, you do need to install my other toolbox, zmat (http://github.com/fangq/zmat) to octave (fully compatible).

With the addition of zmat and the .jnii files, you should be able to load the SPM segmentations.

I tested brain2mesh demo script in Octave 4.2.2 on my Ubuntu 16.04 box, and was able to eventually run it. see my attached screenshot.

Initially octave throwed the below error from imfill.m (the apt installed version was octave-image 2.6.1)

error: 'conndef' undefined near line 72 column 10
error: called from
    imfill at line 72 column 8
    brain2mesh at line 123 column 9
    SPM_example_brain at line 25 column 17

however, as mentioned in this thread

https://sourceforge.net/p/octave/package-releases/358/?limit=25

the conndef.oct file was actually compiled, but somehow imfill can not locate it. So, I just added its path by

>> addpath('/usr/lib/x86_64-linux-gnu/octave/packages/image-2.6.1/x86_64-pc-linux-gnu-api-v51/')

then, the SPM_example_brain.m script completes successfully.

The other demo script gave an error, but it does the same in MATLAB, so it is not related to octave. I will take a look and see if I can fix that.

Anyways, just to show you that this is actually doable.

Qianqian


To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iso2mesh-users/f495ef31-a79e-4176-ae50-382d98a604c1%40googlegroups.com.


octave_4.2.2_brain2mesh.png

Qianqian Fang

unread,
Sep 17, 2019, 12:47:40 PM9/17/19
to iso2mes...@googlegroups.com, Morgan Hough
hi Morgan (and anyone who is interested),

just to let you know that I wrote an Octave-compatible NIfTI-1/2 reader to read/write .nii/.nii.gz files


based on this toolbox, I also submitted 3 missing functions (niftiread, niftiwrite, niftiinfo) to octave-image


The NIfTI toolbox on MATLAB file exchange does not support NIfTI-2, and also does not support reading .nii.gz on octave.

if anyone uses reading/writing NIfTI data, feel free to give it a try. it is very compact. To read .nii.gz/.hdr.gz/.img.gz files, you need to install zmat (http://github.com/fangq/zmat).

Qianqian
Reply all
Reply to author
Forward
0 new messages