Still problems with the installation in Scientific Linux 5.0

Asked by Gonzalo Tancredi

We have been struggling from many days with the installation of ESyS in OS: Scientific Linux 5.0.

I have installed ESyS in Ubuntu without problems, and I have been able to run several simulations. But now I want to run the latest version of ESyS-particle in our cluster with Scientific Linux.

The default system has python 2.4 and boost 1.33, and, the administrator does not want to upgrade to python 2.6 and boost > 1.34 because it is not possible to update it automatically.

Therefore, I must install python and boost in my directory and try to compile ESyS.

I downloaded Python-2.7.1 and install it in
/home/gtancredi/Software/python

I downloaded boost_1_46_0 and install it following the suggestions instructions in
Using nondefault Python and Boost with ESyS-Particle
https://answers.launchpad.net/esys-particle/+faq/1235

./bootstrap.sh --with-libraries=system,filesystem,regex,python
 ./bjam --prefix=../boost python=2.7 install

In my .bash_profile I have:
PATH=/home/gtancredi/Software/python/bin:$PATH
export PATH
LD_LIBRARY_PATH=/home/gtancredi/Software/python/lib:/home/gtancredi/Software/boost/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

The boost files are installed in:
/home/gtancredi/Software/boost

Then I go to the esys-particle_trunk directory
I do the
sh autogen.sh

./configure --prefix=/home/gtancredi/Software/esys-particle CC=mpicc CXX=mpic++ --with-boost=/home/gtancredi/Software/boost --with-boost-filesystem=boost_filesystem --with-boos-python=boost_python

The last output lines are
checking for Py_Main in -lpython2.7... no
checking for boostlib >= 1.34.1... yes
checking whether the Boost::Filesystem library is available... yes
checking for __cxa_atexit in -lboost_filesystem... yes
checking whether the Boost::Python library is available... yes
checking for __cxa_atexit in -lboost_python... no
checking for __cxa_atexit in -lboost_python... (cached) no
checking for __cxa_atexit in -lboost_python-mt... no
configure: error:
    The boost python library was not found. Please install and
    re-run configure.

In the config.log the problems appear when it says
.....
configure:22332: checking for __cxa_atexit in -lboost_python
configure:22362: mpic++ -o conftest -g -O2 -L/home/gtancredi/Software/boost/lib conftest.cc -lboost_python >&5
/home/gtancredi/Software/boost/lib/libboost_python.so: undefined reference to `PyList_Insert'
/home/gtancredi/Software/boost/lib/libboost_python.so: undefined reference to `PyExc_ImportError'
/home/gtancredi/Software/boost/lib/libboost_python.so: undefined reference to `PyString_InternFromString'
/home/gtancredi/Software/boost/lib/libboost_python.so: undefined reference to `PyProperty_Type'
/home/gtancredi/Software/boost/lib/libboost_python.so: undefined reference to `PyString_AsString'
/home/gtancredi/Software/boost/lib/libboost_python.so: undefined reference to `PyExc_StopIteration'
......
collect2: ld returned 1 exit status
configure:22368: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "ESyS-Particle"
| #define PACKAGE_TARNAME "esys-particle"
,,,,,,,,,,,
collect2: ld returned 1 exit status
configure:22368: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "ESyS-Particle"
| #define PACKAGE_TARNAME "esys-particle"
...........
configure:22394: result: no
configure:22408: error:
    The boost python library was not found. Please install and
    re-run configure.

Do you need some more information?

I am really stuck and I do not know what else I can try.
And I really need to use the cluster to do some more simulations to be included in a paper that I have almost finished.

If anyone prefer to try with my account, I can give access to it.

Regards

Gonzalo

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
Gonzalo Tancredi
Solved:
Last query:
Last reply:
Revision history for this message
Feng Chen (fchen3-gmail) said :
#1

Hi, Gonzalo:

It seems your configure command for the last boost python missed a "t"?

./configure --prefix=/home/gtancredi/Software/esys-particle CC=mpicc CXX=mpic++ --with-boost=/home/gtancredi/Software/boost --with-boost-filesystem=boost_filesystem --with-boos-python=boost_python

-with-boos-python=boost_python #this should be -with-boost-python

Feng

Revision history for this message
Vince Boros (v-boros) said :
#2

Hello Gonzalo:

Can I start by asking you to check which version of Python your system sees (ls -l `which python`)? If the link is not to 2.7, then this may well be the source of your configuration problem. (I suppose that you had not the option of creating the links detailed in the FAQ, since you would need administrator access. Did you also completely uninstall ESyS-Particle before running configure?) If the link is to version 2.7, then maybe there is a new problem associated with the new Python or the new Boost, in which case I will follow the FAQ instructions on my machine with the new versions. (The configure output seems to say that it is using Python 2.7, so one other possibility is that Boost was not, in fact, built using Python 2.7. I will find out what my system reports when I reinstall.)

