Problem 1317 - geant-4.9.5_p01 makes g4py unable to be compiled
Summary: geant-4.9.5_p01 makes g4py unable to be compiled
Status: CLOSED FIXED
Alias: None
Product: Environments
Classification: Unclassified
Component: g4py (show other problems)
Version: 9.5
Hardware: All All
: P5 critical
Assignee: Koichi Murakami
URL:
Depends on:
Blocks:
 
Reported: 2012-05-20 17:49 CEST by Benda Xu
Modified: 2012-08-08 15:29 CEST (History)
1 user (show)

See Also:


Attachments
The patch attached allows g4py compile in geant4.9.6.b01 (2.02 KB, patch)
2012-07-20 01:51 CEST, Mikhail Terekhov
Details | Diff

Note You need to log in before you can comment on or make changes to this problem.
Description Benda Xu 2012-05-20 17:49:43 CEST
From the release notes, http://geant4.web.cern.ch/geant4/support/Patch4.9.5-1.txt.

All the class with "Coverity defects" items are affected. e.g. for pyG4Run.cc, the copy methods becomes private.

Compiling pyG4Run.cc ...
In file included from /localwork/benda/gentoo/usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52:0,
                 from /localwork/benda/gentoo/usr/include/boost/python/object/pointer_holder.hpp:65,
                 from /localwork/benda/gentoo/usr/include/boost/python/to_python_indirect.hpp:10,
                 from /localwork/benda/gentoo/usr/include/boost/python/converter/arg_to_python.hpp:10,
                 from /localwork/benda/gentoo/usr/include/boost/python/call.hpp:15,
                 from /localwork/benda/gentoo/usr/include/boost/python/object_core.hpp:14,
                 from /localwork/benda/gentoo/usr/include/boost/python/args.hpp:25,
                 from /localwork/benda/gentoo/usr/include/boost/python.hpp:11,
                 from pyG4Run.cc:33:
/localwork/benda/gentoo/usr/include/Geant4/G4Run.hh: In constructor ‘boost::python::objects::pointer_holder<Pointer, Value>::pointer_holder(P
yObject*, A0) [with A0 = boost::reference_wrapper<const G4Run>, Pointer = G4Run*, Value = G4Run, PyObject = _object]’:
/localwork/benda/gentoo/usr/include/boost/python/object/make_instance.hpp:71:48:   instantiated from ‘static Holder* boost::python::objects::
make_instance<T, Holder>::construct(void*, PyObject*, boost::reference_wrapper<const T>) [with T = G4Run, Holder = boost::python::objects::po
inter_holder<G4Run*, G4Run>, PyObject = _object]’
/localwork/benda/gentoo/usr/include/boost/python/object/make_instance.hpp:45:13:   instantiated from ‘static PyObject* boost::python::objects
::make_instance_impl<T, Holder, Derived>::execute(Arg&) [with Arg = const boost::reference_wrapper<const G4Run>, T = G4Run, Holder = boost::p
ython::objects::pointer_holder<G4Run*, G4Run>, Derived = boost::python::objects::make_instance<G4Run, boost::python::objects::pointer_holder<
G4Run*, G4Run> >, PyObject = _object]’
/localwork/benda/gentoo/usr/include/boost/python/object/class_wrapper.hpp:29:51:   instantiated from ‘static PyObject* boost::python::objects
::class_cref_wrapper<Src, MakeInstance>::convert(const Src&) [with Src = G4Run, MakeInstance = boost::python::objects::make_instance<G4Run, b
oost::python::objects::pointer_holder<G4Run*, G4Run> >, PyObject = _object]’
/localwork/benda/gentoo/usr/include/boost/python/converter/as_to_python_function.hpp:27:9:   instantiated from ‘static PyObject* boost::pytho
n::converter::as_to_python_function<T, ToPython>::convert(const void*) [with T = G4Run, ToPython = boost::python::objects::class_cref_wrapper
<G4Run, boost::python::objects::make_instance<G4Run, boost::python::objects::pointer_holder<G4Run*, G4Run> > >, PyObject = _object]’
/localwork/benda/gentoo/usr/include/boost/python/to_python_converter.hpp:87:5:   instantiated from ‘boost::python::to_python_converter<T, Con
version, has_get_pytype>::to_python_converter() [with T = G4Run, Conversion = boost::python::objects::class_cref_wrapper<G4Run, boost::python
::objects::make_instance<G4Run, boost::python::objects::pointer_holder<G4Run*, G4Run> > >, bool has_get_pytype = true]’
/localwork/benda/gentoo/usr/include/boost/python/object/class_wrapper.hpp:24:8:   instantiated from ‘static void boost::python::objects::clas
s_metadata<T, X1, X2, X3>::maybe_register_class_to_python(T2*, mpl_::false_) [with T2 = G4Run, T = G4Run, X1 = G4Run*, X2 = boost::python::de
tail::not_specified, X3 = boost::python::detail::not_specified, mpl_::false_ = mpl_::bool_<false>]’
/localwork/benda/gentoo/usr/include/boost/python/object/class_metadata.hpp:229:9:   instantiated from ‘static void boost::python::objects::cl
ass_metadata<T, X1, X2, X3>::register_aux2(T2*, Callback) [with T2 = G4Run, Callback = boost::integral_constant<bool, false>, T = G4Run, X1 =
 G4Run*, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]’
