Copy link to clipboard
Copied
Dear AE fellows,
I wrote a plugin for AE for windows which used cairo library.
I simply used the standalone cairo binary for windows which was easily downloaded from thr web.
Now I'd like to rewrite my plugin for MacOs.
Do you know if there is standalone cairo library for macos?
Yaroslav.
Hi Yaro
I'm not sure if it will work, but here's the cairo libraries I use (statically compiled).
Copy link to clipboard
Copied
Hi Yaro
I'm not sure if it will work, but here's the cairo libraries I use (statically compiled).
Copy link to clipboard
Copied
James, thank you so much!
I'll check it out!
Yaroslav.
Copy link to clipboard
Copied
You're welcome Yaroslav. Did they work for you?
Copy link to clipboard
Copied
Dear James, unfortunately they didn't. Eventually we postponed the developing of the project for MacOs. (We will return to it this summer). But thanks for your help! We will no doubt make it work in the summer.
Copy link to clipboard
Copied
Hi James, I'm having issues compiling cairo for macos (working in windows, statically). I did try your statically compiled libraries (and other from web), but I'm not sure for settings in xcode. Tried pretty much everything I could think of. First of all, in xcode, mach-O type should be Bundle or Static library? If I bundle it, it reads dylib from my drive (but then user cannot run this). If I compile it "Static Library" I get error in AE couldnt find entry point. (Also I signed/notarised/stepled my plugin). Do I need to type a certian directive in header file (like for windows CAIRO_WIN32_STATIC_BUILD). Any help is much appreciated!
Copy link to clipboard
Copied
Hi
It's been a while but I compiled it using command line so I'm not sure on the Xcode settings. Also which version of cairo are you trying to build? The later releases have much more dependencies which made it so difficult to compile that I gave up and outsourced the job.
For mac, there shouldn't be any special defines like the windows CAIRO_WIN32_STATIC_BUILD.
What happens if you use the libs I linked?
Copy link to clipboard
Copied
Let me try to explain my situation as briefly as I can. I made a plugin which uses cairo static library - libcairo.a. I compiled it on xcode, and it was working fine on my mac. The issue came when it went for sale, few people who use mac contacted me all with error in AE "cannot find entry point". I found out that the plugin only works on my mac, because for some reason, even though it's static library, it's still calling libcairo.2.dylib (dynamic one) from /opt/local/lib where static and dynamic libraries are, and of course users don't have these on their disk so they got the error. I've tried pretty much everything I could in xcode, so it doesn't call dynamic lib, but it always does for some reason (I also confirm this when I inspect plugin binary with otool -L).
To recap: cairo works but only when it has dynamic libraries in folder. I either need to find out how to pack dynamic libs into plugin bundle and then tell xcode to call these from it's own bundle (which I didn't figure out how to do), or that static library just works as it should without dynamic libs (preffered).
p.s. your static libraries give me 100+ errors, basically something with headers I think (cannot exactly remember now)
Thank you very much for you reply James.
Copy link to clipboard
Copied
It sounds like your compiled cairo isn't fully static or has some dynamic dependencies. If the users need libcairo.2.dylib to run it, could you bundle that in the Frameworks folder of your .plugin bundle and have it reference that?
Copy link to clipboard
Copied
Well, that was my thought, but the issue is, I'm very unexperienced with xcode (and linking libraries in general honestly), so I'm not really sure how to link that (and believe me I tried...) Some sugesstion on how to do that would be much appreciated.
Copy link to clipboard
Copied
So, I finally made it work, after a lot of pain 😄
First, when getting cairo library (for example macports), it should be for both architecture's and static, so for example cairo for macports would be
sudo port cairo +universal +static
but dependencies should also be static. And see attached image for which dependencies you need:
Some libraries I couldn't get static (like libpixman), and then I had to get tar.gz file, and use make to compile static library. (This was a bit more complicated, I used claude for help). Then, everything else in xcode is pretty straightforward, in other linker flags I left empty, library search path can be working directory (when you add libs to xcode, make sure to copy to working dir), and then you can just use macro: $(PROJECT_DIR) in Library Search Paths. in header search paths you add /opt/local/include and in build phases all libs have to link with binary (although this is done automatically if you drag them to xcode).
If someone needs these static libs, contact me at info@mirzakadic.com and I will send them.
Copy link to clipboard
Copied
Nice work! The newer versions of cairo have a lot more dependencies as seen in your screenshot. The older versions just required libpng and libpixman.