Compiling for Maya under Linux?

Anybody have any success with this? I’m trying to build Collada against Maya 6.0. I’ve started a Makefile, but I still get errors from both the Collada code and the Maya includes. I have edited some of the files replacing TRUE and FALSE occurences with true and false. Also, there was some pointer arithmetic errors that I fixed.

#Makefile for COLLADA
CC = gcc
CFLAGS = -I/usr/aw/maya6.0/include -I./libxml/include -I./iconv/include
LIBS = -lFoundation -lOpenMaya -lOpenMayaUI -lOpenMayaAnim -lOpenMayaFX -lOpenMayaRender -liconv_a -llibxml2_a -lzlib_a
LDFLAGS = -L/usr/aw/maya6.0/lib -L./libxml/lib -L./iconv/lib -L./zlib/lib $(LIBS)

FILES = DaeCameraLibrary.cpp DaeGeometryLibrary.cpp DaeMaterialLibrary.cpp DaeTextureLibrary.cpp DaeUtils.cpp \
        DaeDoc.cpp DaeLightLibrary.cpp DaeSource.cpp DaeTranslator.cpp

OBJ = $(FILES:%.cpp=%.o)

NAME = COLLADA

# Compile and Assemble C Source Files into Object Files
%.o: %.cpp
        $(CC) -fPIC -c $(CFLAGS) $(LDFLAGS) *.cpp -Wno-deprecated

# Link all Object Files with external Libraries into Binaries
all: $(OBJ)
        ld -G *.o -o lib$(NAME).so

$ make
gcc -fPIC -c -I/usr/aw/maya6.0/include -I./libxml/include -I./iconv/include -L/usr/aw/maya6.0/lib -L./libxml/lib -L./iconv/lib -L./zlib/lib -lFoundation -lOpenMaya -lOpenMayaUI -lOpenMayaAnim -lOpenMayaFX -lOpenMayaRender -liconv_a -llibxml2_a -lzlib_a *.cpp -Wno-deprecated
In file included from /usr/aw/maya6.0/include/maya/MObject.h:74,
                 from DaeCameraLibrary.h:28,
                 from DaeCameraLibrary.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from DaeCameraLibrary.h:33,
                 from DaeCameraLibrary.cpp:22:
TranslatorHelpers/CDictionary.h: In member function `Definition
   CDagPathDictionary<Definition>::lookupByMObject(MDagPath)':
TranslatorHelpers/CDictionary.h:94: warning: `typename
   CDagPathDictionary<Definition>::ListNode' is implicitly a typename
DaeCameraLibrary.cpp: In member function `bool
   DaeCameraLibrary::createInstance(const char*, MDagPath&)':
DaeCameraLibrary.cpp:156: no matching function for call to `MFnCamera::create(
   MObject)'
/usr/aw/maya6.0/include/maya/MFnCamera.h:70: candidates are: MObject
   MFnCamera::create(MStatus* = 0)
/usr/aw/maya6.0/include/maya/MFnCamera.h:72:                 MObject
   MFnCamera::create(MObject&, MStatus* = 0)
In file included from /usr/aw/maya6.0/include/maya/MObject.h:74,
                 from DaeDoc.h:28,
                 from DaeDoc.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from DaeDoc.h:45,
                 from DaeDoc.cpp:22:
TranslatorHelpers/CDictionary.h: In member function `Definition
   CDagPathDictionary&lt;Definition&gt;::lookupByMObject(MDagPath)':
TranslatorHelpers/CDictionary.h:94: warning: `typename
   CDagPathDictionary<Definition>::ListNode' is implicitly a typename
In file included from /usr/aw/maya6.0/include/maya/MObject.h:74,
                 from DaeGeometryLibrary.h:28,
                 from DaeGeometryLibrary.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from DaeMaterialLibrary.h:34,
                 from DaeGeometryLibrary.cpp:23:
TranslatorHelpers/CDictionary.h: In member function `Definition
   CDagPathDictionary&lt;Definition&gt;::lookupByMObject(MDagPath)':
TranslatorHelpers/CDictionary.h:94: warning: `typename
   CDagPathDictionary<Definition>::ListNode' is implicitly a typename
