New issue
Advanced search Search tips

Issue 765914 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug-Regression



Sign in to add a comment

use_system_lcms2 = true doesn't find lcms2.h

Reported by dntsp...@gmail.com, Sep 16 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3130.0 Safari/537.36

Steps to reproduce the problem:
1. gn args out/Default
2. use_system_lcms2 = true

What is the expected behavior?
compiled

What went wrong?
lcms2.h no such file

Did this work before? N/A 

Chrome version: 63.0.3217.0  Channel: n/a
OS Version: 
Flash Version:
 
Components: Internals>Plugins>PDF
What's error are you seeing exactly?

On Ubuntu 14.04, if liblcms2-dev is not installed, building PDFium will fail when use_system_lcms2 is set to true. e.g. building obj/fxcodec/fx_codec_progress.o will fail with:

In file included from ../../core/fxcodec/codec/fx_codec_progress.cpp:13:
In file included from ../../core/fxcodec/fx_codec.h:19:
../../core/fxcodec/codec/ccodec_iccmodule.h:18:10: fatal error: 'lcms2.h' file not found
#include <lcms2.h>

But installing liblcms2-dev will fix that.

Comment 2 by dntsp...@gmail.com, Sep 18 2017

Same error fatal error: 'lcms2.h' file not found. 
But I have /usr/include/lcms2.h (System is LFS-like)
The problem is that -I/usr/include is missing on the compile options

Secomd bug is that use_system_harfbuzz = true is ignored resulting in 
-I../../build/linux/debian_jessie_amd64-sysroot/usr/include/harfbuzz
But hb-common.h in that directory is missing hb_variation_t resulting in
error: use of undeclared identifier 'hb_variation_t'
Can you post the exact error? The exact build command, with all the -I options will be helpful.

This bug report is about use_system_lcms2. Please discuss use_system_harfbuzz on your chromium-dev thread, or on another bug report.
FWIW I'm also unable to reproduce it here (after turning on the pdf_enable_xfa option to build the exact same file mentioned in this bug report).

I can see that pdfium just hardcodes -llcms2 and defines the USE_SYSTEM_LCMS2 macro when use_system_lcms2 is on though, so if the reporter's compiler doesn't automatically add /usr/include to the include path the build can fail like that.

Perhaps using the pkg_config infrastructure from //build/config/linux/pkg_config.gni could help here?

Comment 5 by dntsp...@gmail.com, Sep 19 2017

Sorry, my logs were overwritten after setting use_system_lcms2 = false

@raphael - I didn't remember if it is using system gcc or downloaded clang.
But my gcc is 7.1.0
New behaviour of gcc?
Doesn't build script read pkg-config?
lcms2.pc contains the line:
Cflags: -I${includedir}

You may want to try checking out the PDFium source code by itself and try building that with use_system_lcms2 set. See pdfium.org for instructions. Standalone PDFium is much smaller, and you can reproduce the problem faster without building all the Chromium.
Owner: thestig@chromium.org
Status: Assigned (was: Unconfirmed)
I poisoned third_party/lcms/include/lcms2.h with a #error, and I'm still seeing it being included in my PDFium build, even though I set use_system_lcms2 = true. That seems wrong. I'll take a look.
There's a chain of changelists that end with https://pdfium-review.googlesource.com/#/c/pdfium/+/14411 . If you have a PDFium checkout, try patching it all in locally and see if it works for you.
Project Member

Comment 10 by bugdroid1@chromium.org, Sep 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b31384d6742d7db8cb84f7de6f3827f5f53a62b5

commit b31384d6742d7db8cb84f7de6f3827f5f53a62b5
Author: pdfium-deps-roller@chromium.org <pdfium-deps-roller@chromium.org>
Date: Wed Sep 20 04:08:00 2017

Roll src/third_party/pdfium/ 89bf9ce29..61f2f4812 (3 commits)

https://pdfium.googlesource.com/pdfium.git/+log/89bf9ce294d8..61f2f4812e28

$ git log 89bf9ce29..61f2f4812 --date=short --no-merges --format='%ad %ae %s'
2017-09-19 thestig Isolate lcms2 usage to a few files.
2017-09-19 thestig Forward declare codec modules in fx_codec.h.
2017-09-19 thestig Move CCodec_ScanlineDecoder to its own file.

Created with:
  roll-dep src/third_party/pdfium
BUG= 765914 


Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, see:
http://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium#TOC-Failures-due-to-DEPS-rolls


