Problem building skia: Declarations not found

1,653 views
Skip to first unread message

Martin Formanek

unread,
Apr 25, 2017, 3:56:16 AM4/25/17
to skia-discuss
Dear mailing list,

I am writing because of a problem I hope you can help me with.

I have attempted to download and build Skia the way it is described in the documentation (https://skia.org/user/download - https://skia.org/user/build).
However, I am having problems getting it to build.

Firstly, I had to install several dependencies (and their headers) that were not documented in the articles linked above: libfontconfig, libjpeg and a third library that must have slipped my mind.
If these are actually required, and not just more symptoms of my mistake, I suggest that they are added to the guide.

More importantly, I still cannot compile because of several "undeclared symbols". The build fails with the following error message:

[397/816] compile ../../src/codec/SkJpegCodec.cpp
FAILED: c++ -MMD -MF obj/src/codec/jpeg.SkJpegCodec.o.d -DNDEBUG -DSKIA_DLL -DSK_SAMPLES_FOR_X -DSK_GAMMA_APPLY_TO_A8 -DSK_INTERNAL -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 -DSK_ENABLE_DISCRETE_GPU -DSKIA_IMPLEMENTATION=1 -DSK_HAS_JPEG_LIBRARY -I../../include/android -I../../include/c -I../../include/codec -I../../include/config -I../../include/core -I../../include/effects -I../../include/gpu -I../../include/gpu/gl -I../../include/pathops -I../../include/ports -I../../include/svg -I../../include/utils -I../../include/utils/mac -I../../third_party/vulkan -I../../include/private -I../../src/c -I../../src/codec -I../../src/core -I../../src/effects -I../../src/effects/gradients -I../../src/fonts -I../../src/image -I../../src/images -I../../src/lazy -I../../src/opts -I../../src/pathops -I../../src/pdf -I../../src/ports -I../../src/sfnt -I../../src/sksl -I../../src/utils -I../../src/utils/win -I../../src/xml -I../../third_party/etc1 -I../../third_party/gif -I../../src/gpu -fstrict-aliasing -fPIC -Werror -fvisibility=hidden -Wall -Wextra -Winit-self -Wpointer-arith -Wsign-compare -Wvla -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-unused-parameter -O3 -fdata-sections -ffunction-sections -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Wnon-virtual-dtor -c ../../src/codec/SkJpegCodec.cpp -o obj/src/codec/jpeg.SkJpegCodec.o
../../src/codec/SkJpegCodec.cpp: In function ‘size_t get_row_bytes(j_decompress_ptr)’:
../../src/codec/SkJpegCodec.cpp:296:58: error: ‘JCS_RGB565’ was not declared in this scope
     const size_t colorBytes = (dinfo->out_color_space == JCS_RGB565) ? 2 :
                                                          ^
../../src/codec/SkJpegCodec.cpp: In member function ‘bool SkJpegCodec::setOutputColorSpace(const SkImageInfo&)’:
../../src/codec/SkJpegCodec.cpp:395:57: error: ‘JCS_EXT_RGBA’ was not declared in this scope
                 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
                                                         ^
../../src/codec/SkJpegCodec.cpp:404:57: error: ‘JCS_EXT_RGBA’ was not declared in this scope
                 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
                                                         ^
../../src/codec/SkJpegCodec.cpp:406:57: error: ‘JCS_EXT_BGRA’ was not declared in this scope
                 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_BGRA;
                                                         ^
../../src/codec/SkJpegCodec.cpp:413:57: error: ‘JCS_EXT_RGBA’ was not declared in this scope
                 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
                                                         ^
../../src/codec/SkJpegCodec.cpp:416:57: error: ‘JCS_RGB565’ was not declared in this scope
                 fDecoderMgr->dinfo()->out_color_space = JCS_RGB565;
                                                         ^
../../src/codec/SkJpegCodec.cpp:436:57: error: ‘JCS_EXT_RGBA’ was not declared in this scope
                 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
                                                         ^
../../src/codec/SkJpegCodec.cpp: In member function ‘virtual SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo&, const SkCodec::Options&, SkPMColor*, int*)’:
../../src/codec/SkJpegCodec.cpp:715:65: error: ‘jpeg_crop_scanline’ was not declared in this scope
         jpeg_crop_scanline(fDecoderMgr->dinfo(), &startX, &width);
                                                                 ^
