getting maya2egg working on OSX (compiled, but no work)

Hello,

I am getting this error when running maya2egg.

$ maya2egg
MAYA_LOCATION: /Applications/Autodesk/maya2008/Maya.app/Contents
Could not find $MAYA_LOCATION/bin/OpenMaya.so!

However there doesn’t appear to be an OpenMaya.so only “_OpenMaya.so”

Anyone got any ideas?

Below is my Config.pp for the MAYA parts.

#define MAYA_LOCATION /Applications/Autodesk/maya2008/devkit/
#define MAYA_LIBS
#define MAYA_FRAMEWORK Maya

//#defer MAYA_LIBS [if [WINDOWS_PLATFORM],Foundation.lib OpenMaya.lib OpenMayaAnim.lib OpenMayaUI.lib,Foundation OpenMaya OpenMayaAnim OpenMayaUI]
// Optionally define this to the value of LM_LICENSE_FILE that should
// be set before invoking Maya.
#define MAYA_LICENSE_FILE
#defer HAVE_MAYA [and [<= [OPTIMIZE], 3],[isdir $[MAYA_LOCATION]/include/maya]]
// Define this if your version of Maya is earlier than 5.0 (e.g. Maya 4.5).
//#define MAYA_PRE_5_0

ok, so being Mac it has .dylib files, not .so

ie,
/Applications/Autodesk/maya2008/Maya.app/Contents/MacOS/libOpenMaya.dylib

So why is it looking for a .so ? Maybe the panda code is trying to dynamically load the OpenMaya.so?

mayapath.cxx needs to be changed for OSX.

Need to do this in an #ifdef

  // Look for OpenMaya.dll as a sanity check.
  /*
  Filename openMaya = Filename::dso_filename(Filename(maya_location, "bin/OpenMaya.so"));
  if (!openMaya.is_regular_file()) {
    cerr << "Could not find $MAYA_LOCATION/bin/" << Filename(openMaya.get_basename()).to_os_specific() << "!\n";
    exit(1);
  }
  */

  Filename openMaya = Filename::dso_filename(Filename(maya_location, "MacOS/libOpenMayaAnim.dylib"));
  if (!openMaya.is_regular_file()) {
    cerr << "Could not find $MAYA_LOCATION/MacOS/" << Filename(openMaya.get_basename()).to_os_specific() << "!\n";
    exit(1);
  }

Then I had to change this environment variable

DYLD_LIBRARY_PATH=/usr/local/panda/lib:/Applications/Autodesk/maya2008/Maya.app/Contents/MacOS/

However, now I get this error:

$ maya2egg
MAYA_LOCATION: /Applications/Autodesk/maya2008/Maya.app/Contents
dyld: Symbol not found: __ZTV12MFnAnimCurve
Referenced from: /usr/local/panda/lib/libmayabase.dylib
Expected in: dynamic lookup

Trace/BPT trap

It looks like it’s not liking in libOpenMayaAnim.dylib

I confirmed this using with:

otool -L /usr/local/panda/lib/libmayabase.dylib

Which showed it not being linked in.

So I had to link it in manually.

cd src/maya/

/Applications/Autodesk/maya2008/devkit/bin/mayald  -undefined dynamic_lookup -dynamic -dynamiclib -o Opt3-OSX/libmayabase.dylib -install_name libmayabase.dylib Opt3-OSX/mayabase_config_maya.o Opt3-OSX/mayabase_mayaApi.o Opt3-OSX/mayabase_mayaShader.o Opt3-OSX/mayabase_mayaShaderColorDef.o Opt3-OSX/mayabase_mayaShaders.o Opt3-OSX/mayabase_maya_funcs.o -L../converter/Opt3-OSX -L../pandatoolbase/Opt3-OSX -L/usr/local/panda/lib -L/usr/local/panda/lib -L/usr/local/panda/lib -L/usr/lib/python2.5 -L/Applications/Autodesk/maya2008/devkit//lib -lconverter -lpandatoolbase -lputil -lexpress -ldtoolutil -ldtoolbase -lprc -ldconfig -lpipeline -linterrogatedb -lOpenMayaAnim -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/

How would I add this in the Config.pp?

This seems similar to a windows problem it has not including the OpenMayaAnim.

After all that… it seems to run!

$ maya2egg
MAYA_LOCATION: /Applications/Autodesk/maya2008/Maya.app/Contents

You must specify the Maya file to read on the command line.

Usage:
maya2egg [opts] input.mb output.egg
maya2egg [opts] -o output.egg input.mb
maya2egg [opts] input.mb >output.egg

Great work!

Did you build it using ppremake, or makepanda? It looks to me like the ppremake scripts already add the following libraries: Foundation OpenMaya OpenMayaAnim OpenMayaUI, for both Windows and elsewhere. This is defined in the MAYA_LIBS variable, which has a default definition in dtool/Config.pp, but might be overridden in your own.

If you used makepanda, we should check to ensure that makepanda is doing this properly as well.

I’ve committed your suggested fix to mayapath.cxx; it also includes a bit of code to set DYLD_LIBRARY_PATH.

David

Hi, I would love to export egg files from Maya 2008 on a Mac. illume, could you post the maya2egg you compiled? Thanks!