TBR=dsinclair@chromium.org

Change-Id: Ibd50ce915731fdb806590ac8cf2fda60a5e67f6f
Reviewed-on: https://chromium-review.googlesource.com/674524
Reviewed-by: <pdfium-deps-roller@chromium.org>
Commit-Queue: <pdfium-deps-roller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503042}
[modify] https://crrev.com/b31384d6742d7db8cb84f7de6f3827f5f53a62b5/DEPS

Status: Started (was: Assigned)
At this point, checkout HEAD in Chromium or PDFium, apply https://pdfium-review.googlesource.com/c/pdfium/+/14411, and see if it works.

Comment 12 by dntsp...@gmail.com, Sep 20 2017

@thestig - From comment 7 I see there is something wrong probably with more use_system_* = true. Most can be solved by using defaults.
I have no time testing PDFium because problems getting Gnome-3.26.0 to work.
Over two or three weeks I try the newest snapshot
Project Member

Comment 13 by bugdroid1@chromium.org, Sep 20 2017

The following revision refers to this bug:
  https://pdfium.googlesource.com/pdfium/+/61674c854cdd8cfdb88a1a4baef379f24ba0cf3a

commit 61674c854cdd8cfdb88a1a4baef379f24ba0cf3a
Author: Lei Zhang <thestig@chromium.org>
Date: Wed Sep 20 12:36:04 2017

Get system lcms2 config using pkg-config.

BUG= chromium:765914 

Change-Id: I187507cd87ff5d88be37ce07216ffa3d7ff7bb83
Reviewed-on: https://pdfium-review.googlesource.com/14411
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>

[modify] https://crrev.com/61674c854cdd8cfdb88a1a4baef379f24ba0cf3a/third_party/BUILD.gn

Status: Fixed (was: Started)
Yes, other use_system flags may have issues too. Feel free to file new bugs as you find them. This one should be fixed though. Please test when you get a chance.
Project Member

Comment 15 by bugdroid1@chromium.org, Sep 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d12d58a24c7a0772bd97368088abfc10243508e1

commit d12d58a24c7a0772bd97368088abfc10243508e1
Author: pdfium-deps-roller@chromium.org <pdfium-deps-roller@chromium.org>
Date: Wed Sep 20 17:42:07 2017

Roll src/third_party/pdfium/ 61f2f4812..bc4818564 (3 commits)

https://pdfium.googlesource.com/pdfium.git/+log/61f2f4812e28..bc48185643b3

$ git log 61f2f4812..bc4818564 --date=short --no-merges --format='%ad %ae %s'
2017-09-19 dsinclair Convert FindNextBreakPos to return position
2017-09-20 dsinclair Cleanup CPWL_Caret code
2017-09-19 thestig Get system lcms2 config using pkg-config.

Created with:
  roll-dep src/third_party/pdfium
BUG= 765914 


Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, see:
http://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium#TOC-Failures-due-to-DEPS-rolls


TBR=dsinclair@chromium.org

Change-Id: Ibf4c088db9f7c91817f988a6574286307e8fc0c5
Reviewed-on: https://chromium-review.googlesource.com/675483
Reviewed-by: <pdfium-deps-roller@chromium.org>
Commit-Queue: <pdfium-deps-roller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503192}
[modify] https://crrev.com/d12d58a24c7a0772bd97368088abfc10243508e1/DEPS

Comment 16 by dntsp...@gmail.com, Sep 27 2017

Version: 63.0.3226.0
ERROR
...
Package lcms2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lcms2.pc'
to the PKG_CONFIG_PATH environment variable
..

 $ ls /usr/lib/pkgconfig/lcms2.pc
/usr/lib/pkgconfig/lcms2.pc

/usr/lib is symlink to /usr/lib64
re: comment 16 - did you hit that error when you ran "gn gen" ? So what is your PKG_CONFIG_PATH variable set to?

Comment 18 by dntsp...@gmail.com, Sep 28 2017

re: comment 17
IIRC Error came at an early stage of ninja -C out/Default chrome
possible previous step: gn args out/Default
PKG_CONFIG_PATH is empty because default values always worked

Comment 19 by dntsp...@gmail.com, Sep 28 2017

correction comment 18 PKG_CONFIG_PATH is unset

With use_system_lcms2=true set but liblcms2-dev uninstalled, I ran: gn gen out/Default, and got a detailed error:

----