../../src/codec/SkJpegCodec.cpp: In member function ‘virtual bool SkJpegCodec::onSkipScanlines(int)’:
../../src/codec/SkJpegCodec.cpp:769:79: error: ‘jpeg_skip_scanlines’ was not declared in this scope
     return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
                                                                               ^
[397/816] compile ../../src/images/SkJPEGImageEncoder.cpp
FAILED: c++ -MMD -MF obj/src/images/jpeg.SkJPEGImageEncoder.o.d -DNDEBUG -DSKIA_DLL -DSK_SAMPLES_FOR_X -DSK_GAMMA_APPLY_TO_A8 -DSK_INTERNAL -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 -DSK_ENABLE_DISCRETE_GPU -DSKIA_IMPLEMENTATION=1 -DSK_HAS_JPEG_LIBRARY -I../../include/android -I../../include/c -I../../include/codec -I../../include/config -I../../include/core -I../../include/effects -I../../include/gpu -I../../include/gpu/gl -I../../include/pathops -I../../include/ports -I../../include/svg -I../../include/utils -I../../include/utils/mac -I../../third_party/vulkan -I../../include/private -I../../src/c -I../../src/codec -I../../src/core -I../../src/effects -I../../src/effects/gradients -I../../src/fonts -I../../src/image -I../../src/images -I../../src/lazy -I../../src/opts -I../../src/pathops -I../../src/pdf -I../../src/ports -I../../src/sfnt -I../../src/sksl -I../../src/utils -I../../src/utils/win -I../../src/xml -I../../third_party/etc1 -I../../third_party/gif -I../../src/gpu -fstrict-aliasing -fPIC -Werror -fvisibility=hidden -Wall -Wextra -Winit-self -Wpointer-arith -Wsign-compare -Wvla -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-unused-parameter -O3 -fdata-sections -ffunction-sections -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Wnon-virtual-dtor -c ../../src/images/SkJPEGImageEncoder.cpp -o obj/src/images/jpeg.SkJPEGImageEncoder.o
../../src/images/SkJPEGImageEncoder.cpp: In function ‘bool set_encode_config(J_COLOR_SPACE*, int*, void (**)(char*, const char*, int, int, const SkPMColor*), const SkImageInfo&)’:
../../src/images/SkJPEGImageEncoder.cpp:41:30: error: ‘JCS_EXT_RGBA’ was not declared in this scope
             *jpegColorType = JCS_EXT_RGBA;
                              ^
../../src/images/SkJPEGImageEncoder.cpp:45:30: error: ‘JCS_EXT_BGRA’ was not declared in this scope
             *jpegColorType = JCS_EXT_BGRA;
                              ^
[397/816] compile ../../src/pdf/SkPDFCanvas.cpp
ninja: build stopped: subcommand failed.


As I do not believe that there is a coding error in Skia, and nobody else seems to have this problem, I am clearly doing something wrong.

Can anybody help me out with this? Thank you very much in advance.

Sincerely,
Martin Formanek
Vienna, Austria

Cary Clark

unread,
Apr 25, 2017, 8:31:58 AM4/25/17
to skia-d...@googlegroups.com
You should not require additional libraries or their headers. 
To fetch external dependences, run:

$./tools/git-sync-deps

You should see output like:

third_party/externals/sdl            @ 9b526d28cb2d7f0ccff0613c94bb52abc8f53b6f
third_party/externals/libjpeg-turbo  @ 6de58e0d28014caf2fc1370145f22fd6d65f63e3
third_party/externals/zlib           @ 4576304a4b9835aa8646c9735b079e1d96858633
buildtools                           @ e6b510a9daf822bbe9f922c200c58150803d2fd8
third_party/externals/dng_sdk        @ 96443b262250c390b0caefbf3eed8463ba35ecae
common                               @ 9737551d7a52c3db3262db5856e6bcd62c462b92
third_party/externals/expat          @ android-6.0.1_r55
third_party/externals/spirv-headers  @ 2d6ba39368a781edd82eff5df2b6bc614e892329
third_party/externals/piex           @ 8f540f64b6c170a16fb7e6e52d61819705c1522a
third_party/externals/jsoncpp        @ 1.0.0
third_party/externals/spirv-tools    @ 1fb8c37b5718118b49eec59dc383cfa3f98643c0
third_party/externals/imgui          @ 6384eee34f08cb7eab8d835043e1738e4adcdf75
third_party/externals/libwebp        @ v0.6.0
third_party/externals/microhttpd     @ 748945ec6f1c67b7efc934ab0808e1d32f2fb98d
third_party/externals/freetype       @ 447a0b62634802d8acdb56008cff5ff4e50be244
third_party/externals/harfbuzz       @ 1.4.2
third_party/externals/sfntly         @ b18b09b6114b9b7fe6fc2f96d8b15e8a72f66916
third_party/externals/icu            @ ec9c1133693148470ffe2e5e53576998e3650c1d
third_party/externals/angle2         @ 57f17473791703ac82add77c3d77d13d8e2dfbc4

