DevHeads.net

FreeCAD: undefined reference to `Py::ifPyErrorThrowCxxException()'

I've posted to upstreams mailing list but have not as of yet gotten a
response.

I've run into the following error trying to build the latest version of
FreeCAD which requires python-pycxx but Rawhide now has 7.0.3 and the
bundled version appears to be 6.2.8.

I'm used to undefined references indicating that a library is missing at
the linker stage, but in the case of python-pycxx, it's a copylib. There is
no library to link to and it seems to be picking up the source and headers
at the correct location so I'm at a loss...

[ 24%] Linking CXX shared library ../../lib/libFreeCADBase.so
cd /builddir/build/BUILD/FreeCAD-0.17/build/src/Base && /usr/bin/cmake -E
cmake_link_script CMakeFiles/FreeCADBase.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -Wall -Wextra -Wno-write-strings -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-fexceptions -fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection
-std=c++11 -D_OCC64 -Wl,--no-undefined -shared
-Wl,-soname,libFreeCADBase.so -o ../../lib/libFreeCADBase.so
CMakeFiles/FreeCADBase.dir/usr/src/CXX/cxxextensions.c.o
CMakeFiles/FreeCADBase.dir/usr/src/CXX/cxx_extensions.cxx.o
CMakeFiles/FreeCADBase.dir/usr/src/CXX/cxxsupport.cxx.o
CMakeFiles/FreeCADBase.dir/usr/src/CXX/IndirectPythonInterface.cxx.o
CMakeFiles/FreeCADBase.dir/Axis.cpp.o
CMakeFiles/FreeCADBase.dir/AxisPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/Base64.cpp.o
CMakeFiles/FreeCADBase.dir/BaseClass.cpp.o
CMakeFiles/FreeCADBase.dir/BaseClassPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/BoundBoxPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/Builder3D.cpp.o
CMakeFiles/FreeCADBase.dir/Console.cpp.o
CMakeFiles/FreeCADBase.dir/CoordinateSystem.cpp.o
CMakeFiles/FreeCADBase.dir/CoordinateSystemPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/Debugger.cpp.o
CMakeFiles/FreeCADBase.dir/Exception.cpp.o
CMakeFiles/FreeCADBase.dir/ExceptionFactory.cpp.o
CMakeFiles/FreeCADBase.dir/Factory.cpp.o
CMakeFiles/FreeCADBase.dir/FileInfo.cpp.o
CMakeFiles/FreeCADBase.dir/FileTemplate.cpp.o
CMakeFiles/FreeCADBase.dir/FutureWatcherProgress.cpp.o
CMakeFiles/FreeCADBase.dir/gzstream.cpp.o
CMakeFiles/FreeCADBase.dir/GeometryPyCXX.cpp.o
CMakeFiles/FreeCADBase.dir/Handle.cpp.o
CMakeFiles/FreeCADBase.dir/InputSource.cpp.o
CMakeFiles/FreeCADBase.dir/Interpreter.cpp.o
CMakeFiles/FreeCADBase.dir/Matrix.cpp.o
CMakeFiles/FreeCADBase.dir/MatrixPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/MemDebug.cpp.o
CMakeFiles/FreeCADBase.dir/Parameter.cpp.o
CMakeFiles/FreeCADBase.dir/ParameterPy.cpp.o
CMakeFiles/FreeCADBase.dir/Persistence.cpp.o
CMakeFiles/FreeCADBase.dir/PersistencePyImp.cpp.o
CMakeFiles/FreeCADBase.dir/Placement.cpp.o
CMakeFiles/FreeCADBase.dir/PlacementPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/PyExport.cpp.o
CMakeFiles/FreeCADBase.dir/PyObjectBase.cpp.o
CMakeFiles/FreeCADBase.dir/Reader.cpp.o
CMakeFiles/FreeCADBase.dir/Rotation.cpp.o
CMakeFiles/FreeCADBase.dir/RotationPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/Sequencer.cpp.o
CMakeFiles/FreeCADBase.dir/Stream.cpp.o
CMakeFiles/FreeCADBase.dir/Swap.cpp.o
CMakeFiles/FreeCADBase.dir/swigpyrun_1.3.25.cpp.o
CMakeFiles/FreeCADBase.dir/swigpyrun_1.3.33.cpp.o
CMakeFiles/FreeCADBase.dir/swigpyrun_1.3.36.cpp.o
CMakeFiles/FreeCADBase.dir/swigpyrun_1.3.38.cpp.o
CMakeFiles/FreeCADBase.dir/swigpyrun_1.3.40.cpp.o
CMakeFiles/FreeCADBase.dir/swigpyrun.cpp.o
CMakeFiles/FreeCADBase.dir/TimeInfo.cpp.o
CMakeFiles/FreeCADBase.dir/Tools.cpp.o
CMakeFiles/FreeCADBase.dir/Tools2D.cpp.o
CMakeFiles/FreeCADBase.dir/Type.cpp.o CMakeFiles/FreeCADBase.dir/Uuid.cpp.o
CMakeFiles/FreeCADBase.dir/Vector3D.cpp.o
CMakeFiles/FreeCADBase.dir/VectorPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/Writer.cpp.o
CMakeFiles/FreeCADBase.dir/XMLTools.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsApi.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsApiPy.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsSchema.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsSchemaInternal.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsSchemaMKS.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsSchemaImperial1.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsSchemaCentimeters.cpp.o
CMakeFiles/FreeCADBase.dir/UnitsSchemaMmMin.cpp.o
CMakeFiles/FreeCADBase.dir/Quantity.cpp.o
CMakeFiles/FreeCADBase.dir/QuantityPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/Unit.cpp.o
CMakeFiles/FreeCADBase.dir/UnitPyImp.cpp.o
CMakeFiles/FreeCADBase.dir/PyTools.c.o
CMakeFiles/FreeCADBase.dir/PreCompiled.cpp.o -lpython2.7 -lxerces-c
-lboost_filesystem -lboost_program_options -lboost_regex -lboost_signals
-lboost_system -lboost_thread -lboost_chrono -lboost_date_time
-lboost_atomic -lz -lQtCore -lutil -ldl -lzipios
BUILDSTDERR: CMakeFiles/FreeCADBase.dir/usr/src/CXX/cxx_extensions.cxx.o:
In function `Py::Object::validate()':
BUILDSTDERR: /usr/src/CXX/Python2/cxx_extensions.cxx:122: undefined
reference to `Py::ifPyErrorThrowCxxException()'
BUILDSTDERR: CMakeFiles/FreeCADBase.dir/usr/src/CXX/cxx_extensions.cxx.o:
In function
`Py::PythonExtensionBase::callOnSelf(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, Py::Object const&,
Py::Object const&, Py::Object const&, Py::Object const&, Py::Object const&,
Py::Object const&, Py::Object const&, Py::Object const&, Py::Object
const&)':
BUILDSTDERR: /usr/include/CXX/Python2/Objects.hxx:2450: undefined reference
to `Py::ifPyErrorThrowCxxException()'
BUILDSTDERR: /usr/include/CXX/Python2/Objects.hxx:2426: undefined reference
to `Py::ifPyErrorThrowCxxException()'
BUILDSTDERR: /usr/include/CXX/Python2/Objects.hxx:2426: undefined reference
to `Py::ifPyErrorThrowCxxException()'
BUILDSTDERR: /usr/include/CXX/Python2/Objects.hxx:2426: undefined reference
to `Py::ifPyErrorThrowCxxException()'
BUILDSTDERR:
CMakeFiles/FreeCADBase.dir/usr/src/CXX/cxx_extensions.cxx.o:/usr/include/CXX/Python2/Objects.hxx:2426:
more undefined references to `Py::ifPyErrorThrowCxxException()' follow
BUILDSTDERR: collect2: error: ld returned 1 exit status

Thanks,
Richard

Comments

Re: FreeCAD: undefined reference to `Py::ifPyErrorThrowCxxExcept