/localwork/benda/gentoo/usr/include/boost/python/object/class_metadata.hpp:219:9:   instantiated from ‘static void boost::python::objects::cl
ass_metadata<T, X1, X2, X3>::register_aux(void*) [with T = G4Run, X1 = G4Run*, X2 = boost::python::detail::not_specified, X3 = boost::python:
:detail::not_specified]’
/localwork/benda/gentoo/usr/include/boost/python/object/class_metadata.hpp:205:9:   instantiated from ‘static void boost::python::objects::cl
ass_metadata<T, X1, X2, X3>::register_() [with T = G4Run, X1 = G4Run*, X2 = boost::python::detail::not_specified, X3 = boost::python::detail:
:not_specified]’
/localwork/benda/gentoo/usr/include/boost/python/class.hpp:496:9:   instantiated from ‘void boost::python::class_<T, X1, X2, X3>::initialize(
const DefVisitor&) [with DefVisitor = boost::python::init<>, W = G4Run, X1 = G4Run*, X2 = boost::python::detail::not_specified, X3 = boost::$
....
...
/localwork/benda/gentoo/usr/include/Geant4/G4Run.hh:55:5: error: ‘G4Run::G4Run(const G4Run&)’ is private
/localwork/benda/gentoo/usr/include/boost/python/object/pointer_holder.hpp:194:14: error: within this context
make: *** [pyG4Run.o] Error 1
Comment 1 Benda Xu 2012-05-21 04:26:06 CEST
It seems that those class becomes boost::noncopyable. Therefore, 

diff --git a/source/run/pyG4Run.cc b/source/run/pyG4Run.cc
index f633973..33ffb46 100644
--- a/source/run/pyG4Run.cc
+++ b/source/run/pyG4Run.cc
@@ -42,7 +42,7 @@ using namespace boost::python;
 // ====================================================================
 void export_G4Run()
 {
-  class_<G4Run, G4Run*>("G4Run", "run class")
+  class_<G4Run, boost::noncopyable>("G4Run", "run class")
     // ---
     .def("GetRunID",         &G4Run::GetRunID)
     .def("SetRunID",         &G4Run::SetRunID)

May be sufficient. Will come up with a whole patch this week.
Comment 2 Mikhail Terekhov 2012-07-20 01:51:34 CEST
Created attachment 179 [details]
The patch attached allows g4py compile in geant4.9.6.b01
Comment 3 Benda Xu 2012-07-20 07:16:48 CEST
(In reply to comment #2)
> Created attachment 179 [details]
> The patch attached allows g4py compile in geant4.9.6.b01

Hello, Mikhail, Thanks a lot for the patch. 

I have also posted a message on the forum,

http://hypernews.slac.stanford.edu/HyperNews/geant4/get/installconfig/1486.html
Comment 4 Koichi Murakami 2012-07-21 16:37:47 CEST
Thanks.
That was fixed as you shown.
Comment 5 Thomas Kittelmann 2012-08-08 15:29:08 CEST
Was this patch really included in geant4.9.6.b01? I just had the same compilation errors there.

Cheers,
Thomas