Meanwhile, if you are short of time, as an interim measure you may be able to use Python 2.4 if you have no need of POV-Ray. As far as I know, this incompatibility is the only one. As for Boost, apparently there is or was an incompatibility with 1.33.1, but with ESyS-Particle 2.0 it has not appeared. So you may be successful in installing ESyS-Particle using the system default Python and Boost by changing one line in configure.ac from

AX_BOOST_BASE([1.34.1])

to

AX_BOOST_BASE([1.33.1])

Be sure to run "sh autogen.sh" after making this change before running "configure".

Vince

Revision history for this message
Gonzalo Tancredi (gonzalo) said :
#3

Hi Vince

Dion, by personal email, gave me a similar suggestion and a patch to solve the problem.
He was planning to write a FAQ with the solution.

I have been able to compile the trunk version of ESyS-Particle and I am running it without problems.

Thank you very much

Gonzalo

Revision history for this message
Dion Weatherley (d-weatherley) said :
#4

Hi all,

The current development version of ESyS-Particle works fine with Python-2.4 (without POVray support, as mentioned by Vince). The main issue Gonzalo faced was the older version of boost. From version 2.0 stable, ESyS-Particle works fine only with boost-1.34 and later versions. Earlier versions of ESyS-Particle worked with boost-1.33 but unfortunately the boost developers introduced a change in v1.34 that required us to modify ESyS-Particle as well.

At the time, different linux distributions shipped with either v1.33 or v1.34. Consequently, we modified the code to minimize the amount of changes required to comply with either boost version. There is only one line of ESyS-Particle code that must be changed to use boost-1.33 instead. For posterity, this is the change one must make:

Using a text editor, open Python/BoostPythonUtil/Util.h and change line number 32 FROM:
        return boost::python::extract<int>(pyOb.attr("__len__")());
TO:
        return boost::python::len(pyOb);

(Thank goodness the ESyS-Particle source code has been under version control for so long!)

Of course this change solved Gonzalo's specific problem but not the general problem of using non-standard Python and Boost installations on supercomputers/PCs where the default versions are unsuitable for ESyS-Particle. Unfortunately, I am yet to find a single solution to this problem that works on all systems. This FAQ is a good start:
https://answers.launchpad.net/esys-particle/+faq/1235
to help with using newer Python and Boost versions.However, if you lack administrator privileges, this won't solve the problem.

Gonzalo was on the right track with the ./configure options --with-boost*. There are four such options (from ./configure --help):
[quote]
  --with-boost[=DIR] use boost (default is yes) - it is possible to
                          specify the root directory for boost (optional)
  --with-boost-libdir=LIB_DIR
                          Force given directory for boost libraries. Note that
                          this will overwrite library path detection, so use
                          this parameter only if default library detection
                          fails and you know exactly where your boost
                          libraries are located.
  --with-boost-filesystem[=special-lib]
                          use the Filesystem library from boost - it is
                          possible to specify a certain library for the linker
                          e.g. --with-boost-filesystem=boost_filesystem-gcc-mt
  --with-boost-python specify the boost python library or suffix to use
[end quote]

Usually experimenting with various combinations of these options, as well as specifying the path to your preferred Python and Boost shared libraries in the ./configure LDFLAGS argument will assist ESyS-Particle to use the correct libraries for compiling and installation. Anyone who finds they need such options is invited to share their experiences in this thread so (perhaps) we can eventually determine a simple method to handle such situations.

Cheers,

Dion.

Revision history for this message
Vince Boros (v-boros) said :
#5

Hello Gonzalo.

I am glad that you have found a workaround for your code. I went ahead though, anyway, to find a solution to the Boost Python library problem that occurs during the configure stage of ESyS-Particle, because the error, "checking for __cxa_atexit in -lboost_python... no", has appeared now several times. So what follows is for the ESyS-Particle community in general to verify or find a way to improve as time goes on. I will replace the current FAQ soon and update it whenever anyone finds improvements for rendering the ESyS-Particle build compatible with Boost and Python.

The use of user-config.jam (current FAQ 1235) I have now been finding to be problematic, though I know not why. So I instead have used the "--prefix" option for the Boost bootstrap and Python configure stages to specify an installation folder, as we do with ESyS-Particle, and this has worked.

I configured ESyS-Particle successfully using Boost 1.46 and Python 2.7. Unfortunately the build failed during the make stage. Building Boost 1.46 with Python versions 2.6, 2.5 and 2.4 also yielded the ESyS-Particle make failure. I have been unable yet to find a solution to this problem.

Boost 1.45 does work with Python 2.7, though.

