Mac OS Apple Silicon Building

330 views
Skip to first unread message

Dave Crabtree

unread,
Oct 7, 2023, 1:33:58 AM10/7/23
to gaffer-dev
Hey, 
Does anyone have any tips for building on an Apple silicon device. Mac version, Xcode version or any particular thing that you had to install via home brew or work around with?
Cheers 

John Haddon

unread,
Oct 9, 2023, 4:20:58 AM10/9/23
to gaffe...@googlegroups.com
Hi Dave,

It is possible to make Apple Silicon builds (I do some development on my laptop) but it's not something we really aim to provide support for at this point. We'd love to provide official builds, but don't quite have the time or resources at the moment. That said, here are the (possibly incomplete) notes I made when setting up my laptop to build `GafferHQ/dependencies` and `GafferHQ/gaffer` (you need both). Note that I started from a clean OS install - I suspect that `GafferHQ/dependencies` in particular might struggle if there's a lot of other stuff installed by something like Home-brew. The various third-party libraries we build seem to love to pick up the wrong pre-existing version from the system if given half a chance.

Let us know how you get on, and we'll do our help you over any hurdles you might run into...
Cheers...
John

Install CMake
=============

https://objects.githubusercontent.com/github-production-release-asset-2e65be/537699/4c5a0eeb-4241-4cd2-b189-f8308d47890a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220522%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220522T220129Z&X-Amz-Expires=300&X-Amz-Signature=00f05ab58438fe4b2e273f883fb8be7b75415a977c4c077476ab35b19d167503&X-Amz-SignedHeaders=host&actor_id=1133871&key_id=0&repo_id=537699&response-content-disposition=attachment%3B%20filename%3Dcmake-3.23.1-macos-universal.dmg&response-content-type=application%2Foctet-stream

Install CMake command line
==========================

sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install

Install Command Line Tools
==========================

- Maybe we don't need XCode, and it'd actually be a bad idea to install it?
- Might be possible with `xcode-select --install`

https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_13.4/Command_Line_Tools_for_Xcode_13.4.dmg

Install SCons
=============

`sudo pip3 install SCons`

Install bison
=============

Could use HomeBrew, but there's no way I want that on my machine.

> curl https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.gz --output bison-3.8.2.tar.gz
> tar -xzvf bison-3.8.2.tar.gz
> cd tar -xzvf bison-3.8.2
> ./configure --prefix /usr/local/opt/bison
> make && make install

--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gaffer-dev/79c6763d-a4e1-4d1d-b68e-41311dac27d6n%40googlegroups.com.

Dave Crabtree

unread,
Oct 10, 2023, 3:46:40 PM10/10/23
to gaffer-dev
oh awesome, thanks John! Even better that I don't need home-brew. Will give it a go and let you know how I get on

Dave Crabtree

unread,
Oct 12, 2023, 9:48:18 PM10/12/23
to gaffer-dev
Making my may through some of the errors that have popped up, which I'll list once I've managed a complete successful build. Hit this one while it's trying to build Qt in the dependencies, any ideas on how to resolve it?

dyld[64658]: Library not loaded: @rpath/libz.1.dylib

  Referenced from: <12E3dyld[64660]: dyld[64659]: A648-34AC-3D78-A8ED-2B555C59349ELibrary not loaded: @rpath/libz.1.dylib

  Referenced from: <12E3Library not loaded: @rpath/libz.A648-34AC-3D78-A8ED-2B555C59349E1.dylib

  Referenced from: <12E3> /Users/davecrabtree/dev/dependA648-34AC-3D78-A8ED-2B555C59349Eencies/Qt/working/qt-everywhere-> /Users/davecrabtree/dev/dependsrc-5.15.11/qtbase/bin/moc

  Reaencies/Qt/working/qt-everywhere-son: tried: '/Users/davecrabtreesrc-5.15.11/qtbase/bin/moc

  Rea/dev/dependencies/Qt/working/qt-son: tried: '/Users/davecrabtreeeverywhere-src-5.15.11/qtbase/Fr/dev/dependencies/Qt/working/qt-ameworks/libz.1.dylib' (no such everywhere-src-5.15.11/qtbase/Frfile), '/Users/davecrabtree/dev/ameworks/libz.1.dylib' (no such dependencies/Qt/working/qt-everyfile), '/Users/davecrabtree/dev/where-src-5.15.11/qtbase/Framewodependencies/Qt/working/qt-everyrks/libz.1.dylib' (no such file)where-src-5.15.11/qtbase/Framewo

rks/libz.1.dylib' (no such file)