What do you see?

--
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+unsubscribe@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 Sarett

unread,
Apr 25, 2017, 9:08:52 AM4/25/17
to skia-d...@googlegroups.com
Cary's suggestion should help.

In the specific case of the errors listed above, it looks like you need libjpeg-turbo (not libjpeg).  Versions 1.5 and higher will have all of the features that we take advantage of.

Martin Formanek

unread,
Apr 25, 2017, 9:44:15 AM4/25/17
to skia-d...@googlegroups.com
My tools/git-sync-deps output:

third_party/externals/dng_sdk        @ 96443b262250c390b0caefbf3eed8463ba35ecae
third_party/externals/piex           @ 8f540f64b6c170a16fb7e6e52d61819705c1522a
third_party/externals/expat          @ android-6.0.1_r55
third_party/externals/microhttpd     @ 748945ec6f1c67b7efc934ab0808e1d32f2fb98d
third_party/externals/spirv-headers  @ 2d6ba39368a781edd82eff5df2b6bc614e892329

third_party/externals/imgui          @ 6384eee34f08cb7eab8d835043e1738e4adcdf75
third_party/externals/libwebp        @ v0.6.0
buildtools                           @ e6b510a9daf822bbe9f922c200c58150803d2fd8
common                               @ 9737551d7a52c3db3262db5856e6bcd62c462b92
third_party/externals/harfbuzz       @ 1.4.2
third_party/externals/icu            @ ec9c1133693148470ffe2e5e53576998e3650c1d
third_party/externals/spirv-tools    @ 1fb8c37b5718118b49eec59dc383cfa3f98643c0
third_party/externals/sfntly         @ b18b09b6114b9b7fe6fc2f96d8b15e8a72f66916
third_party/externals/libjpeg-turbo  @ 6de58e0d28014caf2fc1370145f22fd6d65f63e3
third_party/externals/freetype       @ 447a0b62634802d8acdb56008cff5ff4e50be244
third_party/externals/jsoncpp        @ 1.0.0
third_party/externals/zlib           @ 4576304a4b9835aa8646c9735b079e1d96858633
third_party/externals/angle2         @ 57f17473791703ac82add77c3d77d13d8e2dfbc4
third_party/externals/sdl            @ 9b526d28cb2d7f0ccff0613c94bb52abc8f53b6f

Re-building afterwards shows no change.

I did run this before (as python tools/git-sync-deps), which was why I was so confused about having to install something more.
I did not look at the output the first time (beyond making sure it did not end with an error message), if I had, I might have already known there was a problem when I had to install freetype.

What I failed to mention was that my intention is to do a shared build. However, the static build fails with the same error.

What would cause Skia to not use these libraries after downloading them?

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.

--
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.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/8QCDED4S_Zo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

Cary Clark

unread,
Apr 25, 2017, 11:33:26 AM4/25/17
to skia-d...@googlegroups.com
What platform are you using to build?
What is your build environment?
Are you using gn to generate your build commands?
What does ./out/your_out_dir/args.gn look like?
Are you using ninja to compile your build?

To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@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.

--
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+unsubscribe@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.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/8QCDED4S_Zo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss+unsubscribe@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.

--
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+unsubscribe@googlegroups.com.

Mike Klein

unread,
Apr 25, 2017, 11:34:36 AM4/25/17
to skia-d...@googlegroups.com
Can you show us your args.gn file?

For development, Skia's build system will sync and build third-party libraries from source.  That's so that it's convenient for Skia developers to work on Skia and so that different test machines produce more similar results.

