fangq / iso2mesh

Iso2Mesh - a 3D surface and volumetric mesh generator for MATLAB/Octave
http://iso2mesh.sf.net
Other
182 stars 73 forks source link

Compile iso2mesh for ARM Mac #74

Closed Edouard2laire closed 3 months ago

Edouard2laire commented 9 months ago

Iso2mesh needs to be recompiled for arm Mac. I tried to recompile according to the instructions but I have an error when compiling JMeshLib.

See log file: https://justpaste.it/5o8b3

Edouard2laire commented 9 months ago

i made a bit of progress and was able to fix the error

/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/JMeshLib/include/clusterGraph.h:57:50: error: cast from pointer to smaller type 'j_voidint' (aka 'int') loses information
 clusterEdge *getFirst() {return (numels)?(edges[(j_voidint)getHead()]):(NULL);} 

by replaceing every cast to (j_voidint) by (j_voidint)(size_t) as recomended here: https://stackoverflow.com/questions/22419063/error-cast-from-pointer-to-smaller-type-int-loses-information-in-eaglview-mm/22474752#22474752

I am now having an issue compiling OpenNL3.2.1

    if (!NL_FORTRAN_WRAP(lsame)(uplo, "U") && 
         ^
/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:420:28: note: expanded from macro 'NL_FORTRAN_WRAP'
#define NL_FORTRAN_WRAP(x) x##_
                           ^
<scratch space>:122:1: note: expanded from here
lsame_
^
/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:2526:2: error: call to undeclared function 'xerbla_'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        NL_FORTRAN_WRAP(xerbla)("DTPSV ", &info);
        ^
/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:420:28: note: expanded from macro 'NL_FORTRAN_WRAP'
#define NL_FORTRAN_WRAP(x) x##_
                           ^
<scratch space>:129:1: note: expanded from here
xerbla_
^
/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:2367:22: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
/* Subroutine */ int NL_FORTRAN_WRAP(dtpsv)(uplo, trans, diag, n, ap, x, incx, uplo_len, 
                     ^
/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:420:28: note: expanded from macro 'NL_FORTRAN_WRAP'
#define NL_FORTRAN_WRAP(x) x##_
                           ^
<scratch space>:121:1: note: expanded from here
dtpsv_
^
/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:2779:82: warning: too few arguments in call to 'dtpsv_'
    NL_FORTRAN_WRAP(dtpsv)(UL[(int)uplo],T[(int)trans],D[(int)diag],&n,AP,x,&incx); 
    ~~~~~~~~~~~~~~~~~~~~~~                                                       ^
/Users/edelaire1/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1/src/nl_single_file.c:3439:10: fatal error: 'slu_cdefs.h' file not found
#include <slu_cdefs.h>
         ^~~~~~~~~~~~~
2 warnings and 3 errors generated.
make[2]: *** [CMakeFiles/meshfix.dir/contrib/OpenNL3.2.1/src/nl_single_file.c.o] Error 1 

edit: [edelaire1@home-imglab01:~/Documents/software/iso2mesh/tools/meshfix/contrib/OpenNL3.2.1]$ ./configure.sh cd build/Darwin-Release make

is able to compile OpenNL3.2.1. but still get the previous error

Edit: Fixed. it was an error with my setup of superlu. Fixed by doing:

git clone https://github.com/xiaoyeli/superlu.git
cd superlu/
mkdir build ; cd build
cmake ..
make
make install
Edouard2laire commented 8 months ago

(cross-posting from https://github.com/fangq/meshfix/pull/2 - sorry, I am a bit confused with all the different repositories so I am not sure it's the right place)

I have now this error now when compiling cgalmesh: https://justpaste.it/3qrcl

Edouard2laire commented 8 months ago

Hi @fangq;

Would you have any idea on how to solve that issue ? I am not very familiar with cmake and how linking works in general so I am not sure about what to search for to solve that error in the linking of the tbb library to compile cgalmesh.

fangq commented 8 months ago

@Edouard2laire, sorry that I haven't been paying much attention this thread - I saw there are multiple tickets, some have been resolved, some are not.

can you summarize what does this issue currently stand? is it just cgalmesh compilation error or more related to components of meshfix?

for cgal, the upstream authors have been very responsive in their mailing list in the past, adding @lrineau to this thread.

fangq commented 8 months ago

@Edouard2laire, one thing I think you were facing was because the meshfix I linked as a submodule was an old version.

the newer version can be found at

https://github.com/MarcoAttene/MeshFix-V2.1

are you able to compile this one on ARM mac?

Edouard2laire commented 8 months ago

@Edouard2laire, sorry that I haven't been paying much attention this thread - I saw there are multiple tickets, some have been resolved, some are not.

Yes, sorry. I got confused because of the different repo; and was not sure about where to post.

can you summarize what does this issue currently stand? is it just cgalmesh compilation error or more related to components of meshfix?

Yes; now, the only issue is with cgalmesh. (https://justpaste.it/3qrcl).

for cgal, the upstream authors have been very responsive in their mailing list in the past, adding @lrineau to this thread.

Thank you.

@Edouard2laire, one thing I think you were facing was because the meshfix I linked as a submodule was an old version.

I will give a try and let you know. I was also able to compile using https://github.com/fangq/meshfix/pull/2

Edouard2laire commented 7 months ago

I might have found the solution here: https://oneapi-src.github.io/oneTBB/GSG/integrate.html#cmake with the following fix:

create_single_source_cgal_program( "mesh_polyhedral_domain.cpp")
target_link_libraries(mesh_polyhedral_domain TBB::tbb) % NEW

 create_single_source_cgal_program( "mesh_3D_image.cpp")
 target_link_libraries(mesh_3D_image TBB::tbb)  % NEW

The program is now compiling.

I will now be compiling cork. Maybe it would be nice to have a tutorial on how to compile iso2mesh because this is really hard and every software need some tuning before being compilable.

Edit: It seems I now have a fully compiled version of Iso2mesh. I will do some test and let you know if it is working

Edouard2laire commented 7 months ago

New question: The compilation is working well to generate the executables but it doesn't generate Mex files. Do you have any indication on how to generate those?

Thanks a lot, Edouard

Edouard2laire commented 7 months ago

hello @fangq,

Do you have any indication for the generation of the Mex files or should we ship only binaries?

Thank you, Edouard

fangq commented 7 months ago

@Edouard2laire, all binaries under iso2mesh/bin folders are executables, they are not mex files, except that I named them with the mexext as suffix just to be able to store them under the same directory.

when I build the bundled executables, I usually use static linking in the link step so that the generated binary can be run on a wide range of machines - I also try to find a machine with older glibc version, say Ubuntu 16.04, to build the executable so that the binary can be launched in most newer machines.

fangq commented 3 months ago

closed with https://github.com/fangq/iso2mesh/commit/aa78f3a1c9ffdc9dfd41b1ae290161d3233110a5

Edouard2laire commented 3 months ago

thank you :)