collada dom build under debian linux

I just tried to build collada dom on a debian linux machine and ran into a whole lot of problems. first the g++ version i use:

g++ (GCC) 3.3.5 (Debian 1:3.3.5-13)
Copyright © 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

since my libxml2 is not in /usr/lib i changed the directory in ./src/dae/Makefile_PC and ./src/modules/LIBXMLPlugin/Makefile_PC to the directory where i have libxml2.

trying to build the latest subversion checkout i get the following errors on make:

make
make[1]: Entering directory /scratch/gabriel/colladaDom_trunk/src/1.4/dom' building ../../../lib-dbg/libcollada_dom.a - linux Debug "g++" -c domAccessor.cpp -c -g -D"_DEBUG" -o../../../tmp/linux/Debug/dom/domAccessor.o -I ../../../include/ -I ../../../include/1.4/ In file included from ../../../include/dae/daeDomTypes.h:17, from ../../../include/1.4/dom/domTypes.h:17, from ../../../include/1.4/dom/domAccessor.h:16, from domAccessor.cpp:15: ../../../include/dae/daeElement.h:27: error: use of enumTypeEnum’ without
previous declaration
…/…/…/include/dae/daeElement.h:27: error: declaration does not declare
anything
…/…/…/include/dae/daeElement.h:355: error: ISO C++ forbids declaration of TypeEnum' with no type ../../../include/dae/daeElement.h:355: error: invalid use of::’
…/…/…/include/dae/daeElement.h:355: error: TypeEnum' declared as avirtual’ field
…/…/…/include/dae/daeElement.h:355: error: parse error before (' token ../../../include/dae/daeElement.h:360: error: ISO C++ forbids defining types within return type ../../../include/dae/daeElement.h:360: error: syntax error before(’ token
…/…/…/include/dae/daeElement.h:367: error: non-member function const char* getElementName()' cannot haveconst’ method qualifier
…/…/…/include/dae/daeElement.h:381: error: non-member function const char* getID()' cannot haveconst’ method qualifier
…/…/…/include/dae/daeElement.h:403: error: parse error before public' ../../../include/dae/daeElement.h:416: error: parse error beforepublic’
…/…/…/include/dae/daeElement.h:441: error: parse error before }' token In file included from ../../../include/dae/daeDomTypes.h:20, from ../../../include/1.4/dom/domTypes.h:17, from ../../../include/1.4/dom/domAccessor.h:16, from domAccessor.cpp:15: ../../../include/dae/daeSmartRef.h: In copy constructor
daeSmartRef<T>::daeSmartRef(const daeSmartRef<T>&) [with T = daeElement]’:
…/…/…/include/dae/daeURI.h:215: instantiated from here
…/…/…/include/dae/daeSmartRef.h:67: error: no matching function for call to
daeElement::ref(const daeElement*&)' ../../../include/dae/daeElement.h:106: error: candidates are: void daeElement::ref() const ../../../include/dae/daeSmartRef.h: In destructor
daeSmartRef<T>::~daeSmartRef() [with T = daeElement]’:
…/…/…/include/dae/daeURI.h:215: instantiated from here
…/…/…/include/dae/daeSmartRef.h:38: error: no matching function for call to
daeElement::release(daeElement*)' ../../../include/dae/daeElement.h:99: error: candidates are: void daeElement::release() const ../../../include/dae/daeSmartRef.h: In constructor
daeSmartRef<T>::daeSmartRef(const daeSmartRef<U>&) [with U = daeElement, T =
const daeElement]’:
…/…/…/include/dae/daeURI.h:221: instantiated from here
…/…/…/include/dae/daeSmartRef.h:54: error: no matching function for call to
daeElement::ref(const daeElement*)' ../../../include/dae/daeElement.h:106: error: candidates are: void daeElement::ref() const ../../../include/dae/daeSmartRef.h: In destructor
daeSmartRef<T>::~daeSmartRef() [with T = const daeElement]’:
…/…/…/include/dae/daeURI.h:221: instantiated from here
…/…/…/include/dae/daeSmartRef.h:38: error: no matching function for call to
daeElement::release(daeElement*&)' ../../../include/dae/daeElement.h:99: error: candidates are: void daeElement::release() const ../../../include/dae/daeSmartRef.h: In copy constructor
daeSmartRef<T>::daeSmartRef(const daeSmartRef<T>&) [with T = const
daeElement]’:
…/…/…/include/dae/daeURI.h:221: instantiated from here
…/…/…/include/dae/daeSmartRef.h:67: error: no matching function for call to
daeElement::ref(const daeElement*)' ../../../include/dae/daeElement.h:106: error: candidates are: void daeElement::ref() const ../../../include/dae/daeURI.h: In member functiondaeElementConstRef
daeURI::getElement() const’:
…/…/…/include/dae/daeURI.h:221: error: initializing temporary from result
of daeSmartRef<T>::daeSmartRef(const daeSmartRef<U>&) [with U = daeElement, T = const daeElement]' ../../../include/dae/daeSmartRef.h: In member functionconst daeSmartRef<T>&
daeSmartRef<T>::operator=(const daeSmartRef<T>&) [with T = daeElement]’:
…/…/…/include/dae/daeURI.h:227: instantiated from here
…/…/…/include/dae/daeSmartRef.h:107: error: no matching function for call to
daeElement::ref(const daeElement*&)' ../../../include/dae/daeElement.h:106: error: candidates are: void daeElement::ref() const ../../../include/dae/daeSmartRef.h:108: error: no matching function for call todaeElement::release(const daeElement*&)’
…/…/…/include/dae/daeElement.h:99: error: candidates are: void
daeElement::release() const
…/…/…/include/dae/daeSmartRef.h: In constructor daeSmartRef<T>::daeSmartRef(T*) [with T = domAccessor]': domAccessor.cpp:26: instantiated from here ../../../include/dae/daeSmartRef.h:74: error: no matching function for call todaeElement::ref(const daeElement*&)’
…/…/…/include/dae/daeElement.h:106: error: candidates are: void
daeElement::ref() const
…/…/…/include/dae/daeSmartRef.h: In destructor daeSmartRef<T>::~daeSmartRef() [with T = domAccessor]': domAccessor.cpp:26: instantiated from here ../../../include/dae/daeSmartRef.h:38: error: no matching function for call todaeElement::release(daeElement*&)’
…/…/…/include/dae/daeElement.h:99: error: candidates are: void
daeElement::release() const
…/…/…/include/dae/daeSmartRef.h: In copy constructor daeSmartRef<T>::daeSmartRef(const daeSmartRef<T>&) [with T = domAccessor]': domAccessor.cpp:26: instantiated from here ../../../include/dae/daeSmartRef.h:67: error: no matching function for call todaeElement::ref(const daeElement*&)’
…/…/…/include/dae/daeElement.h:106: error: candidates are: void
daeElement::ref() const
…/…/…/include/dae/daeSmartRef.h: In constructor daeSmartRef<T>::daeSmartRef(const daeSmartRef<U>&) [with U = domAccessor, T = daeElement]': domAccessor.cpp:28: instantiated from here ../../../include/dae/daeSmartRef.h:54: error: no matching function for call todaeElement::ref(const daeElement*&)’
…/…/…/include/dae/daeElement.h:106: error: candidates are: void
daeElement::ref() const
…/…/…/include/dae/daeSmartRef.h: In destructor daeSmartRef<T>::~daeSmartRef() [with T = domParam]': ../../../include/dae/daeArray.h:153: instantiated fromvoid daeTArray<T>::clear() [with T = domParamRef]’
…/…/…/include/dae/daeArray.h:144: instantiated from daeTArray<T>::~daeTArray() [with T = domParamRef]' ../../../include/1.4/dom/domAccessor.h:128: instantiated from here ../../../include/dae/daeSmartRef.h:38: error: no matching function for call todaeElement::release(daeElement*&)’
…/…/…/include/dae/daeElement.h:99: error: candidates are: void
daeElement::release() const
make[1]: *** […/…/…/tmp/linux/Debug/dom/domAccessor.o] Error 1
make[1]: Leaving directory `/scratch/gabriel/colladaDom_trunk/src/1.4/dom’
make: *** [src/1.4/dom] Error 2

==========

revision 41 is the most recent one that builded on my system. with this though i get some errors compiling my app. the makefile includes lxml2, include, include/1.4 and the libs like: -lcollada_dom -lcollada_dae -lcollada_LIBXMLPlugin -lcollada_stdErrPlugin -lcollada_STLDatabase -lxml2.
set up like this the error is (much smaller already :slight_smile: ):

make
g++ -o …/debug/TE_GUI main.o te_gui.o colladaLoader.o drawNode.o node.o edge.o graphwidget.o moc_te_gui.o moc_graphwidget.o -L/usr/local/Trolltech/Qt-4.2.1/lib -L/usr/X11R6/lib -L/usr/pack/libxml2-2.6.19-mo/i686-debian-linux3.1/lib -L…/…/…/collada_dom_r40/lib-dbg -L/scratch/gabriel/qt-x11-opensource-src-4.2.1/lib -lcollada_dom -lcollada_dae -lcollada_LIBXMLPlugin -lcollada_stdErrPlugin -lcollada_STLDatabase -lxml2 -lQtXml -lQtOpenGL -L/usr/X11R6/lib -lQtGui -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtNetwork -lQtCore -lz -lm -ldl -lGLU -lGL -lpthread
…/…/…/collada_dom_r40/lib-dbg/libcollada_dae.a(daeDom.o)(.text+0x7): In function initializeDomMeta()': /scratch/gabriel/collada_dom_r40/src/dae/daeDom.cpp:21: undefined reference toregisterDomTypes()’
…/…/…/collada_dom_r40/lib-dbg/libcollada_dae.a(daeDom.o)(.text+0xc):/scratch/gabriel/collada_dom_r40/src/dae/daeDom.cpp:23: undefined reference to `registerDomElements()’
collect2: ld returned 1 exit status
make: *** […/debug/TE_GUI] Error 1