If you're building Skia as a user of Skia, like intending to ship it somewhere, we don't recommend using those third-party libraries built from source.  We provide no support for them at all.  They may be old, built wrong, filled with security holes, etc.  So when you set is_official_build=true, the Skia build system ignores those and uses the ordinary include and library paths from your system.  If you still want to, you can opt in each dependency with skia_use_system_foo = false, or disable the dependency entirely with skia_use_foo = false, for some foo.

You should be able to list all the options by running gn args <directory> --list.

Martin Formanek

unread,
Apr 25, 2017, 12:16:58 PM4/25/17
to skia-d...@googlegroups.com
> So when you set is_official_build=true, the Skia build system ignores those and uses the ordinary include and library paths from your system.

Thank you for mentioning this. Yes, I am using this option, because it was recommended for "end users" without further explanation.

I am an (intending to become) a user of Skia, but if this is so, then I will not use this option while just toying around with the library.

I will try to get a clean official build, but at this stage, it is not a priority for me, and I can try to get it working on my own.

Thank you very much for your quick and accurate responses.

Mike Klein

unread,
Apr 25, 2017, 12:46:22 PM4/25/17
to skia-d...@googlegroups.com
Was there something we neglected to write in the "is_official_build and Third-party Dependencies" at the top of https://skia.org/user/build that would have made this more clear?  Where did you see a recommendation to use is_official_build=true without further explanation?  I definitely want to make this clear and centralized there on skia.org/user/build.

Corey Lucier

unread,
Apr 26, 2017, 10:37:22 AM4/26/17
to skia-discuss
FWIW, It was a valuable convenience for us that the Skia team provided all of the requisite 3rd party dependencies when building the production skia binary.  

I understand the concern about providing one-off potentially-insecure variants of each but it would be great if you could provide an option to build/compile with stable public revisions of the third party libs that the Skia team has blessed accordingly.  As it stands now leaving things as an "exercise for the customer" feels like a minor step backwards.

Matt Sarett

unread,
Apr 26, 2017, 10:41:08 AM4/26/17
to skia-d...@googlegroups.com
I'd like to move in that direction as well.  They should work fine now.  There are one or two known issues that need to be sorted out before we bless them as "optimal".

Mike Klein

unread,
Apr 26, 2017, 10:58:00 AM4/26/17
to skia-d...@googlegroups.com, h...@google.com
For the record, Skia has never intentionally provided all of the requisite 3rd party dependencies when building the production skia binary.  We only made it convenient for you to accidentally pull down and ship our testing dependencies.

It's not clear to me that we're willing to commit to using only stable public versions of third-party libraries for testing, or to bless anything.

+Heather Miller can you look into whether we can or want to do any of this?

On Wed, Apr 26, 2017 at 10:41 AM 'Matt Sarett' via skia-discuss <skia-d...@googlegroups.com> wrote:
I'd like to move in that direction as well.  They should work fine now.  There are one or two known issues that need to be sorted out before we bless them as "optimal".

--

Martin Formanek

unread,
Apr 26, 2017, 12:46:47 PM4/26/17
to skia-d...@googlegroups.com, h...@google.com
Mike Klein, after reviewing the relevant documentation, yes, it was all there. I am sorry that I was so quick to accuse.
However, I would recommend listing the dependencies to install (and minimum versions - see below) there explicitly.

On the topic of using system rather than bundled libraries, this basically makes sense: After all, that's what dynamic linking is for.
Especially on Linux/Unix, it would be unusual for a binary library to ship with its dependencies.

Contrary to what I wrote earlier, I ended up compiling the "official" build after all.
I believe the compiler errors were a version conflict: I have installed a newer version of libjpeg-turbo manually and the error vanished.
I have also had to install some more dependencies, but that was to be expected.

Thank you very much for your help.

You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/8QCDED4S_Zo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

Mike Klein

unread,
Apr 26, 2017, 12:52:13 PM4/26/17
to skia-d...@googlegroups.com, h...@google.com
Yes, I think we can certainly document all the optional dependencies and our best estimates of compatible versions.  Thanks for the suggestion!

Corey Lucier

unread,
Apr 27, 2017, 2:17:12 PM4/27/17
to skia-discuss, h...@google.com
This would be great.
Reply all
Reply to author
Forward
0 new messages