Trouble building plugins in C++ on Mac M1

Trouble building plugins in C++ on Mac M1

Anonymous
Not applicable
1,082 Views
4 Replies
Message 1 of 5

Trouble building plugins in C++ on Mac M1

Anonymous
Not applicable

Hey guys,

 

I've been following the steps listed in the docs:

 

https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__developer_Maya_SDK_MERGED_Setting_up_your_bui...

 

I've got the devkit files and I'm trying to run the "hello world" example. 
I'm using cmake through the terminal.

 

I can run:

cmake -H. -Bbuild -G "Unix Makefiles"

 with no errors.

 

But when I go to actually build with :

cmake --build build

 

I get 3 errors complaining about some mac OS stuff.

Here is the last error. The other 2 errors are the exact same except they have Int32 and Int16 instead of Int64.

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/libkern/arm/OSByteOrder.h:41:1: error: redefinition of '_OSSwapInt64'

_OSSwapInt64(

 

I'm a bit lost, as I've trying to set this up for a few hours now.

Anyone savvy with this stuff willing to help ?

If you would even be willing to jump on a call and I can screen share to get this up and running I'd transfer you some money or donate to a charity of your choice.

 

Thanks,

Tom

 

 

 

0 Likes
Accepted solutions (1)
1,083 Views
4 Replies
Replies (4)
Message 2 of 5

stuzzz
Collaborator
Collaborator

I would be curious to know the answer. I've been struggling to compile in linux and macOS.

0 Likes
Message 3 of 5

negow
Advocate
Advocate
Accepted solution

Building on the M1 has one additional complication, you need to build for x86 on an ARM operating system. That means to cross-compile. So you'll need cmake and a compiler for x86, not ARM. Maya does not build on ARM.

 

So before you follow any of the steps listed in the Autodesk documentation, use an x86 shell first. By e.g. calling `arch -x86_64 zsh`. This will land you in an emulated shell, via Rosetta, that you should treat as your build environment. You'll probably need another version of CMake and double-check that your XCode install included an x86 compiler. Basically, forget about anything natively installed on your M1 and treat the x86 shell as a virtual machine or remote shell into an appropriate build environment. Maya will run under the same environment.

Message 4 of 5

Anonymous
Not applicable

Wow awesome thank you, this works great !

 

An additional question. I noticed on Macs that the plugins compile as a .bundle file but on windows they are a .mll file. 

Is there a way to compile cross platform for all major operating systems ?

 

thanks,

Tom

0 Likes
Message 5 of 5

negow
Advocate
Advocate

Generally no, what you typically want to do is compile for each platform *on* each platform. Sometimes that means having 3 computers with each operating system installed, but another option is running Windows and Linux as virtual machines on your Mac. Linux runs fine under Docker for example, with Windows in something like VirtualBox or a Mac-native equivalent.

 

I say "generally", because the nitpicky among us might point out that it *is* possible to cross-compile most software on most OSes but the same people would also agree that this is an advanced topic better suited as a last resort if you can't run each OS separately, which you should.

0 Likes