Compile on Linux (Kubuntu): CMake can't find VTK

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by yorik »

Joining the dance... I cannot compile FreeCAD anymore either! :D (debian testing)

Code: Select all

[  5%] Linking CXX shared library ../../../lib/libSMESH.so
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o: In function `MPI::Intracomm::Intracomm()':
SMESH_Mesh.cpp:(.text._ZN3MPI9IntracommC2Ev[_ZN3MPI9IntracommC5Ev]+0x14): undefined reference to `MPI::Comm::Comm()'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o: In function `MPI::Intracomm::Intracomm(ompi_communicator_t*)':
SMESH_Mesh.cpp:(.text._ZN3MPI9IntracommC2EP19ompi_communicator_t[_ZN3MPI9IntracommC5EP19ompi_communicator_t]+0x19): undefined reference to `MPI::Comm::Comm()'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o: In function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)':
SMESH_Mesh.cpp:(.text._ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb[_ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb]+0x26): undefined reference to `ompi_mpi_cxx_op_intercept'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o:(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o:(.data.rel.ro._ZTVN3MPI8DatatypeE[_ZTVN3MPI8DatatypeE]+0x78): undefined reference to `MPI::Datatype::Free()'
collect2: error: ld returned 1 exit status
src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/build.make:1244: recipe for target 'lib/libSMESH.so' failed
make[2]: *** [lib/libSMESH.so] Error 1
CMakeFiles/Makefile2:535: recipe for target 'src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/all' failed
make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
If only I could remember what I did last time to solve this...
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by sgrogan »

yorik wrote:Joining the dance... I cannot compile FreeCAD anymore either! :D (debian testing)
Welcome, the water is warm :lol:
I had mpi problems on Trusty with self compiled VTK7, it was solved by using the default VTK6 package. There are conflicts between libmed-dev/libmedc and vtk that are different on the different distros. vejmarie has reported that on Trusty at least libmed-dev or libmedc-dev? are/is compiled against hdf5 parallel when it should be serial. I haven't had the time to try on trusty, I think @bernd solved his problems by self compiling vtk7 with all the defaults on jessie.
"fight the good fight"
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by jmaustpc »

master will not compile for me any more on Kubuntu 12.04.
sgrogan wrote:I think @bernd solved his problems by self compiling vtk7 with all the defaults on jessie.


I did as well, but FreeCAD still will not compile.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by sgrogan »

jmaustpc wrote:I did as well, but FreeCAD still will not compile.
wonderfan is just going through this as well with precise. I think you will probably have to compile med as well and maybe hdf5. I have a problem on trusty with self-compiled VTK7 + repo libmedc-dev. But repo VTK6 + repo libmedc-dev works.
"fight the good fight"
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by yorik »

ok in my case the above error is only when compiling wandererfan's techdraw branch. Compiling FreeCAD master works OK. Still no idea why this error happens with the techdraw branch...
CharlieMAC
Posts: 228
Joined: Fri Apr 25, 2014 1:59 am

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by CharlieMAC »

sgrogan wrote:
jmaustpc wrote:I did as well, but FreeCAD still will not compile.
wonderfan is just going through this as well with precise. I think you will probably have to compile med as well and maybe hdf5. I have a problem on trusty with self-compiled VTK7 + repo libmedc-dev. But repo VTK6 + repo libmedc-dev works.
How do you compile VTK7?
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by NormandC »

CharlieMAC wrote:How do you compile VTK7?
viewtopic.php?p=130193#p130193
gdo35
Posts: 189
Joined: Wed Jan 25, 2012 7:25 pm

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by gdo35 »

yorik wrote:Joining the dance... I cannot compile FreeCAD anymore either! :D (debian testing)

Code: Select all

[  5%] Linking CXX shared library ../../../lib/libSMESH.so
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o: In function `MPI::Intracomm::Intracomm()':
SMESH_Mesh.cpp:(.text._ZN3MPI9IntracommC2Ev[_ZN3MPI9IntracommC5Ev]+0x14): undefined reference to `MPI::Comm::Comm()'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o: In function `MPI::Intracomm::Intracomm(ompi_communicator_t*)':
SMESH_Mesh.cpp:(.text._ZN3MPI9IntracommC2EP19ompi_communicator_t[_ZN3MPI9IntracommC5EP19ompi_communicator_t]+0x19): undefined reference to `MPI::Comm::Comm()'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o: In function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)':
SMESH_Mesh.cpp:(.text._ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb[_ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb]+0x26): undefined reference to `ompi_mpi_cxx_op_intercept'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o:(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o:(.data.rel.ro._ZTVN3MPI8DatatypeE[_ZTVN3MPI8DatatypeE]+0x78): undefined reference to `MPI::Datatype::Free()'
collect2: error: ld returned 1 exit status
src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/build.make:1244: recipe for target 'lib/libSMESH.so' failed
make[2]: *** [lib/libSMESH.so] Error 1
CMakeFiles/Makefile2:535: recipe for target 'src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/all' failed
make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
If only I could remember what I did last time to solve this...
Do you remember what you did to solve this because I have the same issue on Ubuntu mate 16.10 64 bits beta. :mrgreen:

I am on commit 279418f032ae2a7708a4639efa7c371f66601d7f

Thx,
gdo
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by yorik »

gdo35 wrote:Do you remember what you did to solve this because I have the same issue on Ubuntu mate 16.10 64 bits beta. :mrgreen:
I think I added -lmpi_cxx somewhere... There is a cmake variable where you can add custom linker (-l) switches, but I don't remember which one...
User avatar
jCandlish
Posts: 18
Joined: Tue Apr 07, 2015 2:30 pm
Location: Oberargau, Switzerland

Re: Compile on Linux (Kubuntu): CMake can't find VTK

Post by jCandlish »

On Debian (unstable for me), SMESH is explicitly expecting to link against MPI.

I couldn't find an easy way to force SMESH to use the serial HDF5 implementation.

What got it going for me was to hint cmake the location of the openmpi HDF5 libraries by setting the environment variable HDF5_ROOT in the toplevel CMakeLists.txt at around line 589

Code: Select all

        if(NOT FREECAD_USE_EXTERNAL_SMESH)
            # See https://www.hdfgroup.org/HDF5/release/cmakebuild.html
            if (WIN32)
                find_package(HDF5 COMPONENTS NO_MODULE REQUIRED static)
              else()
		set(HDF5_ROOT "/usr/lib/x86_64-linux-gnu/hdf5/openmpi")
#		set(HDF5_ROOT "/usr/lib/x86_64-linux-gnu/hdf5/serial")
                find_package(HDF5 REQUIRED)
            endif()
            find_package(MEDFile REQUIRED)
            set(SMESH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/3rdParty/salomesmesh/inc)
        else()
And then specifying '/usr/bin/mpic++.openmpi' as the CMAKE_CXX_COMPILIER

Hope that is a help.
Post Reply