Compile error: Document.cpp

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
hinckel
Posts: 111
Joined: Fri Nov 21, 2014 11:45 am
Location: SJCAMPOS, SP - BR

Compile error: Document.cpp

Post by hinckel »

/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp: In member function ‘std::vector<App::DocumentObject*> App::Document::findObjects(const Base::Type&, const char*) const’:
/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp:2084:5: error: ‘regex’ is not a member of ‘boost’
boost::regex rx(objname);
^
/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp:2084:18: error: expected ‘;’ before ‘rx’
boost::regex rx(objname);
^
/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp:2085:5: error: ‘cmatch’ is not a member of ‘boost’
boost::cmatch what;
^
/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp:2085:19: error: expected ‘;’ before ‘what’
boost::cmatch what;
^
/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp:2089:17: error: ‘regex_match’ is not a member of ‘boost’
if (boost::regex_match((*it)->getNameInDocument(), what, rx))
^
/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp:2089:64: error: ‘what’ was not declared in this scope
if (boost::regex_match((*it)->getNameInDocument(), what, rx))
^
/home/hinckel/FreeCAD/JRFreeCAD/src/App/Document.cpp:2089:70: error: ‘rx’ was not declared in this scope
if (boost::regex_match((*it)->getNameInDocument(), what, rx))
^
cmake log

hinckel@sigma:~/FreeCAD/JRFreeCAD-Build> cmake ../JRFreeCAD
-- prefix: /usr/local
-- datadir: data
-- docdir: doc
-- includedir: include
-- libdir: /usr/local/lib
-- Boost version: 1.59.0
-- Found the following Boost libraries:
-- filesystem
-- program_options
-- regex
-- signals
-- system
-- thread
-- Found Xerces-C: /usr/lib64/libxerces-c.so
-- PyCXX found:
-- Headers: /home/hinckel/FreeCAD/JRFreeCAD/src
-- Sources: /home/hinckel/FreeCAD/JRFreeCAD/src/CXX
-- -- OpenCASCADE Community Edition has been found.
-- -- Found OCE/OpenCASCADE version: 6.8.0
-- -- OCE/OpenCASCADE include directory: /usr/local/lib/oce-0.17-dev/../../include/oce
-- -- OCE/OpenCASCADE shared libraries directory:
-- libshiboken built for Debug
-- Found PySide Tools: /usr/bin/pyside-uic, /usr/bin/pyside-rcc
-- -- matplotlib-1.4.3 has been found.
-- Platform is 64-bit, set -D_OCC64
-- Build type:
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compile error: Document.cpp

Post by wmayer »

You must install the boost regex-dev package.
hinckel
Posts: 111
Joined: Fri Nov 21, 2014 11:45 am
Location: SJCAMPOS, SP - BR

Re: Compile error: Document.cpp

Post by hinckel »

From my search boost regex-dev is not part of standard boost distribution. Found a package for Ubuntu. Could not find a suitable
rpm package. (I am using openSUSE).
Thanks

J N Hinckel
hinckel
Posts: 111
Joined: Fri Nov 21, 2014 11:45 am
Location: SJCAMPOS, SP - BR

Re: Compile error: Document.cpp

Post by hinckel »

To be sure:
This problem occurs only with the dev-assembly-next branch

I have no problem compiling the master branch of the git repo.
kcleung
Posts: 162
Joined: Sun Apr 24, 2011 11:56 am

Re: Compile error: Document.cpp

Post by kcleung »

I am running lubuntu 15.10 with cmake-3.2 and have both libboost-regex1.58-dev and libboost-regex1.58.0 installed.

However when I run make, it fails exactly the same way.

I have just found out the reason:

In src/App/Document.cpp, the inclusion of boost/regex.cpp is encapsulated in a conditional block:

#if USE_OLD_DAG
# include <boost/graph/topological_sort.hpp>
# include <boost/graph/depth_first_search.hpp>
# include <boost/graph/dijkstra_shortest_paths.hpp>
# include <boost/graph/visitors.hpp>
# include <boost/graph/graphviz.hpp>
# include <boost/bind.hpp>
# include <boost/regex.hpp>
# include <boost/unordered_set.hpp>
#endif //USE_OLD_DAG


However, the method at line 2086 that uses boost::regex:

std::vector<DocumentObject*> Document::findObjects(const Base::Type& typeId, const char* objname) const
{
boost::regex rx(objname);
boost::cmatch what;
std::vector<DocumentObject*> Objects;
for (std::vector<DocumentObject*>::const_iterator it = d->objectArray.begin(); it != d->objectArray.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(typeId)) {
if (boost::regex_match((*it)->getNameInDocument(), what, rx))
Objects.push_back(*it);
}
}
return Objects;
}

is not included in the conditional block that uses the same USE_OLD_DAG flag, and therefore it is always included.

Therefore whenever USE_OLD_DAG is false, the system will fail to include the boost/regex.hpp header and the compilation will ultimate fail. Here I suspect some merge problems.


jriegel: Could you please check whether there are any merge problems?
Post Reply