Author Topic: [SOLVED] Compilation issue on Ubuntu 16.04  (Read 2233 times)

Davide

  • Newbie
  • *
  • Posts: 3
[SOLVED] Compilation issue on Ubuntu 16.04
« on: December 01, 2016, 06:20:19 PM »
Dear all,

I'm having trouble completing the compiling of the  Kratos installation process for Ubuntu 16.04 LTS.
I'm using CMake 3.5.1; Python 3.5; boost 1.59.0.
I have read the procedure “how to compile Kratos: Linux” on website and i have done the following steps:
- Subversion
- Dev Packages
- Boost
- CMake

and now i am trying to configure Kratos for the first time compilation, but when i launch
sh configure.sh
the configure has stopped and these are the error messages on terminal:

-- Configuring done
-- Generating done
-- Build files have been written to: /home/principale/kratos/kratos/cmake_build
[  0%] Built target triangle
[  4%] Built target tetMeshOpt
[  9%] Built target zlibstatic
[ 14%] Built target zlib
[ 15%] Built target tetgen
[ 15%] Built target runkratos
[ 21%] Built target itsol
[ 22%] Built target minigzip
[ 22%] Built target example
[ 23%] Built target example64
[ 40%] Built target superlu
[ 41%] Built target minigzip64
[ 42%] Built target itsol_solvers
[ 43%] Built target gidpost
[ 52%] Built target KratosCore
[ 52%] Linking CXX shared library KratosExternalSolversApplication.so
[ 52%] Linking CXX shared library KratosMeshingApplication.so
[ 53%] Linking CXX shared library KratosIncompressibleFluidApplication.so
[ 54%] Linking CXX shared library Kratos.so
CMakeFiles/KratosExternalSolversApplication.dir/custom_python/externalsolvers_python_application.cpp.o: In function `PyInit_KratosExternalSolversApplication':
externalsolvers_python_application.cpp:(.text+0x96a): undefined reference to `boost::python::detail::init_module(PyModuleDef&, void (*)())'
collect2: error: ld returned 1 exit status
applications/ExternalSolversApplication/CMakeFiles/KratosExternalSolversApplication.dir/build.make:156: recipe for target 'applications/ExternalSolversApplication/KratosExternalSolversApplication.so' failed
make[2]: *** [applications/ExternalSolversApplication/KratosExternalSolversApplication.so] Error 1
CMakeFiles/Makefile2:826: recipe for target 'applications/ExternalSolversApplication/CMakeFiles/KratosExternalSolversApplication.dir/all' failed
make[1]: *** [applications/ExternalSolversApplication/CMakeFiles/KratosExternalSolversApplication.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/KratosMeshingApplication.dir/custom_python/kratos_meshing_python_application.cpp.o: In function `PyInit_KratosMeshingApplication':
kratos_meshing_python_application.cpp:(.text+0x97a): undefined reference to `boost::python::detail::init_module(PyModuleDef&, void (*)())'
collect2: error: ld returned 1 exit status
applications/MeshingApplication/CMakeFiles/KratosMeshingApplication.dir/build.make:258: recipe for target 'applications/MeshingApplication/KratosMeshingApplication.so' failed
make[2]: *** [applications/MeshingApplication/KratosMeshingApplication.so] Error 1
CMakeFiles/Makefile2:596: recipe for target 'applications/MeshingApplication/CMakeFiles/KratosMeshingApplication.dir/all' failed
make[1]: *** [applications/MeshingApplication/CMakeFiles/KratosMeshingApplication.dir/all] Error 2
CMakeFiles/KratosIncompressibleFluidApplication.dir/custom_python/kratos_incompressible_fluid_python_application.cpp.o: In function `PyInit_KratosIncompressibleFluidApplication':
kratos_incompressible_fluid_python_application.cpp:(.text+0x61a): undefined reference to `boost::python::detail::init_module(PyModuleDef&, void (*)())'
collect2: error: ld returned 1 exit status
applications/incompressible_fluid_application/CMakeFiles/KratosIncompressibleFluidApplication.dir/build.make:1217: recipe for target 'applications/incompressible_fluid_application/KratosIncompressibleFluidApplication.so' failed
make[2]: *** [applications/incompressible_fluid_application/KratosIncompressibleFluidApplication.so] Error 1
CMakeFiles/Makefile2:528: recipe for target 'applications/incompressible_fluid_application/CMakeFiles/KratosIncompressibleFluidApplication.dir/all' failed
make[1]: *** [applications/incompressible_fluid_application/CMakeFiles/KratosIncompressibleFluidApplication.dir/all] Error 2
CMakeFiles/Kratos.dir/python/kratos_python.cpp.o: In function `PyInit_Kratos':
kratos_python.cpp:(.text+0x76a): undefined reference to `boost::python::detail::init_module(PyModuleDef&, void (*)())'
collect2: error: ld returned 1 exit status
kratos/CMakeFiles/Kratos.dir/build.make:1321: recipe for target 'kratos/Kratos.so' failed
make[2]: *** [kratos/Kratos.so] Error 1
CMakeFiles/Makefile2:432: recipe for target 'kratos/CMakeFiles/Kratos.dir/all' failed
make[1]: *** [kratos/CMakeFiles/Kratos.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
[  5%] Built target zlib
[  5%] Built target example
[  6%] Built target minigzip
[ 11%] Built target zlibstatic
[ 12%] Built target example64
[ 13%] Built target minigzip64
[ 15%] Built target gidpost
[ 24%] Built target KratosCore
[ 25%] Linking CXX shared library Kratos.so
CMakeFiles/Kratos.dir/python/kratos_python.cpp.o: In function `PyInit_Kratos':
kratos_python.cpp:(.text+0x76a): undefined reference to `boost::python::detail::init_module(PyModuleDef&, void (*)())'
collect2: error: ld returned 1 exit status
kratos/CMakeFiles/Kratos.dir/build.make:1321: recipe for target 'kratos/Kratos.so' failed
make[2]: *** [kratos/Kratos.so] Error 1
CMakeFiles/Makefile2:432: recipe for target 'kratos/CMakeFiles/Kratos.dir/all' failed
make[1]: *** [kratos/CMakeFiles/Kratos.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

I don’t know what i am doing wrong, so i would really appreciate if you could help me understand what my mistakes are and how to complete the installation.

Regards,

Davide
« Last Edit: December 06, 2016, 11:02:03 AM by Miguel Angel Celigueta »

Carlos Roig

  • Newbie
  • *
  • Posts: 16
Re: Compiation issue on Ubuntu 16.04
« Reply #1 on: December 02, 2016, 10:52:21 AM »
Dear Davide,

The problem seems to indicate that the python version used when compiling boost is different from the one used to compile Kratos.
This may be caused by a mismatch indicating the versions, or because the configure file in step 1.5 hasn't been able to find python3.5 and has default to python2.7 which is selected by ubuntu 16.04 by default.

The routes for python3.5 ('assuming its the version shipped with the OS) should be:

-DPYTHON_LIBRARY="/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m.so"
-DPYTHON_INCLUDE_DIR="/usr/include/python3.5"

Can you please check that python version specified in the steps 1.3 and 1.5 are the same?
Also, can you check please that while running the configure.sh file instep 1.5 the selected version is python 3.5?

Br,

Charlie.


Davide

  • Newbie
  • *
  • Posts: 3
Re: Compiation issue on Ubuntu 16.04
« Reply #2 on: December 02, 2016, 03:03:34 PM »
Dear Charile,

Thank you very much for your support.

In step 1.3 i executed this command
sh bootstrap.sh
then i modified file project-config.jam and i wrote:

# Python configuration
   using python : 3.5 : /usr ;

After modifying i compiled the required boost libraries using this command:

./b2 stage --with-python --with-serialization cxxflags="-std=c++11" link=shared,static

In configure.sh file i have:

-DPYTHON_LIBRARY="/usr/lib/python3.5/config-3.5m-i386-linux-gnu/libpython3.5m.so"                          \
-DPYTHON_INCLUDE_DIR="/usr/include/python3.5"                           \

when running the configure.sh file in step 1.5 i have on terminal:

additional default options were set for gcc
CMAKE_CXX_FLAGS =  -msse3 -std=c++11 -funroll-loops -ffast-math -Wall -std=c++11
CMAKE_C_FLAGS =  -msse3 -funroll-loops -ffast-math -Wall
KRATOS_EXCLUDE_OPENMP
OpenMP included
-- Boost version: 1.59.0
-- Found the following Boost libraries:
--   python
-- Found PythonLibs: /usr/lib/python3.5/config-3.5m-i386-linux-gnu/libpython3.5m.so (found version "3.5.2")
-- A library with BLAS API found.
linker flags with blas =
BLA_VENDOR = All
-- A library with BLAS API found.
-- A library with LAPACK API found.
LAPACK = /usr/lib/lapack/liblapack.so.3.6.0/usr/lib/libblas/libblas.so.3.6.0
LAPACK modified = /usr/lib/lapack/liblapack.so.3.6.0/usr/lib/libblas/libblas.so.3.6.0
 
CMAKE_BUILD_TYPE ........ Release
 
INCOMPRESSIBLE_FLUID_APPLICATION ... ON
MESHING_APPLICATION ................ ON
EXTERNAL_SOLVERS_APPLICATION........ ON
PFEM_APPLICATION.................... OFF
STRUCTURAL_APPLICATION.............. OFF
STRUCTURAL_MECHANICS_APPLICATION.... OFF
CONVECTION_DIFFUSION_APPLICATION.... ON
SOLID_MECHANICS_APPLICATION......... OFF
PFEM_BASE_APPLICATION...............
PFEM_SOLID_MECHANICS_APPLICATION....
MACHINING_APPLICATION...............
FLUID_DYNAMICS_APPLICATION.......... ON
PFEM_FLUID_DYNAMICS_APPLICATION.....
STRING_DYNAMICS_APPLICATION.........
ALE_APPLICATION..................... ON
FSI_APPLICATION..................... ON
EMPIRE_APPLICATION..................
MIXED_ELEMENT_APPLICATION........... ON
DEM_APPLICATION..................... OFF
SWIMMING_DEM_APPLICATION............ OFF
CONSTITUTIVE_LAWS_APPLICATION.......
THERMO_MECHANICAL_APPLICATION.......
OPENCL_APPLICATION.................. OFF
MKL_SOLVERS_APPLICATION............. OFF
MPI_SEARCH_APPLICATION..............
METIS_APPLICATION................... OFF
TRILINOS_APPLICATION................ OFF
TURBULENT_FLOW_APPLICATION..........
BLOOD_FLOW_APPLICATION..............
PURE_DIFFUSION_APPLICATION..........
MESHLESS_APPLICATION................
WIND_TURBINE_APPLICATION ...........
CLICK2CAST_APPLICATION .............
MULTISCALE_APPLICATION .............
PFEM2_APPLICATION...................
FREEZING_SOIL_APPLICATION...........
ADJOINT_FLUID_APPLICATION...........
POROMECHANICS_APPLICATION...........
PARTICLE_MECHANICS_APPLICATION......
FORMING_APPLICATION.................
DAM_APPLICATION.....................
SHAPE_OPTIMIZATION_APPLICATION...... OFF
TOPOLOGY_OPTIMIZATION_APPLICATION... OFF
MY_LAPLACIAN_APPLICATION............
LAGRANGIAN_MPM_APPLICATION..........
CONTACT_MECHANICS_APPLICATION.......
CONTACT_STRUCTURAL_MECHANICS_APPLICATION.......
 
**** configuring KratosIncompressibleFluidApplication ****
**** configuring KratosMeshingApplication ****
**** configuring KratosExternalSolversApplication ****
**** configuring KratosConvectionDiffusionApplication ****
**** configuring KratosFluidDynamicsApplication ****
**** configuring KratosALEApplication ****
**** configuring KratosFSIApplication ****
**** configuring KratosMixedElementApplication ****
python libraries to be installed are: /usr/lib/i386-linux-gnu/libpython3.5m.so.1.0
--------------------------------  standard install dir /home/principale/kratos/kratos
boost python lib used = /home/principale/Documenti/boost_1_59_0/stage/lib/libboost_python.so.1.59.0
installed blas = /usr/lib/libblas/libblas.so.3.6.0
installed lapack = /usr/lib/lapack/liblapack.so.3.6.0/usr/lib/libblas/libblas.so.3.6.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/principale/kratos/kratos/cmake_build


Have i done any mistakes?

Regards,

Davide

Carlos Roig

  • Newbie
  • *
  • Posts: 16
Re: Compiation issue on Ubuntu 16.04
« Reply #3 on: December 03, 2016, 02:37:09 AM »
Dear Davide,

I have been testing your configuration and there is apparently nothing wrong, I have even been able to build it in a virtual machine.

At this point I would tell you that maybe is a problem with the architecture (32vs 64bits), but please let me do some tests this weekend so I can tell so something more helpful on Monday

Br

Carlos Roig

  • Newbie
  • *
  • Posts: 16
Re: Compiation issue on Ubuntu 16.04
« Reply #4 on: December 05, 2016, 10:42:24 AM »
Dear Davide,

After running the tests I can confirm you that the problem is likely to be related with the arch of the libs.
We can try a couple of things.

Option 1

For what I can see in the configure.sh, you are using a i386 version of the python lib. This should only be done in 32 bit operating systems.
Nowadays almost every computer use a 64 bit system. Can you confirm me that you are using a 32 bit OS?

If not, please try to change:

-DPYTHON_LIBRARY="/usr/lib/python3.5/config-3.5m-x86-64-linux-gnu/libpython3.5m.so"                          \
-DPYTHON_INCLUDE_DIR="/usr/include/python3.5"  \

Instead of

-DPYTHON_LIBRARY="/usr/lib/python3.5/config-3.5m-i386-linux-gnu/libpython3.5m.so"                          \
-DPYTHON_INCLUDE_DIR="/usr/include/python3.5"  \

Option 2

In case your OS is indeed a 32 bit os, then probably boost was compiled for 64. In this case, please, remove these folders in the boost directory:
  • stage
  • bin.v2
and try to rerun the boost compilation with one additional flag:

 ./b2 stage --with-python --with-serialization cxxflags="-std=c++11" address-model=32_64 link=shared,static

Please, tell me if any of  these solutions works for you.
Br.

Davide

  • Newbie
  • *
  • Posts: 3
Re: Compiation issue on Ubuntu 16.04
« Reply #5 on: December 06, 2016, 09:07:25 AM »
Dear Charile,

yes, unfortunately i am using a 32bit system, so i have done option 2 and finally i have solved all my issues!!!

Thank you very much for helping me, for your time and your kindness, your advice was really useful.

Best regards,

Davide