==========

the app and collada dom work fine with windows, but i really need to get it to work under linux too…

thanks!

hmm I did find out about a few of those errors just earlier and fixed them and updated the svn. I think/hope that some of those other errors are just side effects of the errors that were fixed. I can build the DOM on linux now. I use debian, but I use g++ 4.0.1

-Andy

thx! collada dom now compiles again on the latest revision.
i still have a problem compiling my code against the collada libs. here is the error message i get:

…/…/collada_dom_r45/lib-dbg/libcollada_dae.a(daeDom.o): In function initializeDomMeta()': /home/killkolor/Collada/ColladaDom_trunk/src/dae/daeDom.cpp:21: undefined reference toregisterDomTypes()’
/home/killkolor/Collada/ColladaDom_trunk/src/dae/daeDom.cpp:23: undefined reference to `registerDomElements()’
collect2: ld returned 1 exit status
make: *** […/debug/TE_GUI] Error 1

i don’t know if this is something in my code. the includes i make are:

#include “dae.h”
#include “dom/domCOLLADA.h”
#include “dom/domConstants.h”

the code is basically this function:

QVector<domGeometry *>
ColladaLoader::getGeometries(DAE doc)
{
int error;
QVector<domGeometry
> geometries(0);

	unsigned int geometryElementCount = doc-&gt;getDatabase()-&gt;getElementCount(NULL, COLLADA_ELEMENT_GEOMETRY, NULL);
	
	for (unsigned int i = 0; i &lt; geometryElementCount; ++i) 
	{
		domGeometry *curGeom;
		error = doc-&gt;getDatabase()-&gt;getElement((daeElement **)&curGeom, i, NULL, COLLADA_ELEMENT_GEOMETRY, NULL);

		assert(error == DAE_OK);
		geometries.append(curGeom);
    } 

}

am i missing something here?

undefined reference?? is that the same as unresolved external reference?

The two functions in question are forward declared in the dae lib and then defined in the dom lib.

This may help.

Also someone pointed out that you need to specify one of the libs twice in the link parameters. This is because dae lib (the two functions in question and a few const strings) depends on dom lib and then the dom lib (tons of stuff) depends on the dae lib. I think you need to specify the dae lib twice. -l dae dom dae

-Andy

thx! now it works. i had this link order before, but since i switched to qmake the generated Makefile included dom and dae only once.