ROOTPWA-Maintainers / ROOTPWA

ROOTPWA is a toolkit for partial-wave analysis of multi-particle final states produced in high-energy particle reactions. It is used to determine hadron spectra from experimental data.
Other
8 stars 14 forks source link

testMC error: no registered converter was able to produce a C++ rvalue of type std::string #231

Open mmikhasenko opened 7 years ago

mmikhasenko commented 7 years ago

Compilation proceeds without errors. When I run the text example ${ROOTPWA}/test/testMC.sh, I get the following error

TypeError: No registered converter was able to produce a C++ rvalue of type std::string from this Python object of type str

The full output:

....
>>> testMC.sh: info: Test generation of phase-space data ...
    executing: /home/mikhasenko/Tools/ROOTPWA/build/bin/generatePhaseSpace -s 123456 -n 500 -p "/home/mikhasenko/Tools/ROOTPWA/particleData/particleDataTable.txt" -M 1800 -B 20 "./generator_noBeamSimulation.conf" -o "./data/phase_space_MASS_1800-1820_N_500.root"
Traceback (most recent call last):
  File "/home/mikhasenko/Tools/ROOTPWA/build/bin/generatePhaseSpace", line 7, in <module>
    import pyRootPwa
  File "/home/mikhasenko/Tools/ROOTPWA/build/pyLib/pyRootPwa/__init__.py", line 2, in <module>
    from _amplitude import calcAmplitude
  File "/home/mikhasenko/Tools/ROOTPWA/build/pyLib/pyRootPwa/_amplitude.py", line 4, in <module>
    import pyRootPwa.core
  File "/home/mikhasenko/Tools/ROOTPWA/build/pyLib/pyRootPwa/core.py", line 2, in <module>
    from pyRootPwa.libRootPwaPy import *
TypeError: No registered converter was able to produce a C++ rvalue of type std::string from this Python object of type str
!!! testMC.sh: 75: error: generation of phase-space data was not successful. Aborting.

My environment:

g++ (Ubuntu 4.8.5-4ubuntu2) 4.8.5
yaml-cpp master(dc9c750)
Python 2.7.12 from standard repository via apt-get
root 6.10/04
boost 1.58 from the standard repository via apt-get
suhlatwork commented 7 years ago

Hi Mikhail,

which version of Ubuntu are you actually using? If you are using Ubuntu 16.04, then gcc 5.3 should be the default version for gcc. Between gcc 4.8 and 5.3 the ABI has changed. I would expect the system BOOST to be compiled with 5.3, thus using the new ABI. Please try to use either the default compiler, or compile BOOST yourself.

mmikhasenko commented 7 years ago

Hi Sebastian, you might be right about the origin of the problem. Although, I have indeed Ubuntu 16.04 with default compiler gcc-4.8. Could it be that the new compiler came with updates which I did not do? I am on the way to compile boost myself, I will let you know. Thanks.

suhlatwork commented 7 years ago

Which package did you install to get gcc/g++? If you just install the g++ package you should get 5.3. Could you check which package you actually installed? In case you already have several versions of GCC installed, you could try update-alternatives to change the used version.

mmikhasenko commented 7 years ago

The gcc/g++ package came together with Ubuntu repository. I did not install it. You are right I have two alternatives:

apt list --installed | grep g++
g++/xenial,now 4:5.3.1-1ubuntu1 amd64 [installed]
g++-4.8/xenial,now 4.8.5-4ubuntu2 amd64 [installed]
g++-5/xenial-security,now 5.4.0-6ubuntu1~16.04.4 amd64 [installed,upgradable to: 5.4.0-6ubuntu1~16.04.5]

Probably update-altegnatives will work although I have not tried. The good news is that when I compiled boost myself the test example . /test/testMC.sh started to work!

Thank you very much. I am wondering whether there is a way to detect such problem during cmake step. It would be great. If you come up with an idea, I perform some tests.