COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 01-24-2017, 01:00 PM   #1
MSK
Human being with feelings
 
Join Date: Jan 2017
Posts: 43
Default Cairo in WDL-OL

Hey everyone, just as a preface, I'm pretty new to wdl-ol and C++ (I have a bit of experience writing Android apps in Java). I really appreciate the community here - it's been tremendously helpful so far.

I'm working on some plugins, and looking forward I'd really like to include some spiffier drawing, ideally through Cairo. So far I've been unable to install/include Cairo in my Xcode project - but I don't really have experience using libraries, especially not for C++ and in Xcode, so I'm not really sure where to go next.

I'm using Xcode 8 on OS X 10.11.6.

I've tried following this guide: https://simplapi.wordpress.com/2015/...ics-in-wdl-ol/

However it's geared toward developing on Windows with Visual Studio, and I haven't been able to get it working. When trying to build the App (linking as either an executable or a dynamic library) I'm getting Mach-O linker errors:

Undefined symbols for architecture x86_64:
"_cairo_arc", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_create", referenced from:
MyCairoControl::MyCairoControl(IPlugBase*, IRECT) in MachoBogusCairoTest.o
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_curve_to", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_destroy", referenced from:
MyCairoControl::~MyCairoControl() in MachoBogusCairoTest.o
"_cairo_fill", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_image_surface_create", referenced from:
MyCairoControl::MyCairoControl(IPlugBase*, IRECT) in MachoBogusCairoTest.o
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_image_surface_get_data", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_move_to", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_paint", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_restore", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_save", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_set_line_width", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_set_operator", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_set_source_rgba", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_stroke", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_stroke_preserve", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
"_cairo_surface_destroy", referenced from:
MyCairoControl::~MyCairoControl() in MachoBogusCairoTest.o
"_cairo_surface_flush", referenced from:
MyCairoControl:raw(IGraphics*) in MachoBogusCairoTest.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks to me like I haven't even included the Cairo library, or at least I've included the wrong one.

Do I need to make a build of Cairo specifically for OS X (I've tried this, but I'll admit I have pretty much no idea what I'm doing)?

I think I've checked all the Cairo related threads here, but nothing has been particularly illuminating for me.

If anyone has time, could you let me know (in as much detail as you can bear) how to get Cairo up and running on OS X? Thanks for your time!

Last edited by MSK; 01-24-2017 at 02:00 PM.
MSK is offline   Reply With Quote
Old 01-27-2017, 10:30 AM   #2
CaptnWillie
Human being with feelings
 
Join Date: Dec 2016
Posts: 51
Default

Bump. I too have been having difficulty getting Cairo to link to my projects, following that same tutorial, I have arrived at the same set of errors. If anyone could shed some light here, it would be much appreciated.

-Willie
CaptnWillie is offline   Reply With Quote
Old 01-27-2017, 10:56 AM   #3
gstuff
Human being with feelings
 
Join Date: Feb 2014
Posts: 63
Default

I have an iPlug/Cairo related project on Github https://github.com/garynewby/PUI_IPlug which includes Cairo libs compiled for OSX/Win.
gstuff is offline   Reply With Quote
Old 01-29-2017, 02:57 PM   #4
MSK
Human being with feelings
 
Join Date: Jan 2017
Posts: 43
Default

Quote:
Originally Posted by gstuff View Post
I have an iPlug/Cairo related project on Github https://github.com/garynewby/PUI_IPlug which includes Cairo libs compiled for OSX/Win.
Thanks gstuff. I'm still getting some linker errors, but there are less. I added the libraries using under the general tab of the build settings for the target, included the header files in the project, and I included cairo.h in my plugin header file.

The build succeeds without any cairo related code, but if I add:

cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100);

I get the following linker errors:

Undefined symbols for architecture x86_64:
"___bzero", referenced from:
_composite_glyphs in cairo.a(cairo-image-compositor.o)
__cairo_image_spans_and_zero in cairo.a(cairo-image-compositor.o)
__cairo_image_finish_spans_and_zero in cairo.a(cairo-image-compositor.o)
_bits_image_fetch_untransformed_repeat_none in pixman-1.a(pixman-bits-image.o)
__cairo_scaled_glyph_lookup in cairo.a(cairo-scaled-font.o)
__cairo_scaled_font_glyph_device_extents in cairo.a(cairo-scaled-font.o)
__pixman_implementation_create in pixman-1.a(pixman-implementation.o)
...
"___sincos_stret", referenced from:
__cairo_default_context_arc in cairo.a(cairo-default-context.o)
__cairo_arc_in_direction in cairo.a(cairo-arc.o)
__cairo_arc_segment in cairo.a(cairo-arc.o)
_cairo_matrix_init_rotate in cairo.a(cairo-matrix.o)
_cairo_matrix_rotate in cairo.a(cairo-matrix.o)
__cairo_pen_init in cairo.a(cairo-pen.o)
"__tlv_bootstrap", referenced from:
_fast_path_cache in pixman-1.a(pixman-implementation.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Interestingly, this: int cV = cairo_version(); doesn't cause problems.

Does the order that the libraries are listed under the build settings matter? I'm not sure what to try next. Any insight would be greatly appreciated.

MSK
MSK is offline   Reply With Quote
Old 01-30-2017, 01:34 AM   #5
gstuff
Human being with feelings
 
Join Date: Feb 2014
Posts: 63
Default

My project compiles as is, so you just need to just go through it and mimic the settings. Did you add the same 4 static libs?

cairo.a
pixman-1.a
png.a
freetype.a
gstuff is offline   Reply With Quote
Old 01-30-2017, 09:33 PM   #6
styro
Human being with feelings
 
Join Date: Feb 2014
Posts: 25
Default

Many thanks for your libs!
i could successfully staticly link my plugin to cairo with them, unfortunately it works only when the os is newer then 10.9, but beside of that, great!
all the best
styro
styro is offline   Reply With Quote
Old 01-31-2017, 03:31 PM   #7
MSK
Human being with feelings
 
Join Date: Jan 2017
Posts: 43
Default

Quote:
Originally Posted by gstuff View Post
My project compiles as is, so you just need to just go through it and mimic the settings. Did you add the same 4 static libs?

cairo.a
pixman-1.a
png.a
freetype.a
When I try and compile your project I get the error: "IGraphics.h" not found. In my project, I've included those four libraries. Do I need to tell Xcode to link them statically? If so, how? Thanks!
MSK is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.