Link error while trying to load SVG file

123 views
Skip to first unread message

George David

unread,
Jan 11, 2023, 8:19:19 AM1/11/23
to skia-discuss
Hi,

I built Skia with Visual Studio 2019 on Windows Server 2019 using the following build args:

is_debug = false
is_official_build = true
is_component_build = false
skia_enable_gpu = false
skia_use_system_expat = false
skia_use_system_libjpeg_turbo = false
skia_use_system_libpng = false
skia_use_system_libwebp = false
skia_use_system_zlib = false
skia_use_system_icu = false
skia_use_system_harfbuzz = false
skia_use_gl = true

cc="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe"
cxx="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe"
extra_cflags=["/MD", "/wd4127", "/wd4244", "/wd4267"]


My project is linking to the all the *.lib files produced:

compression_utils_portable.lib 
harfbuzz.lib 
libjpeg.lib 
libwebp.lib 
particles.lib 
skcms.lib 
skottie.lib 
skresources.lib 
skshaper.lib 
skunicode.lib 
wuffs.lib 
expat.lib 
icu.lib 
libpng.lib 
libwebp_sse41.lib 
pathkit.lib 
skia.lib 
skparagraph.lib
sksg.lib 
sktext.lib 
svg.lib 
zlib.lib

I tried compiling this code:

#include <include/core/SkStream.h>
#include <modules/svg/include/SkSVGDOM.h>

int main()
{
   SkFILEStream svgStream("path-to.svg"); 
   auto svnDoc = SkSVGDOM::MakeFromStream(svgStream);
}


I get the this link error:

"Error LNK2001  unresolved external symbol __imp___std_init_once_begin_initialize "


I confirmed that svg was enabled by running "./bin/gn args out/Release/ --list "

skia_enable_svg
Current value (from the default) = true
From //gn/skia.gni:30



What I actually want to do is draw an SVG on an existing canvas created using SkSurface::MakeRasterDirect

Any help would be appreciated.

Thanks.

Brian Osman

unread,
Jan 11, 2023, 8:33:08 AM1/11/23
to skia-d...@googlegroups.com
I don't know the exact answer, but that symbol isn't related to skia - it appears to be something that's present in the MSVC libraries. If you google for it, you'll find several threads of people having similar link issues (eg: https://github.com/conan-io/conan-center-index/issues/4826). I didn't read too much, but it sounds like it might some combination of incompatible compiler/libraries/OS/etc?

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/91c25010-572e-4b56-8345-a2acbf3050d3n%40googlegroups.com.

George David

unread,
Jan 19, 2023, 7:56:18 AM1/19/23
to skia-discuss
Thanks of that info. That link lead me to this comment: https://developercommunity.visualstudio.com/t/-dyn-tls-on-demand-init-and-tls-guard-related-weir/1010557#T-N1018365

Our project was using the v141 platform toolset with VS 2019 and apparently those are not 100% compatible.  Once I upgraded to v142, I got past that error.

Now though it's complaining that it cannot find include files. Initially, I was including only the skia/include directory, then I added the skia/modules/**/include

It can't find src/core/SkTHash.h

I tried using the latest code and the code under the chrome/m110 branch.

Is using SVG unsupported when linking to skia static libraries?

George David

unread,
Feb 7, 2023, 4:20:41 PM2/7/23
to skia-discuss
in case any else runs into this, I ended having to add the src/core and src/base as include directories
Reply all
Reply to author
Forward
0 new messages