hkroeger / insightcae

InsightCAE
http://silentdynamics.de
79 stars 15 forks source link

Building problems with dxflib #10

Open joaoantoniocardoso opened 4 years ago

joaoantoniocardoso commented 4 years ago

Hi, i'm using archlinux and while I'm facing some problems trying to build Insight from its sources, managed to workaround some errors but not all of them.

My installed dependencies is:

opencascade 7.3.0_p3-1
dxflib 3.5.0-src
imagemagick 7.0.8.66-1
python2 2.7.16-1
python2-matplotlib 2.2.4-2
python2-scipy 1.2.1-2
python2-numpy 1.16.4-2
qwt 6.1.4-2
qt5-base 5.13.1-2
paraview 5.6.0-5
swig 4.0.1-1
texlive-core 2019.50917-1
texlive-latexextra 2019.50920-1
gnuplot 5.2.7-1
boost 1.69.0-2
gsl 2.6-1
armadillo 9.700.2-1
cmake 3.15.3-2

Yes. I knew that (as always as an archlinux user) I would face some problems with more recent versions for the dependencies.


When I configure the cmake with ccmake as sujested I have to manually edit a some of the entries like _BoostDIR and OFdev_BASHRC, and I got the following warnings, which I just ignore and go to generate. ccmake_warnings.txt

I have try to identify what causes this warnings and I think it has something to do with _INSIGHT_BUILDPYTHONBINDINGS.

After generate (without additional messages from ccmake) I run make I got the following: make_output.txt

I tried to locate it in my system and it simply doesn't exist. this issue at boost suggests boost/gil.hpp, so I recursively replace it in all files with that header:

egrep -lRZ 'boost/gil/gil_all.hpp' /home/joaoantoniocardoso/CFD/insight/insight-src/src | xargs -0 -l sed -i -e 's:boost/gil/gil_all.hpp:boost/gil.hpp:g'

error fixed, and than it goes on until a new error comes:

In file included from /home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/caseelement.h:27,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/case.h:26,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/resultset.cpp:33:
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/softwareenvironment.h:49:18: error: ‘io_service’ in namespace ‘boost::asio’ does not name a type; did you mean ‘has_service’?
   49 |     boost::asio::io_service ios;

Than I located all the files with that has the string boost::asio::io_service:

grep -iRl "boost::asio::io_service" /home/joaoantoniocardoso/CFD/insight/insight-src/src/

/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/softwareenvironment.h
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/openfoam/remoteexecution.h
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/openfoam/remoteexecution.cpp

and added this header that headers:

#include "boost/asio/io_service.hpp"

Than it passes and got another one, this time its about dxflib:

insight_make_errors_dxflib.txt

And now I don't know how to solve it. I see that you recommend dxflib-3.7.0 but I cannot find it to download and build so I find dxflib-3.7.5. I also tried with dxflib-2.5.0.0-1 and dxflib-3.17.0-src and got similar errors.

Now what can I do?

Thanks!

hkroeger commented 4 years ago

Hi Joao,

the error is not in dxflib but in a part of insightcad (/home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/featurefilters/ispartofsolid.h). There is only a warning from the dxfwriter.cpp code unit.

I have the impression that your compiler does not recognize a type cast properly, which is defined elsewhere in the project. I have pushed some changes into the branch "hannes_dev" which avoid that. Please pull and try if this improves the situation.

BTW: You wrote above that you use OpenCASCADE 7.3. But the error messages indicate that you compile against oce-0.18. AFAIK oce-0.18 is based on some earlier version of OpenCASCADE and you will probably run into errors elsewhere.

joaoantoniocardoso commented 4 years ago

Hi @hkroeger, thank you for being helpful and for developing this software,

so you are right, my OCE-0.18.3-1 could run into problems with OpenCASCADE-7.3.0_p3-1. If I understood this OCE oficially suports OpenCASCADE-6.9-0. If it happen to be the case I could try to manually downgrade my OpenCASCADE and blacklist/freeze its updates from my package manager, thanks for the advice.

Your new commits did help this part :)

Another small changes needed to be able to continue:

Changed from TopExp::MapShapesAndUniqueAncestors( to TopExp::MapShapesAndAncestors( in src/cad/featurefilters/connected.cpp explained here.

Added #include "GeomAdaptor_HSurface.hxx" to /src/cad/cadfeatures/faceisocurve.cpp

And now it seems to be something related with the oce:

[ 28%] Building CXX object src/cad/CMakeFiles/insightcad.dir/cadfeatures/stl.cpp.o
/home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp: In member function ‘virtual void insight::cad::STL::build()’:
/home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp:190:18: error: ‘class Poly_Triangulation’ has no member named ‘ChangeNode’; did you mean ‘ChangeNodes’?
  190 |       aSTLMesh_->ChangeNode (i+1) = gp_Pnt(xyz[0], xyz[1], xyz[2]);
      |                  ^~~~~~~~~~
      |                  ChangeNodes
/home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp:197:18: error: ‘class Poly_Triangulation’ has no member named ‘ChangeTriangle’; did you mean ‘ChangeTriangles’?
  197 |       aSTLMesh_->ChangeTriangle (i + 1) =
      |                  ^~~~~~~~~~~~~~
      |                  ChangeTriangles
/home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp:221:20: error: ‘class Poly_Triangulation’ has no member named ‘ChangeNode’; did you mean ‘ChangeNodes’?
  221 |         aSTLMesh_->ChangeNode(i).Transform(tr);
      |                    ^~~~~~~~~~
      |                    ChangeNodes
/home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp:230:32: error: no matching function for call to ‘Poly_Triangulation::Nodes(int&)’
  230 |       bb.Add(aSTLMesh_->Nodes(i));
      |                                ^
In file included from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/occinclude.h:62,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeature.h:41,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.h:23,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp:20:
/opt/oce/lib/oce-0.18/../../include/oce/Poly_Triangulation.hxx:110:47: note: candidate: ‘const TColgp_Array1OfPnt& Poly_Triangulation::Nodes() const’
  110 |   Standard_EXPORT  const  TColgp_Array1OfPnt& Nodes()  const;
      |                                               ^~~~~
/opt/oce/lib/oce-0.18/../../include/oce/Poly_Triangulation.hxx:110:47: note:   candidate expects 0 arguments, 1 provided
/home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp:238:104: error: invalid use of incomplete type ‘class gp_Sphere’
  238 |     aB.MakeFace(aFace, Handle_Geom_Surface(new Geom_SphericalSurface(gp_Sphere(gp_Ax3(ctr, gp::DZ()), r))), Precision::Confusion());
      |                                                                                                        ^
In file included from /opt/oce/lib/oce-0.18/../../include/oce/gp_XYZ.lxx:17,
                 from /opt/oce/lib/oce-0.18/../../include/oce/gp_XYZ.hxx:344,
                 from /opt/oce/lib/oce-0.18/../../include/oce/gp_Pnt.hxx:13,
                 from /opt/oce/lib/oce-0.18/../../include/oce/BRepExtrema_SolutionElem.hxx:22,
                 from /opt/oce/lib/oce-0.18/../../include/oce/BRepExtrema_SeqOfSolution.hxx:23,
                 from /opt/oce/lib/oce-0.18/../../include/oce/BRepExtrema_DistShapeShape.hxx:18,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/occinclude.h:34,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeature.h:41,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.h:23,
                 from /home/joaoantoniocardoso/CFD/insight/insight-src/src/cad/cadfeatures/stl.cpp:20:
/opt/oce/lib/oce-0.18/../../include/oce/gp.hxx:39:7: note: forward declaration of ‘class gp_Sphere’
   39 | class gp_Sphere;
      |       ^~~~~~~~~
make[2]: *** [src/cad/CMakeFiles/insightcad.dir/build.make:1441: src/cad/CMakeFiles/insightcad.dir/cadfeatures/stl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6544: src/cad/CMakeFiles/insightcad.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

Have some clue about it?

hkroeger commented 4 years ago

@joaoantoniocardoso,

yes, OCC 6.9 is what I remember as well. As the major version number change suggests, the API has some incompatibilities. The error, you are facing, is probably one of them.

I would strongly recommend to stick with OCC7 for compiling InsightCAE. I'm using OCC 7.2 for development (there might be other changes needed for 7.4 though I think there is a good chance, that everything compiles ok). To support OCE, a number of preprocessor switch would need to be added in the code. They are still there in some older part of the code. But all the newer code is only developed with OCC 7 only.

You can install both OCE and OCC in different locations on your system, if you need OCE for other reasons. In InsightCAE's CMake config, there is a switch "INSIGHT_FORCE_OCC", which shall skip any OCE installation and regard only OCC. You can then point CMake to the proper location.

Regards, Hannes

joaoantoniocardoso commented 4 years ago

@hkroeger I don't know why but I thought OCC wasn't an option. I really just don't need OCE at all.

Following your directions and changing from OCE to OCC (I kept 7.3 because opencascade compilation is not something straight-forward in my distro...) did compile until a kind strange behaviour:

[ 22%] Building CXX object src/toolkit/CMakeFiles/toolkit.dir/base/pythonanalysis.cpp.o
In file included from /home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:34:
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp: In member function ‘insight::ParameterSet insight::PythonAnalysis::PythonAnalysisFactory::defaultParameters() const’:
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:90:55: warning: invalid conversion from ‘void*’ to ‘swig_type_info*’ [-fpermissive]
   90 |         if ((SWIG_ConvertPtr(o.ptr(), (void **) &psp, descr, 0) == -1)) {
      |                                                       ^~~~~
      |                                                       |
      |                                                       void*
/home/joaoantoniocardoso/CFD/insight/insight/src/toolkit/swigpyrun.h:1028:97: note: in definition of macro ‘SWIG_Python_ConvertPtr’
 1028 | #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
      |                                                                                                 ^~~~
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:90:14: note: in expansion of macro ‘SWIG_ConvertPtr’
   90 |         if ((SWIG_ConvertPtr(o.ptr(), (void **) &psp, descr, 0) == -1)) {
      |              ^~~~~~~~~~~~~~~
/home/joaoantoniocardoso/CFD/insight/insight/src/toolkit/swigpyrun.h:2018:73: note:   initializing argument 3 of ‘int SWIG_Python_ConvertPtrAndOwn(PyObject*, void**, swig_type_info*, int, int*)’
 2018 | SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
      |                                                         ~~~~~~~~~~~~~~~~^~
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp: In member function ‘virtual insight::ResultSetPtr insight::PythonAnalysis::operator()(insight::ProgressDisplayer*)’:
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:148:76: warning: invalid conversion from ‘void*’ to ‘swig_type_info*’ [-fpermissive]
  148 |         if (!(paramobj = SWIG_NewPointerObj(SWIG_as_voidptr(&parameters_), descr, 0 )))
      |                                                                            ^~~~~
      |                                                                            |
      |                                                                            void*
/home/joaoantoniocardoso/CFD/insight/insight/src/toolkit/swigpyrun.h:1035:94: note: in definition of macro ‘SWIG_NewPointerObj’
 1035 | #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
      |                                                                                              ^~~~
In file included from /home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:34:
/home/joaoantoniocardoso/CFD/insight/insight/src/toolkit/swigpyrun.h:2265:70: note:   initializing argument 3 of ‘PyObject* SWIG_Python_NewPointerObj(PyObject*, void*, swig_type_info*, int)’
 2265 | SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
      |                                                      ~~~~~~~~~~~~~~~~^~~~
In file included from /home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:34:
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:177:55: warning: invalid conversion from ‘void*’ to ‘swig_type_info*’ [-fpermissive]
  177 |         if ((SWIG_ConvertPtr(o.ptr(), (void **) &res, descr, 0) == -1)) {
      |                                                       ^~~~~
      |                                                       |
      |                                                       void*
/home/joaoantoniocardoso/CFD/insight/insight/src/toolkit/swigpyrun.h:1028:97: note: in definition of macro ‘SWIG_Python_ConvertPtr’
 1028 | #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
      |                                                                                                 ^~~~
/home/joaoantoniocardoso/CFD/insight/insight-src/src/toolkit/base/pythonanalysis.cpp:177:14: note: in expansion of macro ‘SWIG_ConvertPtr’
  177 |         if ((SWIG_ConvertPtr(o.ptr(), (void **) &res, descr, 0) == -1)) {
      |              ^~~~~~~~~~~~~~~
/home/joaoantoniocardoso/CFD/insight/insight/src/toolkit/swigpyrun.h:2018:73: note:   initializing argument 3 of ‘int SWIG_Python_ConvertPtrAndOwn(PyObject*, void**, swig_type_info*, int, int*)’
 2018 | SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
      |                                                         ~~~~~~~~~~~~~~~~^~
[ 22%] Linking CXX shared library ../../lib/libtoolkit.so
c++: error: CMakeFiles/toolkit.dir/base/resultset.cpp.o: No such file or directory
make[2]: *** [src/toolkit/CMakeFiles/toolkit.dir/build.make:842: lib/libtoolkit.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:5440: src/toolkit/CMakeFiles/toolkit.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

But than I exec make again and it goes further and further... What just did happen there? Is it safe?

Continuing it compiles until this error that I don't know how to solve: make_output.txt

---update:

Oh, I just checked and for my OpenFOAM-5.x it should be writeEntry, so maybe there is something wrong in OF_VERSION define. I changed from writeList to writeEntry and the same type of problem occurred in other files that uses this pre-processors switches.

---update 2: I run a pragma message to show the value of OF_VERSION and it is 070000.

Thank you so much for your time and effort helping me to build it, cheers!

hkroeger commented 4 years ago

@joaoantoniocardoso,

yes, the errors now arise from the compilation of the OpenFOAM-addons.

Honestly, I have never compiled them with OF-5.x. It is possible to update the preprocessor switches to support OF-5, but this requires some effort.

We have used the ESI version OF-1806 for quite some time now. The OF tools should also compile with OF-1906.

joaoantoniocardoso commented 4 years ago

@hkroeger right, I'll do that. I am now compiling OF-1806 and then I will clean insight build and start again :)

joaoantoniocardoso commented 4 years ago

Python 3.7 updated to Python 3.8 and new problems arise, specially related with boost.

This time I decided to try another method: I created a ubuntu:xenial Docker and with no surprise it worked really well: https://github.com/joaoantoniocardoso/InsightCAE-docker

I think that making a docker app could be a nice way to enhance the distribution of this software.

Thanks for your help @hkroeger .