ERROR at //build/config/linux/pkg_config.gni:103:17: Script returned non-zero exit code.
    pkgresult = exec_script(pkg_config_script, args, "value")
                ^----------
Current dir: /path/to/pdfium/out/gn/
Command: python -- /path/to/pdfium/build/config/linux/pkg-config.py lcms2
Returned 1.
stderr:

Package lcms2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lcms2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lcms2' found
Could not run pkg-config.

See //third_party/BUILD.gn:342:3: whence it was called.
  pkg_config("lcms2_from_pkgconfig") {
  ^-----------------------------------
See //BUILD.gn:12:22: which caused the file to be included.
    public_deps += [ "third_party:fx_freetype" ]
                     ^------------------------

----

So I can isolate the problem to: build/config/linux/pkg-config.py lcms2

When I run pkg-config.py -d lcms2, I get:

Running: pkg-config --cflags --libs lcms2
Package lcms2 was not found in the pkg-config search path.

So I can further isolate the problem to running: pkg-config --cflags --libs lcms2

CAn you try and see what results you are getting?

Comment 21 by dntsp...@gmail.com, Sep 28 2017

re: comment 20:
$ pkg-config --cflags --libs lcms2
-llcms2
$ pkg-config --cflags lcms2
(nothing) which very strange
 $ cat /usr/lib/pkgconfig/lcms2.pc 
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: lcms2
Description: LCMS Color Management Library
Version: 2.8
Libs: -L${libdir} -llcms2
Libs.private: -lm 
Cflags: -I${includedir}
$ pkg-config --cflags harfbuzz
-I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include

Bug in pkg-config-0.29.1?

Comment 22 by dntsp...@gmail.com, Sep 28 2017

Sollution would be: if empty pkg-config --cflags
then -I/usr/include
I think comment 22 is getting a bit too far ahead. At this point, you don't have a compilation issue, so there's no point talking about -I flags. What's happening is GN, which generates the build files, can't talk to pkg-config correctly.

In comment 21, you said: "pkg-config --cflags --libs lcms2" runs successfully. That's a good sign. However, "gn gen out/Default" ends up complaining pkg-config failed. You elided details in comment 16, but I guess what you need to do is:

See what command GN tried to run. Run that command (presumably pkg-config.py) and see what the output is. Then try to figure out why running pkg-config directly works, but not when running it via pkg-config.py.

Comment 24 by dntsp...@gmail.com, Sep 29 2017

re comment 23: I see what now what you mean:
$ build/config/linux/pkg-config.py -d lcms2
Running: pkg-config --cflags --libs lcms2
[[], [], ["lcms2"], [], []]
$ build/config/linux/pkg-config.py -cflags --libs lcms2
Usage: pkg-config.py [options]

pkg-config.py: error: no such option: -c
$ build/config/linux/pkg-config.py --libdir lcms2
/usr/lib #no newline
$ build/config/linux/pkg-config.py --system_libdir lcms2
Must specify package names on the command line
Could not run pkg-config.
$ build/config/linux/pkg-config.py -p lcms2
Could not run pkg-config.
$ build/config/linux/pkg-config.py -v lcms2
Must specify package names on the command line
Could not run pkg-config.
$ build/config/linux/pkg-config.py -a lcms2
Must specify package names on the command line
Could not run pkg-config.
$ build/config/linux/pkg-config.py --atleast-version lcms2
Must specify package names on the command line
false
65.0.3289.0
use_system_lcms2 = true
can not find lcms2.pc
$ pkg-config --cflags --libs lcms2
-llcms2
Can you remind me what command you are running on the command line that triggered the "can not find lcms2.pc" error? Is it "gn gen out/Default" ?

Comment 27 Deleted

yes it was. Ignore my previous comment

Comment 29 by dntsp...@gmail.com, Mar 21 2018

Version: 67.0.3373.0
$ gn args out/Default
enable_nacl = false
ffmpeg_branding = "Chrome"
is_debug = false
proprietary_codecs = true
remove_webcore_debug_symbols = true
use_sysroot = false
use_system_freetype = true
use_system_harfbuzz = true      
use_system_lcms2 = true
use_system_libdrm = true
use_system_libjpeg = true
use_system_libpng = true
use_system_zlib = true

use_sysroot = false results in
        ERROR at //extensions/shell/installer/linux/BUILD.gn:205:19: Empty directory path.
      rebase_path(sysroot, root_build_dir),

After deleting that line: again lcms2.pc not found even with PKG_CONFIG_PATH set

Sign in to add a comment