DaeGeometryLibrary.cpp: In member function `void
   DaeGeometryLibrary::createMesh(const char*, xmlNode*, MDagPath&)':
DaeGeometryLibrary.cpp:807: name lookup of `i' changed for new ISO `for'
   scoping
DaeGeometryLibrary.cpp:739:   using obsolete binding at `i'
In file included from /usr/aw/maya6.0/include/maya/MObject.h:74,
                 from DaeLightLibrary.h:28,
                 from DaeLightLibrary.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from DaeMaterialLibrary.h:34,
                 from DaeLightLibrary.cpp:23:
TranslatorHelpers/CDictionary.h: In member function `Definition
   CDagPathDictionary&lt;Definition&gt;::lookupByMObject(MDagPath)':
TranslatorHelpers/CDictionary.h:94: warning: `typename
   CDagPathDictionary<Definition>::ListNode' is implicitly a typename
DaeLightLibrary.cpp: In member function `bool
   DaeLightLibrary::createInstance(const char*, MDagPath&)':
DaeLightLibrary.cpp:202: no matching function for call to `MFnDagNode::create(
   const char*&, const char*&, MObject, MStatus*)'
/usr/aw/maya6.0/include/maya/MFnDagNode.h:119: candidates are: MObject
   MFnDagNode::create(const MTypeId&, MObject& = MObject::kNullObj, MStatus* =
   0)
/usr/aw/maya6.0/include/maya/MFnDagNode.h:124:                 MObject
   MFnDagNode::create(const MTypeId&, const MString&, MObject& =
   MObject::kNullObj, MStatus* = 0)
/usr/aw/maya6.0/include/maya/MFnDagNode.h:129:                 MObject
   MFnDagNode::create(const MString&, MObject& = MObject::kNullObj, MStatus* =
   0)
/usr/aw/maya6.0/include/maya/MFnDagNode.h:134:                 MObject
   MFnDagNode::create(const MString&, const MString&, MObject& =
   MObject::kNullObj, MStatus* = 0)
In file included from /usr/aw/maya6.0/include/maya/MObject.h:74,
                 from DaeMaterialLibrary.h:28,
                 from DaeMaterialLibrary.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from DaeMaterialLibrary.h:34,
                 from DaeMaterialLibrary.cpp:22:
TranslatorHelpers/CDictionary.h: In member function `Definition
   CDagPathDictionary&lt;Definition&gt;::lookupByMObject(MDagPath)':
TranslatorHelpers/CDictionary.h:94: warning: `typename
   CDagPathDictionary<Definition>::ListNode' is implicitly a typename
In file included from /usr/aw/maya6.0/include/maya/MObject.h:74,
                 from DaeSource.h:22,
                 from DaeSource.cpp:18:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from /usr/aw/maya6.0/include/maya/MObject.h:74,
                 from DaeTextureLibrary.h:28,
                 from DaeTextureLibrary.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from DaeTextureLibrary.h:32,
                 from DaeTextureLibrary.cpp:22:
TranslatorHelpers/CDictionary.h: In member function `Definition
   CDagPathDictionary&lt;Definition&gt;::lookupByMObject(MDagPath)':
TranslatorHelpers/CDictionary.h:94: warning: `typename
   CDagPathDictionary<Definition>::ListNode' is implicitly a typename
In file included from /usr/aw/maya6.0/include/maya/MStatus.h:36,
                 from /usr/aw/maya6.0/include/maya/MFnBase.h:72,
                 from /usr/aw/maya6.0/include/maya/MFnPlugin.h:49,
                 from DaeTranslator.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
In file included from DaeDoc.h:45,
                 from DaeTranslator.cpp:25:
TranslatorHelpers/CDictionary.h: In member function `Definition
   CDagPathDictionary&lt;Definition&gt;::lookupByMObject(MDagPath)':
