Mac OS X Makefile for Maya API Plugins?


#1

Ok so after several frustrating hours of attempts at creating a Makefile and buildconfig for Maya API Plugins on my Mac Mini I gave up and went back to using XCode. The question is, does anyone have a Makefile/buildconfig that works that they’d be willing to share that works fr Mac OSX?

I got it working enough based on the devkit sample and XCode settings to compile, and link somewhat…but as soon as I add in the maya libs like -lOpenMaya when it goes to link i get tons of errors that look like:

__ZN13SophiaContext14removeFunctionEPKc referenced from libOpenMaya expected to be defined in @executable_path/libCommandEngine.dylib
__ZN13SophiaContext15addLateFunctionEPKcciPcPFP7Sp hNodeS4_Ez referenced from libOpenMaya expected to be defined in @executable_path/libCommandEngine.dylib

Apparently it’s getting confused that things in these libs are linking with the others or should be but don’t need to. Anyhow any ideas anyone?


#2

Is there any reason why you need a makefile? If you want to build your project from the command line or from a batch script, try ‘xcodebuild’.

The errors about undefined symbols come most likely from the unique “feature” of OS X MachO binary format which encodes the location of a dynamic library in the binary itself and refuses to link it when has been moved to a different location.


#3

Yes I really would like a Makefile because I need to set certain compile parameters, mostly #defines in various loops to build various versions of my plugins. For example I’d like to hit “make” and have it build about 3 or 4 different versions of my plugin for 2 or 3 different versions of Maya all automatically. This is pretty easy to set up with a shell script and buildconfig/Makefile…but won’t work if I can’t get Makefiles working.

I wasn’t aware of “xcodebuild” command tho…I do most my development on the PC and some on Linux…I’m just functional enough on the Mac to get my stuff building ok…heh… well or not as the case may be. I will have to look into that command line unless you have any other ideas?

Thanks!
comet


#4

Ah! Some guys familiar with XCode! :slight_smile:
Mind if I ask something completely makefile unrelated?

Is there a way to change XCodes default behaviour of opening a new window for every singe file? I was thinking of something VisualStudio/DevC++/etc. like, where all files are displayed in the same editor but with tabs on top.


#5

xcodebuild should pretty much do what you need. Do a ‘man xcodebuild’ to see the options it supports, I think you should also be able to pass the usual gcc environment variables to it. This link could be helpful:
http://six.manoverboard.org/book.html


#6

Click this button.


#7

ah… home… thanks a lot! :slight_smile:

It, again, shows the thing with people using too much ms products and not being used to finding important functionality at obvious positions :wink:


#8

When you’re used to VS, I also suggest switching Xcode’s UI layot to the all-in-one mode, it’s in the preferences dialog. Less window clutter that way :slight_smile:


#9

Now if they manage to get make “code sense” as good as “intellisense” I’ll finally dump my old windows pc :wink:
Although I’m using a powermac as my primary computer for over 1 1/2 years now I still never used XCode for anything “bigger”… it just… doesnt feel right :slight_smile:

But again, thanks a lot for the tip.


#10

Ah this is all cool…i’m gonna have to check those other prefs too… i’m used to VS as well. I will have to see if the xcode build will do what i need…but i suppose worst case i can set up the buld settings within xcode and then do the xcodebuild to do a build all easy enough…thanks.


#11

As far as features,
in xcode there is an option to add your on commands after the builds are complete. This should solve all your backwards compatibility issues.

If you play around with your preferences you can get xcode to act similar to visual studio, syntax hinting, code formatting, and many other features are available.

One note, xcode is free with the OS as you probally know, and visual studio is something you have to pay for.

My personal opinion, I love xcode and the more I use it, finding new features, the more I like it.

PROBLEMS:

I am also trying to build the poseDeformer plugin (both a Makefile and xcode) and I get the same problems as the author is getting.

Now, one thing I notices is the image attached shows my dylib being RED … I have never seen this unless there was nothing linked to the dylib.

michaelcomet:
could you send me your makefile you used on linux?

Also, maybe even your project file for VS, I think there maybe something I missed or you missed with linking the obj files.


