PyMesh icon indicating copy to clipboard operation
PyMesh copied to clipboard

Error in building with setup.py

Open sakshambh opened this issue 3 years ago • 9 comments

image Kindly help me with issue image

sakshambh avatar Jun 25 '22 14:06 sakshambh

You need to install the dependecies

Ieremie avatar Aug 02 '22 09:08 Ieremie

This may not be an error caused by missing dependencies. I get the same error messages as @sakshambh, but this is due to a linker bug in the used mmg version (see https://github.com/MmgTools/mmg/issues/85). I get the same error messages and switching to version 5.5.1 or any newer one of mmg does not work directly due to some changes in the method declaration of the following functions:

[...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp: In member function ‘virtual void PyMesh::MMG::Delaunay::run()’:
[...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:45:61: error: too few arguments to function ‘int MMG2D_Set_meshSize(MMG5_pMesh, int, int, int, int)’
   45 |     if (MMG2D_Set_meshSize(mmgMesh,num_points,0,num_segments) != 1) {
      |                                                             ^
In file included from [...]/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from [...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
[...]/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:323:8: note: declared here
  323 |   int  MMG2D_Set_meshSize(MMG5_pMesh mesh, int np, int nt, int nquad, int na);
      |        ^~~~~~~~~~~~~~~~~~
[...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:86:58: error: too few arguments to function ‘int MMG2D_Get_meshSize(MMG5_pMesh, int*, int*, int*, int*)’
   86 |                 &num_vertices, &num_triangles, &num_edges) !=1) {
      |                                                          ^
In file included from [...]/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from [...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
[...]/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:872:8: note: declared here
  872 |   int  MMG2D_Get_meshSize(MMG5_pMesh mesh, int* np, int* nt, int* nquad, int* na);
      |        ^~~~~~~~~~~~~~~~~~
[...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp: In member function ‘virtual void PyMesh::MMG::Delaunay::refine(const MatrixFr&)’:
[...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:156:72: error: too few arguments to function ‘int MMG2D_Set_meshSize(MMG5_pMesh, int, int, int, int)’
  156 |     if (MMG2D_Set_meshSize(mmgMesh,num_input_vertices,num_input_faces,0) != 1) {
      |                                                                        ^
In file included from [...]/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from [...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
[...]/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:323:8: note: declared here
  323 |   int  MMG2D_Set_meshSize(MMG5_pMesh mesh, int np, int nt, int nquad, int na);
      |        ^~~~~~~~~~~~~~~~~~
[...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:216:58: error: too few arguments to function ‘int MMG2D_Get_meshSize(MMG5_pMesh, int*, int*, int*, int*)’
  216 |                 &num_vertices, &num_triangles, &num_edges) !=1) {
      |                                                          ^
In file included from [...]/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from [...]/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
[...]/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:872:8: note: declared here
  872 |   int  MMG2D_Get_meshSize(MMG5_pMesh mesh, int* np, int* nt, int* nquad, int* na);
      |        ^~~~~~~~~~~~~~~~~~

BjoernBinaer avatar Aug 12 '22 09:08 BjoernBinaer

Similar issue here:

[ 87%] Built target lib_Wires
/home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp: In member function ‘virtual void PyMesh::MMG::Delaunay::run()’:
/home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:45:27: error: too few arguments to function ‘int MMG2D_Set_meshSize(MMG5_pMesh, int, int, int, int)’
   45 |     if (MMG2D_Set_meshSize(mmgMesh,num_points,0,num_segments) != 1) {
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from /home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
/home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:324:8: note: declared here
  324 |   int  MMG2D_Set_meshSize(MMG5_pMesh mesh, int np, int nt, int nquad, int na);
      |        ^~~~~~~~~~~~~~~~~~
/home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:85:27: error: too few arguments to function ‘int MMG2D_Get_meshSize(MMG5_pMesh, int*, int*, int*, int*)’
   85 |     if (MMG2D_Get_meshSize(mmgMesh,
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~
   86 |                 &num_vertices, &num_triangles, &num_edges) !=1) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from /home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
/home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:873:8: note: declared here
  873 |   int  MMG2D_Get_meshSize(MMG5_pMesh mesh, int* np, int* nt, int* nquad, int* na);
      |        ^~~~~~~~~~~~~~~~~~
/home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp: In member function ‘virtual void PyMesh::MMG::Delaunay::refine(const MatrixFr&)’:
/home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:156:27: error: too few arguments to function ‘int MMG2D_Set_meshSize(MMG5_pMesh, int, int, int, int)’
  156 |     if (MMG2D_Set_meshSize(mmgMesh,num_input_vertices,num_input_faces,0) != 1) {
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from /home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
/home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:324:8: note: declared here
  324 |   int  MMG2D_Set_meshSize(MMG5_pMesh mesh, int np, int nt, int nquad, int na);
      |        ^~~~~~~~~~~~~~~~~~
/home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:215:27: error: too few arguments to function ‘int MMG2D_Get_meshSize(MMG5_pMesh, int*, int*, int*, int*)’
  215 |     if (MMG2D_Get_meshSize(mmgMesh,
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~
  216 |                 &num_vertices, &num_triangles, &num_edges) !=1) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/libmmg.h:38,
                 from /home/ubuntu/python/PyMesh/tools/Triangulation/MMG/Delaunay.cpp:8:
/home/ubuntu/python/PyMesh/python/pymesh/third_party/include/mmg/mmg2d/libmmg2d.h:873:8: note: declared here
  873 |   int  MMG2D_Get_meshSize(MMG5_pMesh mesh, int* np, int* nt, int* nquad, int* na);
      |        ^~~~~~~~~~~~~~~~~~
gmake[2]: *** [tools/Triangulation/CMakeFiles/lib_Triangulation.dir/build.make:188: tools/Triangulation/CMakeFiles/lib_Triangulation.dir/MMG/Delaunay.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1875: tools/Triangulation/CMakeFiles/lib_Triangulation.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
Traceback (most recent call last):
  File "/home/ubuntu/python/PyMesh/./setup.py", line 106, in <module>
    setup(
  File "/home/ubuntu/miniconda3/envs/aniform/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "/home/ubuntu/miniconda3/envs/aniform/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/home/ubuntu/miniconda3/envs/aniform/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/home/ubuntu/miniconda3/envs/aniform/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
    self.run_command(cmd)
  File "/home/ubuntu/miniconda3/envs/aniform/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
    super().run_command(command)
  File "/home/ubuntu/miniconda3/envs/aniform/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.run()
  File "/home/ubuntu/python/PyMesh/./setup.py", line 103, in run
    self.build_pymesh()
  File "/home/ubuntu/python/PyMesh/./setup.py", line 75, in build_pymesh
    self._build(
  File "/home/ubuntu/python/PyMesh/./setup.py", line 97, in _build
    check_call(c.split())
  File "/home/ubuntu/miniconda3/envs/aniform/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j', '4']' returned non-zero exit status 2.

mmarras avatar Nov 04 '22 23:11 mmarras

Workaround for compiling mmg, modify line 93 of PyMesh/third_party/mmg/CMakeLists.txt to

SET(CMAKE_C_FLAGS " -Wno-char-subscripts -fcommon ${CMAKE_C_FLAGS}")

to force -fcommon flag for the compiler.

mmarras avatar Nov 05 '22 00:11 mmarras

Just saw this is likely duplicate of https://github.com/PyMesh/PyMesh/issues/255

mmarras avatar Nov 06 '22 23:11 mmarras

Hey! First, change mmg version in third_party/mmg. This version of mmg has the correct method signature for MMG2D_Set_meshSize
Second, for solving issues with multiple definition you should add SET(CMAKE_C_FLAGS " -fcommon ${CMAKE_C_FLAGS}") in third_party/mmg/CMakeLists.txt
Third, run ./setup.py build

A6u7H avatar Nov 28 '22 22:11 A6u7H

Hey! First, change mmg version in third_party/mmg. This version of mmg has the correct method signature for MMG2D_Set_meshSize Second, for solving issues with multiple definition you should add SET(CMAKE_C_FLAGS " -fcommon ${CMAKE_C_FLAGS}") in third_party/mmg/CMakeLists.txt Third, run ./setup.py build

Hi, may I ask where should I change the mmg version?

liubq7 avatar May 18 '23 18:05 liubq7

What precisely is unclear? It’s says right there where to put it

“change mmg version in third_party/mmg.”

You clone the repo and in the third_party folder you need to put all the files that the new version of mmg comprises of.

mmarras avatar May 18 '23 19:05 mmarras

What precisely is unclear? It’s says right there where to put it

“change mmg version in third_party/mmg.”

You clone the repo and in the third_party folder you need to put all the files that the new version of mmg comprises of.

Thanks for the answer. I thought there was a version configuration file needs to be edited.

liubq7 avatar May 18 '23 19:05 liubq7