TranslatorHelpers/CDictionary.h:94: warning: `typename
   CDagPathDictionary<Definition>::ListNode' is implicitly a typename
DaeTranslator.cpp: In member function `MStatus DaeTranslator::doImport()':
DaeTranslator.cpp:248: no matching function for call to `DaeDoc::doImport(
   xmlNode*, MDagPath)'
DaeDoc.h:64: candidates are: void DaeDoc::doImport(xmlNode*, MDagPath&)
In file included from /usr/aw/maya6.0/include/maya/MColor.h:35,
                 from DaeUtils.h:26,
                 from DaeUtils.cpp:22:
/usr/aw/maya6.0/include/maya/MTypes.h:207: redeclaration of C++ built-in type `
   bool'
/usr/aw/maya6.0/include/maya/MTypes.h:211: parse error before `false'
make: *** [DaeCameraLibrary.o] Error 1

Gordon can you update the MayaTranslator package to include a Linux Makefile?

Hmmm … I (quite obviously) haven’t tried building this on Linux. Out of interest, are you able to successfully build any of the standard Maya example plugins on linux? I noticed that many of the errors are occuring in Maya API header classes (e.g. the true/false thing and the bool redefinition), and I don’t think changing the values is the right answer - I’m guessing there’s a “right” way to fix these either by declaring a make variable/define or something similar.

Once you’ve got one of the existing examples working, see what’s in the makefile that convinces the compiler to be happy with true/false and bool in the Maya API as a whole.

I have gotten it to successfully compile on linux with Maya 6.0. A friend of mine successfully compiled them against May 4.5 and Maya 5.0. I used his Makefile (with a few changes) and his copy of the COLLADA source code. He may have changed some things in the source code I don’t know for sure. Here is the Makefile:

#--Global-Configuration-----------
SHELL= /bin/sh
MAKE= make
APP= Collada.so
                                                                                                                                                             
#--OS-Specific-Configuration-----------
cc = gcc
CC = g++
AR = ar
                                                                                                                                                             
INC = -I/usr/include/libxml2/ -ITranslatorHelpers/ -I/usr/aw/maya6.0/include -I.
LIB = -L/usr/aw/maya6.0/lib/ -lxml2 -lz -lOpenMaya -lFoundation -lOpenMayaAnim -lOpenMayaFX -lOpenMayaUI -lOpenMayaRender -shared TranslatorHelpers/libTranslatorHelpers.a
                                                                                                                                                             
OBJS =  DaeCameraLibrary.o DaeDoc.o DaeGeometryLibrary.o DaeLightLibrary.o \
        DaeMaterialLibrary.o DaeSource.o DaeTextureLibrary.o DaeTranslator.o \
        DaeUtils.o
                                                                                                                                                             
CFLAGS = -D_BOOL
CCFLAGS = -D_BOOL
                                                                                                                                                             
                                                                                                                                                             
#--Suffix--Rules-----------
.SUFFIXES: .o .cpp .cxx .h
                                                                                                                                                             
.c.o: $*.h
        @ echo $(cc) $<
        @ $(cc) $(INC) $(CFLAGS) -c $<
.cpp.o: $*.h
        @ echo $(CC) $<
        @ $(CC) $(INC) $(CCFLAGS) -c $<
.cxx.o: $*.h
        @ echo $(CC) $<
        @ $(CC) $(INC) $(CCFLAGS) -c $<
                                                                                                                                                             
                                                                                                                                                             
#--Make-Application-----------
$(APP): $(OBJS)
        @ cd TranslatorHelpers; make;
        @ echo Linking $@...
        @ $(CC) $(CCFLAGS) -o $@ $(OBJS) $(LIB)
#       strip -g $(APP)
                                                                                                                                                             
                                                                                                                                                             
#--Make-All-----------
all:
        $(MAKE) depend
        $(MAKE) clean
        $(MAKE) $(APP)
                                                                                                                                                             
                                                                                                                                                             
#--Make-Depend-----------
depend:
        makedepend *.cpp *.cxx *.c *.h -Y 2> ./MAKEDEPEND-MESSAGES
                                                                                                                                                             
#--Make-Docs-----------
docs: FORCE_REBUILD
        doxygen
 
 
#--Clean-----------
clean:
        cd TranslatorHelpers; make clean;
        rm -f core *.core *.gz *.a $(OBJS) $(APP)
 
 
#--Clean-App-----------
cleanapp:
        rm -f core *.core *.gz *.a
 
#--Automatically-Generated-Dependencies-----------
 
# DO NOT DELETE
 
DaeCameraLibrary.o: DaeCameraLibrary.h DaeSyntax.h
DaeCameraLibrary.o: TranslatorHelpers/CDictionary.h DaeUtils.h
DaeCameraLibrary.o: TranslatorHelpers/CArrayList.h
DaeCameraLibrary.o: TranslatorHelpers/CDagHelper.h
DaeDoc.o: DaeDoc.h TranslatorHelpers/CSceneVisitor.h
DaeDoc.o: TranslatorHelpers/CStack.h TranslatorHelpers/CDictionary.h
DaeDoc.o: DaeSyntax.h DaeGeometryLibrary.h TranslatorHelpers/CArrayList.h
DaeDoc.o: DaeMaterialLibrary.h DaeInput.h DaeTextureLibrary.h
DaeDoc.o: DaeLightLibrary.h DaeCameraLibrary.h DaeUtils.h
DaeGeometryLibrary.o: DaeGeometryLibrary.h TranslatorHelpers/CArrayList.h
DaeGeometryLibrary.o: DaeSyntax.h DaeMaterialLibrary.h DaeInput.h
DaeGeometryLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeGeometryLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeGeometryLibrary.o: TranslatorHelpers/CStack.h DaeTextureLibrary.h
DaeGeometryLibrary.o: DaeLightLibrary.h DaeCameraLibrary.h DaeUtils.h
DaeGeometryLibrary.o: TranslatorHelpers/CMeshHelper.h
DaeLightLibrary.o: DaeLightLibrary.h DaeSyntax.h DaeMaterialLibrary.h
DaeLightLibrary.o: DaeInput.h TranslatorHelpers/CArrayList.h
DaeLightLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeLightLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeLightLibrary.o: TranslatorHelpers/CStack.h DaeGeometryLibrary.h
DaeLightLibrary.o: DaeTextureLibrary.h DaeCameraLibrary.h DaeUtils.h
DaeMaterialLibrary.o: DaeMaterialLibrary.h DaeSyntax.h DaeInput.h
DaeMaterialLibrary.o: TranslatorHelpers/CArrayList.h
DaeMaterialLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeMaterialLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeMaterialLibrary.o: TranslatorHelpers/CStack.h DaeGeometryLibrary.h
DaeMaterialLibrary.o: DaeTextureLibrary.h DaeLightLibrary.h
DaeMaterialLibrary.o: DaeCameraLibrary.h DaeUtils.h
DaeMaterialLibrary.o: TranslatorHelpers/CShaderHelper.h
DaeSource.o: DaeSource.h TranslatorHelpers/CArrayList.h
DaeTextureLibrary.o: DaeTextureLibrary.h DaeSyntax.h
DaeTextureLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeTextureLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeDoc.o: TranslatorHelpers/CStack.h TranslatorHelpers/CDictionary.h
DaeDoc.o: DaeSyntax.h DaeGeometryLibrary.h TranslatorHelpers/CArrayList.h
DaeDoc.o: DaeMaterialLibrary.h DaeInput.h DaeTextureLibrary.h
DaeDoc.o: DaeLightLibrary.h DaeCameraLibrary.h DaeUtils.h
DaeGeometryLibrary.o: DaeGeometryLibrary.h TranslatorHelpers/CArrayList.h
DaeGeometryLibrary.o: DaeSyntax.h DaeMaterialLibrary.h DaeInput.h
DaeGeometryLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeGeometryLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeGeometryLibrary.o: TranslatorHelpers/CStack.h DaeTextureLibrary.h
DaeGeometryLibrary.o: DaeLightLibrary.h DaeCameraLibrary.h DaeUtils.h
DaeGeometryLibrary.o: TranslatorHelpers/CMeshHelper.h
DaeLightLibrary.o: DaeLightLibrary.h DaeSyntax.h DaeMaterialLibrary.h
DaeLightLibrary.o: DaeInput.h TranslatorHelpers/CArrayList.h
DaeLightLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeLightLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeLightLibrary.o: TranslatorHelpers/CStack.h DaeGeometryLibrary.h
DaeLightLibrary.o: DaeTextureLibrary.h DaeCameraLibrary.h DaeUtils.h
DaeMaterialLibrary.o: DaeMaterialLibrary.h DaeSyntax.h DaeInput.h
DaeMaterialLibrary.o: TranslatorHelpers/CArrayList.h
DaeMaterialLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeMaterialLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeMaterialLibrary.o: TranslatorHelpers/CStack.h DaeGeometryLibrary.h
DaeMaterialLibrary.o: DaeTextureLibrary.h DaeLightLibrary.h
DaeMaterialLibrary.o: DaeCameraLibrary.h DaeUtils.h
DaeMaterialLibrary.o: TranslatorHelpers/CShaderHelper.h
DaeSource.o: DaeSource.h TranslatorHelpers/CArrayList.h
DaeTextureLibrary.o: DaeTextureLibrary.h DaeSyntax.h
DaeTextureLibrary.o: TranslatorHelpers/CDictionary.h DaeDoc.h
DaeTextureLibrary.o: TranslatorHelpers/CSceneVisitor.h
DaeTextureLibrary.o: TranslatorHelpers/CStack.h DaeGeometryLibrary.h
DaeTextureLibrary.o: TranslatorHelpers/CArrayList.h DaeMaterialLibrary.h
DaeTextureLibrary.o: DaeInput.h DaeLightLibrary.h DaeCameraLibrary.h
DaeTextureLibrary.o: DaeUtils.h TranslatorHelpers/CDagHelper.h
DaeTextureLibrary.o: TranslatorHelpers/CShaderHelper.h
DaeTranslator.o: DaeTranslator.h DaeDoc.h TranslatorHelpers/CSceneVisitor.h
DaeTranslator.o: TranslatorHelpers/CStack.h TranslatorHelpers/CDictionary.h
DaeTranslator.o: DaeSyntax.h DaeGeometryLibrary.h
DaeTranslator.o: TranslatorHelpers/CArrayList.h DaeMaterialLibrary.h
DaeTranslator.o: DaeInput.h DaeTextureLibrary.h DaeLightLibrary.h
DaeTranslator.o: DaeCameraLibrary.h TranslatorHelpers/CSceneWalker.h
DaeUtils.o: DaeUtils.h DaeSyntax.h TranslatorHelpers/CArrayList.h
DaeCameraLibrary.o: DaeSyntax.h TranslatorHelpers/CDictionary.h
DaeDoc.o: TranslatorHelpers/CSceneVisitor.h TranslatorHelpers/CStack.h
DaeDoc.o: TranslatorHelpers/CDictionary.h DaeSyntax.h DaeGeometryLibrary.h
DaeDoc.o: TranslatorHelpers/CArrayList.h DaeMaterialLibrary.h DaeInput.h
DaeDoc.o: DaeTextureLibrary.h DaeLightLibrary.h DaeCameraLibrary.h
DaeGeometryLibrary.o: TranslatorHelpers/CArrayList.h DaeSyntax.h
DaeInput.o: TranslatorHelpers/CArrayList.h
DaeLightLibrary.o: DaeSyntax.h
DaeMaterialLibrary.o: DaeSyntax.h DaeInput.h TranslatorHelpers/CArrayList.h
DaeMaterialLibrary.o: TranslatorHelpers/CDictionary.h
DaeSource.o: TranslatorHelpers/CArrayList.h
DaeTextureLibrary.o: DaeSyntax.h TranslatorHelpers/CDictionary.h
DaeUtils.o: DaeSyntax.h TranslatorHelpers/CArrayList.h

Thanks for working on this and posting your Makefile!

That is the spirit of COLLADA… collaboration!

here : viewtopic.php?p=257#257

cheers,
Sébastien Kuntz