By TASAKA Mamoru at 04/13/2018 - 20:35

Richard Shaw wrote on 04/14/2018 04:38 AM:
<snip>

CMakeFiles/FreeCADBase.dir/PyTools.c.o
Py::ifPyErrorThrowCxxException() is defined in
/usr/src/CXX/Python2/cxx_exceptions.cxx , so you have to also compile and
link this file.

Regards,
Mamoru

Re: FreeCAD: undefined reference to `Py::ifPyErrorThrowCxxExcept

By Richard Shaw at 04/15/2018 - 13:56

If you look closely you notice it was including in the linking :)

/usr/src/CXX/cxx_extensions.cxx.o

Thanks,
Richard

Re: FreeCAD: undefined reference to `Py::ifPyErrorThrowCxxExcept

By TASAKA Mamoru at 04/15/2018 - 19:14

Richard Shaw wrote on 04/16/2018 02:56 AM:
Well, you also need /usr/src/CXX/Python2/cxx_exceptions.cxx
(note: cxx_"exceptions".cxx, what you are saying is cxx_"extensions".cxx).

Regards,
Mamoru

Re: FreeCAD: undefined reference to `Py::ifPyErrorThrowCxxExcept

By Richard Shaw at 04/16/2018 - 09:09

Mea culpa... I was getting cross-eyed on that...

Got that fixed but not being a C++ guy I'm not sure what the next problem
is but perhaps pyCXX changed things between 6.2.8 and 7.0+

Now I'm getting:

[ 26%] Building CXX object
src/App/CMakeFiles/FreeCADApp.dir/GroupExtensionPyImp.cpp.o
cd /builddir/build/BUILD/FreeCAD-0.17/build/src/App && /usr/bin/c++
-DBOOST_106600 -DDOCDIR=\"/usr/share/doc/freecad\" -DFreeCADApp_EXPORTS
-DHAVE_CONFIG_H -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG
-DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_UITOOLS_LIB -DQT_WEBKIT_LIB -DQT_XML_LIB
-DRESOURCEDIR=\"/usr/share/freecad\" -D_OCC64
-I/builddir/build/BUILD/FreeCAD-0.17/build -I/usr/include/smesh -isystem
/usr/include/QtOpenGL -isystem /usr/include/QtSvg -isystem
/usr/include/QtUiTools -isystem /usr/include/QtWebKit -isystem
/usr/include/QtGui -isystem /usr/include/QtXml -isystem
/usr/include/QtNetwork -isystem /usr/include/QtCore
-I/builddir/build/BUILD/FreeCAD-0.17/build/src
-I/builddir/build/BUILD/FreeCAD-0.17/src
-I/builddir/build/BUILD/FreeCAD-0.17/build/src/App
-I/usr/include/python2.7 -Wall -Wextra -Wno-write-strings -O2 -g -pipe
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection
-std=c++11 -D_OCC64 -fPIC -o
CMakeFiles/FreeCADApp.dir/GroupExtensionPyImp.cpp.o -c
/builddir/build/BUILD/FreeCAD-0.17/src/App/GroupExtensionPyImp.cpp
/builddir/build/BUILD/FreeCAD-0.17/src/App/ExtensionContainerPyImp.cpp: In
member function 'PyObject*
App::ExtensionContainerPy::hasExtension(PyObject*)':
/builddir/build/BUILD/FreeCAD-0.17/src/App/ExtensionContainerPyImp.cpp:161:70:
error: no matching function for call to
'Py::Exception::Exception(PyObject*&,
std::__cxx11::basic_stringstream<char>::__string_type)'
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
^

Thanks,
Richard

Re: FreeCAD: undefined reference to `Py::ifPyErrorThrowCxxExcept

By TASAKA Mamoru at 04/16/2018 - 09:55

Richard Shaw wrote on 04/16/2018 10:09 PM:
<snip>

While I may not find out the solution, would you post the srpm
you are currently working somewhere?

Regards,
Mamoru