[cairo] Fwd: Re: Cairo win32 Static linking
WC Black
blackwc88 at gmail.com
Tue Feb 4 09:22:40 CET 2014
Forwarding this so it appears properly in archives.
-------- Original Message --------
Subject: Re: [cairo] Cairo win32 Static linking
Date: Sun, 02 Feb 2014 07:11:38 -0500
From: WC Black <blackwc88 at gmail.com>
To: John Emmas <johne53 at tiscali.co.uk>
Thanks for the response.
The line in src/Makefile.win32:
OBJECTS_STATIC = $(patsubst %cairo-system.obj, %cairo-system-static.obj,
$(OBJECTS))
was not working properly with msys. I had to change it to:
OBJECTS_STATIC = $(patsubst %.obj, %-static.obj, $(OBJECTS))
to get it to compile with the proper definitions. As an aside, what is
STATIC_SOURCES = cairo-system.c for in src/Makefile.win32?
I have been defining CAIRO_WIN32_STATIC_BUILD.
None of this has resolved my issue, however.
And I don't necessarily need a statically linked cairo, but it'd be nice
to have the option.
On 2/2/2014 6:00 AM, John Emmas wrote:
> On 01/02/2014 17:08, WC Black wrote:
>> I'm having trouble linking to cairo-static.
>>
>> I'm on windows compiling with VC. I compiled cairo myself using msys
>> and VC.
>>
>> I get many of these:
>> error LNK2019: unresolved external symbol __imp__cairo_create
>> error LNK2019: unresolved external symbol __imp__cairo_destroy
>> etc.
>>
>
> According to 'src/cairo.h' you need to define CAIRO_WIN32_STATIC_BUILD
> if you've built cairo statically. However, it looks like you'll need
> to define that for any library which links to cairo (i.e. rather than
> defining it when building cairo itself). Defining that preprocessor
> directive will ensure that 'cairo-public' is correctly defined for
> those libraries which link to cairo - BUT -
>
> What's interesting (admittedly from just a cursory glance) is that in
> 'src/cairoint.h', when building with MSVC, 'cairo_public' is defined
> as __declspec(dllexport). So when you build cairo statically it's
> probably just a happy accident if the library's symbols end up correct
> (i.e. the compiler was clever enough to realise that a static library
> can't have dllexported symbols).
>
> Try defining CAIRO_WIN32_STATIC_BUILD for any libraries where you're
> seeing those unresolved externals. You'll need to rebuild those libs
> but hopefully, the errors will go away.
>
> A silly question but.... why do you need cairo to be a static lib
> anyway?
>
> John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140204/1137cf68/attachment.html>
More information about the cairo
mailing list