These are the errors I get in xcode:


     cd "/Users/tcomputerchip/Desktop/poseDeformer Folder/source"
 /usr/bin/g++-3.3 -o /Users/Shared/Alias/maya/7.0/plug-ins/Debug/poseDeformer.dylib -L/Users/Shared/Alias/maya/7.0/plug-ins/Debug -L/Applications/Alias/maya7.0/Maya.app/Contents/MacOS -F/Users/Shared/Alias/maya/7.0/plug-ins/Debug -filelist /Users/Shared/Alias/maya/7.0/plug-ins/poseDeformer.build/Debug/poseDeformer.build/Objects-normal/ppc/poseDeformer.LinkFileList -arch ppc -Wl,-single_module -compatibility_version 1 -current_version 1 -install_name /usr/local/lib/poseDeformer.dylib -dynamiclib -nostdlib -lOpenMaya -lFoundation -Wl,-executable_path,/Applications/Alias/maya7.0/Maya.app/Contents/MacOS -lOpenMaya -lOpenMayaUI -lFoundation -framework AGL -framework OpenGL

ld: Undefined symbols:

/usr/bin/libtool: internal link edit command failed
ld: Undefined symbols:

     __ZN15MPxDeformerNode10outputGeomE
     __ZN15MPxDeformerNode18accessoryNodeSetupER12MDagModifier
     __ZN15MPxDeformerNode19setModifiedCallbackER14MSelectionListb
     __ZN15MPxDeformerNode8envelopeE
     __ZN15MPxDeformerNodeC2Ev
     __ZN15MPxDeformerNodeD2Ev
     __ZNK15MPxDeformerNode18accessoryAttributeEv
     __ZNK15MPxDeformerNode4typeEv

     /usr/bin/libtool: internal link edit command failed

Build failed (2 errors)


#12

Actually you are getting different errors. My errors are like linking in one lib tries to grab another. Your i think you may be forgetting to link in the -lOpenMayaAnim

from what I can see. The Linux Makefile won’t work for Mac, trust me…


#13

I just plan to use the Makefile as a reference, not actually using it for building. I need to see what options you made on the linux side, because there might be somthing I am overlooking with my Makefile on OSX.

I would never plan to build the file on the OSX machine.

One other note, have you tried building your code in the X11 environment?


#14

Yes I’ve built for Windows/Linux…just haven’t gotten around to recompiling for mac. I’m planning some new features/updates at some point so it may wait until that is done.


#15

They are very flaky, though. I never could get function popups to work in non-trivial projects, and with large text files, the Xcode editor is very, very slow.

Now, one thing I notices is the image attached shows my dylib being RED … I have never seen this unless there was nothing linked to the dylib.

Missing files are red. If it’s the product that’s in red, it simply means that your project hasn’t been built yet.

/usr/bin/libtool: internal link edit command failed
ld: Undefined symbols:

     __ZN15MPxDeformerNode10outputGeomE
     __ZN15MPxDeformerNode18accessoryNodeSetupER12MDagModifier
     __ZN15MPxDeformerNode19setModifiedCallbackER14MSelectionListb
     __ZN15MPxDeformerNode8envelopeE
     __ZN15MPxDeformerNodeC2Ev
     __ZN15MPxDeformerNodeD2Ev
     __ZNK15MPxDeformerNode18accessoryAttributeEv
     __ZNK15MPxDeformerNode4typeEv

To decypher these names, use the c++filt command line tool. For some reason, you have to remove the first underscore from the mangled names (don’t ask me why, maybe it’s because it’s made for a different gcc version?).


#16

Thanks for the helpful information … it appears that the MPxDeformerNode is not loading correctly.

Thank you for the c++filt command, this helps out alot. I found more information from this than browsing google.


#17

Finally!! I got it to build … no errors , no warnings. I will post my findings once I test the plugin.


#18

Ok, so far I have the poseDeformer.lib created … that loads fine in maya, as far as i know.

Now I am getting 1 error in the poseReader build:

ld: /Users/Shared/Alias/maya/7.0/plug-ins/poseReader.build/Debug/poseReader.build/Objects-normal/ppc/plugin.o has local relocation entries in non-writable section (__TEXT,__text)
/usr/bin/libtool: internal link edit command failed


#19

This may be something you already know, I don’t know much about programming sorry.

I asked our in-house tool guy if he might understand what is going on. Unfortunately nobody here is familiar with OSX programming, just Unix and Windows.
What I was told is to search on Google for “local relocation entries” libtool

Also maybe try the forum at http://www.macosxhints.com/ and http://forums.macosxhints.com/
or maybe http://www.opendarwin.org/

Some possible help?

http://forums.macosxhints.com/archive/index.php/t-27499.html
http://web.mit.edu/darwin/src/modules/cctools/RelNotes/Private_CompilerTools.html


#20

Thanks for the info …

Great news!

I have this working on Maya 7.0 for Mac

As for past version, I would not recommend trying to build for pre-6.0 because some of the features and functions you are using are not availble for the OSX platform as it was on Maya Complete that was available for OSX.

6.0, 6.5, 7.0 builds should be fine … I think I have 6.5 on my machine … not 6.0.