Th error, "checking for Py_Main in -lpython2.7... no", troubles me. I have been unable to replicate it. It indicates to me that the Python 2.7 binary was located, or at least searched for, but I suspect that there may be an incompatibility between the Python binary and the Python library (perhaps the wrong library version).

As for the error, "checking for __cxa_atexit in -lboost_python... no", I replicated this and eventually tracked the cause down to incompatibilities between Boost libraries, Boost include files and Python libraries.

When, for example, Boost 1.45.0 is built and installed first with Python 2.4.6, and then rebuilt with Python 2.7.1 without first removing the existing Boost build, the installed Boost libraries are not updated and the ESyS-Particle build fails during configuration at the "boost_python" check. By first removing the existing Boost build, the existing Boost libraries are then overwritten with libraries that have been built for Python 2.7.1, and the ESyS-Particle build succeeds.

If a different version of Boost is installed, new Boost libraries are created but the Boost include files are not completely overwritten. New Boost include files appear in the installed Boost folder, but existing files may not necessarily be updated for the new Boost version. When I installed Boost 1.45.0 after installing Boost 1.40.0 with Python 2.7.1, the ESyS-Particle build failed during make.

If Boost libraries are installed somewhere other than under /usr/, then the "--with-boost=" option is needed to specify the location of these libraries when configuring ESyS-Particle. Otherwise, if another installation of Boost exists in the system area (/usr/) and it has been built with a version of Python different from the version used to build ESyS-Particle, the ESyS-Particle build will again fail.

In short, to play it safe, be sure to remove the existing Boost installation (libraries and include files) from the location that will be used for a fresh install, and remove any existing Boost and Python build files. (It seems unnecessary to remove an existing Python installation, because the Python installation process uses version numbers for its binaries, libraries and folders, so preventing different versions from being mixed. Moreover, the Python installation process always overwrites existing installed files. The only Python removal required, recommended in the Python installation help instructions, is to remove an existing Python build before building anew.)

The instructions below for installing Boost and Python from source were tested in the presence of Boost 1.35 and Python 2.4 packages installed under /usr/. I hope that they will be helpful to the ESyS-Particle community, and I will be grateful if anyone can find a better, simpler, robuster way to make everything work together.

Installing Python and Boost from source to work with ESyS-Particle
-----------------------------------------------------------------------------------------------------

These notes are for installing Boost 1.45.0 and Python 2.7.1 under $HOME, for which you need the $HOME/bin/, $HOME/lib/ and $HOME/include/ folders. They assume that the Boost and Python builds are under $HOME/boost_1_45_0/ and $HOME/Python-2.7.1/, and that ESyS-Particle source files are under $HOME/esys-particle/source/. Commands that need to be entered follow the ">" symbol which represents the command prompt.

1/ Remove the existing ESyS-Particle installation and build files:
> cd $HOME/esys-particle/source/
> make uninstall
> make distclean

2/ Remove the existing installed Boost include and library files:
> rm -rf $HOME/include/boost/ $HOME/lib/libboost_*

3/ Remove the existing Boost build:
> cd $HOME/boost_1_45_0/
> ./bjam --clean
or
> rm -rf bin.v2/

4/ Remove the existing Python build:
> cd $HOME/Python-2.7.1/
> make distclean

5/ Add the binary and library paths to PATH and LD_LIBRARY_PATH for detecting the Python binary and library and the Boost libraries (if not already added):
> export PATH=$HOME/bin:$PATH
> export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
Add these also to the end of $HOME/.bashrc.

6/ Build and install Python:
> cd $HOME/Python-2.7.1/
> ./configure --prefix=$HOME --enable-shared
> make
> make altinstall
The "--enable-shared" option allows installation of the Python library as a shared object. "make altinstall" allows multiple versions of Python to coexist.

7/ Link to Python 2.7, and check the link:
> ln -sf $HOME/bin/python2.7 $HOME/bin/python
> ln -sf $HOME/bin/python2.7-config $HOME/bin/python-config
> ls -l `which python`

8/ Build and install Boost:
> cd $HOME/boost_1_45_0/
> ./bootstrap.sh --prefix=$HOME --with-libraries=filesystem,python,regex,system
> ./bjam install
In the ./bootstrap.sh output, check that the correct Python version (2.7) and the correct Python path ($HOME) were detected.

9/ When configuring ESyS-Particle, add the "--with-boost=$HOME" option. If your Boost installation results in nonstandard library names (such as the version of the C++ compiler included as part of the Boost library name), the "--with-boost-filesystem=" and "--with-boost-python=" options will also be needed to configure ESyS-Particle. The string following the "=" symbol needs to be the Boost library name without the initial "lib" string and without the final ".so" extension.

Revision history for this message
Vince Boros (v-boros) said :
#6

The question at https://answers.launchpad.net/esys-particle/+question/163708 contains information that may be relevant to this question.

Vince