> /Users/davecrabtree/dev/dependencies/Qt/working/qt-everywhere-src-5.15.11/qtbase/bin/moc

  Reason: tried: '/Users/davecrabtree/dev/dependencies/Qt/working/qt-everywhere-src-5.15.11/qtbase/Frameworks/libz.1.dylib' (no such file), '/Users/davecrabtree/dev/dependencies/Qt/working/qt-everywhere-src-5.15.11/qtbase/Frameworks/libz.1.dylib' (no such file)

make[3]: *** [.moc/moc_qvariantanimation.cpp] Abort trap: 6

make[3]: *** Waiting for unfinished jobs....

make[3]: *** [.moc/moc_qabstractanimation_p.cpp] Abort trap: 6

make[3]: *** [.moc/moc_qabstractanimation.cpp] Abort trap: 6

make[2]: *** [sub-corelib-make_first] Error 2

make[1]: *** [sub-src-make_first] Error 2

make: *** [module-qtbase-make_first] Error 2

Traceback (most recent call last):


John Haddon

unread,
Oct 13, 2023, 5:04:40 AM10/13/23
to gaffe...@googlegroups.com
Hi,
I haven't come across this one myself, but here are a few thoughts and questions that may or may not be useful :
  • The errors indicate you're building Qt 5.15.11, but the version defined in GafferHQ/dependencies is 5.15.8. Was there a reason to change? Maybe you're building on a more recent MacOS where that's necessary? For what its worth, I'm building on MacOS 12.5 (Monterey).
  • The errors suggest that the build process is trying to run `moc`, which is a Qt utility that is used to pre-process the Qt source code. Moc depends on a library called `libz.1.dylib` but that isn't being found when `moc` is run.
  • If its got as far as running `moc`, then it must have built `moc` already, and it must have found `libz.1.dylib` at that point. So it would be useful to know where it is. You could run `find . -name libz.1.dylib` in your build directory to find that. Then you could compare the paths to the ones in the error messages.
  • If you look in some of the other config files (Boost, OpenShadingLanguage, PyOpenGL, PySide) you can see that we sometimes set the `DYLD_FRAMEWORK_PATH` or `DYLD_FALLBACK_FRAMEWORK_PATH` environment variables to help MacOS find libraries. It may be that you need to set that for Qt as well, so the libraries needed by `moc` are found.
  • If that doesn't work, then we might want to dig further into where Qt is getting ZLib from when it builds `moc`. There are a few possibilities :
    • GafferHQ/dependencies does include ZLib, but it isn't listed as a Qt dependency in `Qt/config.py`, so it may not be being built before Qt. That could be fixed by adding "ZLib" to the list here : https://github.com/GafferHQ/dependencies/blob/main/Qt/config.py#L9, so that we definitely build ZLib before Qt.
    • Alternatively, Qt also embeds the ZLib source in its own source and builds it itself (either if it isn't found elsewhere, or just always, I don't know). There's a `-system-zlib` argument you can pass to Qt's build system, to tell it not to use its own and hopefuly use ours instead.
Hopefully there's something useful in there. Good luck!
Cheers...
John

Dave Crabtree

unread,
Oct 13, 2023, 12:59:50 PM10/13/23
to gaffer-dev
Great thanks for the tips John. Will give them a go.

Yea was trying a newer version of Qt in case that fixed the issue and forgot to set it back. There are a couple of the dependencies I had to version up to get them to build, which I expect to cause some other issues down the line. Using MacOS Sonoma and annoyingly you can't make a vm for a different version. Although I maybe able to make a Ventura one and copy the vm across.

Dave Crabtree

unread,
Oct 13, 2023, 3:56:45 PM10/13/23
to gaffer-dev
Ok, managed to make it build by passing the arguements -qt-zlib and -c++std c++14

Running into a similar error with PySide so just need to find where I can set similar arguments and should hopefully be all good

Dave Crabtree

unread,
Oct 14, 2023, 10:46:51 PM10/14/23
to gaffer-dev
success, biggest issue I had was building on Sonoma with the latest Xcode. managed to source Ventura from a different machine and install the closest Xcode to 13.4 which was 14.1. After that followed your instructions and it mostly went well. Had to bump osl, which caused the need to bump open image, materialX, use and cortex versions, hopefully these don't cause issues within gaffer itself. That all built and gaffer is now running. Thanks for the tips John, appreciated.

Sachin Shrestha

unread,
Oct 15, 2023, 1:33:24 AM10/15/23
to gaffer-dev
Hi Dave,

Would you mind sharing the build with a fellow MacOS user like me? I have been using it on my laptop using Windows on Parallels but would love to run it natively. My build attempts a few months ago didn't go too well so would also appreciate if you could share a gist on the GitHub repo with your build instructions for the MacOS version.

Cheers,
Sachin

Reply all
Reply to author
Forward
0 new messages