Windows debug building; Missing build-related documentation

806 views
Skip to first unread message

Matt Plumlee

unread,
Jan 20, 2017, 4:17:58 PM1/20/17
to skia-discuss
I am trying to deal with the following errors when linking my Debug-DLL project with Skia:

2>skia.lib(skia.SkSLUtil.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in low_level_mmap.obj
2>skia.lib(skia.SkSLUtil.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in low_level_mmap.obj
2>skia.lib(skia.SkString.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in low_level_mmap.obj
2>skia.lib(skia.SkString.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in low_level_mmap.obj

Here are two problems I have:
1) I don't know how to control these compiler defines during the ninja build process, even by rummaging around in the BUILD*.gn files. There certainly doesn't appear to be any documentation about them. How would I use gn to control these settings (or the related settings, _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH, _ALLOW_RUNTIME_LIBRARY_MISMATCH, _DLL, and _DEBUG)?
2) I had updated bug 5928 with the problem, and with some time having passed I thought I'd try to update my skia code to the latest version to see if it was fixed. The documentation doesn't say how to update with the latest version, so I just guessed that I should be pulling from the master branch, and then re-running 'gn gen'. If this isn't the case (it did something reasonable when I tried it), could someone let me know, please?

Thanks!

Matt Plumlee

unread,
Jan 20, 2017, 4:29:39 PM1/20/17
to skia-discuss
Ok, after a bit more playing around, I see that these defines are in yvals.h, which is a Microsoft header, not a Skia header. This leads me to think that I really just to find where the code-generation flag is set. Does anyone know where to do that in the build configuration files?

Mike Klein

unread,
Jan 20, 2017, 4:35:30 PM1/20/17
to skia-discuss
You can set whatever compile or link time flags you like in your Skia build globally with the GN arguments extra_cflags and extra_ldflags.  (Also, extra_cflags_c and extra_cflags_cc for C and C++ only, if needed.)

On Fri, Jan 20, 2017 at 4:29 PM Matt Plumlee <cc...@mattplumlee.org> wrote:
Ok, after a bit more playing around, I see that these defines are in yvals.h, which is a Microsoft header, not a Skia header. This leads me to think that I really just to find where the code-generation flag is set. Does anyone know where to do that in the build configuration files?

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Matt Plumlee

unread,
Jan 20, 2017, 4:56:57 PM1/20/17
to skia-discuss
Nice, that seems to have done it (although the syntax took a little playing with to figure out):

    gn gen out/Debug --args="extra_cflags=[\"/MDd\"]"


Thank you, Mike!

Mike Klein

unread,
Jan 20, 2017, 5:05:08 PM1/20/17
to skia-discuss
Yeah, I find it's easier to use gn args out/Debug to edit the arguments in the comfort of my own editor.

--

Nikolai Svakhin

unread,
Jan 25, 2017, 11:36:16 PM1/25/17
to skia-discuss
So, is using SKIA as dynamic libraries (DLL on Windows and .SO on Macs) now supported?

Or do you still recommend we link against a statically built library? 

All the documentation on building Windows DLLs is written referring GYP tools, and I know the GYP is not used to compile SKIA anymore. I wasn't able to produce DLL on Windows yet. Mac .so building is fine.

Thanks, 
-Nikolai

Mike Klein

unread,
Jan 26, 2017, 9:29:17 AM1/26/17
to skia-discuss
Generally we still don't think it's a very good idea to use Skia as a shared library.  The main benefit of shared libraries is that you can drop in a new version without rebuilding, but we do not make any guarantees about a stable C++ API or ABI that'd make that safe for Skia.

Most effort we put into making Skia work as a shared library is for a narrower goal: when working on large projects that integrate Skia like Chromium, it can save a lot of developer time to link dynamically instead of statically when iterating on a change.
Reply all
Reply to author
Forward
0 new messages