Problem with libpython when compiling from source

Asked by Hien N.G. NGUYEN

Hello,

I'm trying to compile Yade-1.05 on my PC and the compile process give me this error:

...
[ 5%] Building CXX object gui/CMakeFiles/_GLViewer.dir/qt4/moc_OpenGLManager.cxx.o
Linking CXX shared library lib/x86_64-linux-gnu/_GLViewer.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [gui/lib/x86_64-linux-gnu/_GLViewer.so] Error 1
make[1]: *** [gui/CMakeFiles/_GLViewer.dir/all] Error 2
make: *** [all] Error 2
...

and the compilation stop. And I don't know how to fix this.
I'm using Ubuntu 12.04, and yadedaily works well. The reason I want to use Yade-1.05 is because I want to reuse some saved models (xml.gz) from another computer which uses Yade-1.05.

Thanks for considering my request.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Hien N.G. NGUYEN
Solved:
Last query:
Last reply:
Revision history for this message
Hien N.G. NGUYEN (rin) said :
#1

And the cmake does not have any error.

Revision history for this message
Chareyre (bruno-chareyre-9) said :
#2

Please show cmake output for such question.
Bruno

Revision history for this message
Hien N.G. NGUYEN (rin) said :
#3

Here is the cmake output

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonLibs: /usr/local/lib/libpython2.7.a
-- Found PythonInterp: /usr/bin/python (found version "2.7.3")
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt4: /usr/bin/qmake (found version "4.8.1")
-- Version is set to 1.05.0
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- GTS using gts-config /usr/bin/gts-config
-- Using GTS from /usr
-- Found GL2PS: /usr/lib/libgl2ps.so
-- Found CGAL: /usr/include/CGAL, /usr/lib/libCGAL.so
-- Found NumPy: version "1.6.1" /usr/lib/python2.7/dist-packages/numpy/core/include
-- Found Loki: /usr/include
-- Boost version: 1.46.1
-- Found the following Boost libraries:
-- python
-- thread
-- date_time
-- filesystem
-- iostreams
-- regex
-- serialization
-- system
-- Boost_VERSION: 104601
-- Boost_LIB_VERSION: 1_46_1
-- Boost_INCLUDE_DIRS: /usr/include
-- Boost_LIBRARIES: /usr/lib/libboost_python.so/usr/lib/libboost_thread-mt.sopthread/usr/lib/libboost_date_time-mt.so/usr/lib/libboost_filesystem-mt.so/usr/lib/libboost_iostreams-mt.so/usr/lib/libboost_regex-mt.so/usr/lib/libboost_serialization-mt.so/usr/lib/libboost_system-mt.so
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0")
-- Found BZip2: /usr/lib/x86_64-linux-gnu/libbz2.so
-- Looking for BZ2_bzCompressInit in /usr/lib/x86_64-linux-gnu/libbz2.so
-- Looking for BZ2_bzCompressInit in /usr/lib/x86_64-linux-gnu/libbz2.so - found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.3.4")
-- Found Eigen3
-- Found VTK
-- Found OpenMP
-- GTS using gts-config /usr/bin/gts-config
-- Using GTS from /usr
-- checking for one of the modules 'glib-2.0'
-- Found GLib2: glib-2.0 /usr/include/glib-2.0;/usr/lib/x86_64-linux-gnu/glib-2.0/include
-- Looking for include files HAVE_GLIB_GREGEX_H
-- Looking for include files HAVE_GLIB_GREGEX_H - found
-- Found GTS
-- Found Qt4: /usr/bin/qmake (found version "4.8.1")
-- Found QGLViewer: /usr/lib/x86_64-linux-gnu/libqglviewer-qt4.so
-- Found GUI-LIBS
-- GMP libs: /usr/lib/x86_64-linux-gnu/libgmp.so /usr/lib/x86_64-linux-gnu/libgmpxx.so
-- Found GMP: /usr/include
-- GMP libs: /usr/lib/x86_64-linux-gnu/libgmp.so /usr/lib/x86_64-linux-gnu/libgmpxx.so
-- Found CGAL
-- Found Cholmod: /usr/lib/libcholmod.so
-- Found OpenBlas: /usr/lib/openblas-base/libopenblas.so
-- Found Metis: /usr/include/metis
-- Found Cholmod
-- Found OpenBlas
-- Found Metis
-- Found GL2PS
Yade will be installed to /home/rinne/Programs/Yade-105/install
-- Suffix is set to -1.05.0
-- LIBRARY_OUTPUT_PATH is set to lib/x86_64-linux-gnu
-- runtimePREFIX is set to /home/rinne/Programs/Yade-105/install
-- Found gts: /usr/lib/python2.7/dist-packages/gts
-- Use system gts version
-- Found minieigen: /usr/lib/python2.7/dist-packages/minieigen.so
-- Use system minieigen version
-- Found Tkinter: /usr/lib/python2.7/lib-tk/Tkinter.pyc
-- ===========================================================
-- Yade configured with following features: Eigen3 VTK OpenMP GTS GUI CGAL PFVflow LinSolv GL2PS
-- Disabled features:
-- Optimized build
-- ===========================================================
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rinne/Programs/Yade-105/build

Revision history for this message
Anton Gladky (gladky-anton) said :
#4

> Found PythonLibs: /usr/local/lib/libpython2.7.a

That is very strange, that the library for the static linkage is found.
Check whether you have installed all dependencies to compile Yade
and pay attention on libpython-* packages.

Cheers

Anton

Revision history for this message
Hien N.G. NGUYEN (rin) said :
#5

Sorry Anton I'm not sure that I get your suggestion 100%, so normally what will be there instead? Look like the cmake found a wrong python library?

>Check whether you have installed all dependencies to compile Yade

I followed the instruction on yade-dem.org page, using this:

sudo apt-get install cmake git freeglut3-dev libloki-dev \
libboost-all-dev fakeroot dpkg-dev build-essential g++ \
python-dev ipython python-matplotlib libsqlite3-dev python-numpy python-tk gnuplot \
libgts-dev python-pygraphviz libvtk5-dev python-scientific libeigen3-dev \
python-xlib python-qt4 pyqt4-dev-tools gtk2-engines-pixbuf python-argparse \
libqglviewer-qt4-dev python-imaging libjs-jquery python-sphinx python-git python-bibtex \
libxmu-dev libxi-dev libcgal-dev help2man libbz2-dev zlib1g-dev

and installed all the package.

>and pay attention on libpython-* packages
And on my Ubuntu, libpython2.7 is installed (I see in Synaptic Package Manager), is that enough attention that I should pay?

Revision history for this message
Hien N.G. NGUYEN (rin) said :
#6

I forcely remove that lib file and recompile;
it seems working now.