cage1016 / pdfium

Automatically exported from code.google.com/p/pdfium
0 stars 0 forks source link

PDFium does not correctly configure V8 #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
V8 embedders are required to provide an implementation of the v8::Platform 
interface before using v8.

PDFium currently does not. This only works, because the code path that calls to 
the v8::Platform interface is still disabled by default, but chromium would 
like to enable it soon.

v8 itself provides a default implementation of v8::Platform which pdfium could 
just use.

Original issue reported on code.google.com by jochen@chromium.org on 15 Jul 2014 at 11:50

GoogleCodeExporter commented 9 years ago
Fixed in 
https://pdfium.googlesource.com/pdfium/+/3fb18f41076a111e48cd8cdaee596075c89c275
c

Original comment by bo...@foxitsoftware.com on 18 Jul 2014 at 7:33

GoogleCodeExporter commented 9 years ago
Jochen, the commit seems to crash a number of pdf files with javascript. I am 
attaching some of them. Can you help to take a look?

Use chrome to open these files will crash at JS_Runtime.cpp:42

Original comment by bo...@foxitsoftware.com on 29 Jul 2014 at 10:31

Attachments:

GoogleCodeExporter commented 9 years ago
please don't attach fuzzer test cases to public bug reports.

If you see crashes at that line in chrome, then chrome was compiled with shared 
libraries which is not supported for PDFs

Original comment by jochen@chromium.org on 30 Jul 2014 at 12:32

GoogleCodeExporter commented 9 years ago
I have deleted the fuzz test files.

In windows, if I build in debug mode not using shared libraries, will get error 
of the pdb file size too big and can not link. Any remedy on that?

Original comment by bo...@foxitsoftware.com on 30 Jul 2014 at 2:30

GoogleCodeExporter commented 9 years ago
hum, are you compiling with visual studio express? We need the pro version 
which comes with a 64bit compiler (even if you compile for 32bit).

Alternatively, you could try setting win_z7=1 in your GYP_DEFINES env var

Original comment by jochen@chromium.org on 30 Jul 2014 at 3:06

GoogleCodeExporter commented 9 years ago
I built with ninja. Should I use win_z7=1 too?

Original comment by bo...@foxitsoftware.com on 30 Jul 2014 at 5:02

GoogleCodeExporter commented 9 years ago
Yes. ninja will invoke the compiler from your vs2013 installation. If you 
didn't have one, chromium will download the express version and use it

Original comment by jochen@chromium.org on 30 Jul 2014 at 5:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I am using VS2013 pro and win_z7=1, but still sees link error:

[15856/15876] LIB obj\chrome\browser.lib
FAILED: C:\chrome\depot_tools\python276_bin\python.exe gyp-win-tool 
link-wrapper environment.x86 False lib.exe /nologo /ignore:4221 /OUT:obj
\chrome\browser.lib @obj\chrome\browser.lib.rsp
LINK : fatal error LNK1248: image size (8000017C) exceeds maximum allowable 
size (80000000)
[15856/15876] LINK_EMBED(DLL) chrome_child.dll
FAILED: C:\chrome\depot_tools\python276_bin\python.exe gyp-win-tool 
link-with-manifests environment.x86 True chrome_child.dll "C:\chrome\dep
ot_tools\python276_bin\python.exe gyp-win-tool link-wrapper environment.x86 
False link.exe /nologo /IMPLIB:chrome_child.dll.lib /DLL /OUT:ch
rome_child.dll @chrome_child.dll.rsp" 2 mt.exe rc.exe 
"obj\chrome\chrome_child_dll.chrome_child.dll.intermediate.manifest" 
obj\chrome\chrome
_child_dll.chrome_child.dll.generated.manifest
LINK : fatal error LNK1210: exceeded internal ILK size limit; link with 
/INCREMENTAL:NO
Traceback (most recent call last):
  File "gyp-win-tool", line 316, in <module>
    sys.exit(main(sys.argv[1:]))
  File "gyp-win-tool", line 29, in main
    exit_code = executor.Dispatch(args)
  File "gyp-win-tool", line 71, in Dispatch
    return getattr(self, method)(*args[1:])
  File "gyp-win-tool", line 169, in ExecLinkWithManifests
    subprocess.check_call(ldcmd + add_to_ld)
  File "C:\chrome\depot_tools\python276_bin\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 
'C:\chrome\depot_tools\python276_bin\python.exe gyp-win-tool link-wrapper 
environment.x86 False link.
exe /nologo /IMPLIB:chrome_child.dll.lib /DLL /OUT:chrome_child.dll 
@chrome_child.dll.rsp chrome_child.dll.manifest.res' returned non-zero e
xit status 1210
ninja: build stopped: subcommand failed.

Original comment by bo...@foxitsoftware.com on 1 Aug 2014 at 7:28

GoogleCodeExporter commented 9 years ago
Hi,

The error in #9 is the .lib exceeding the maximum size. You almost certainly 
don't want to set win_z7=1 as that makes the lib much larger.

The error in #4 is (likely) due to using a version of VS earlier than 2013 SP2. 
If you got the automatic express toolchain, this will unfortunately currently 
not work at the moment (which is what you would have got if you don't have 
@google.com credentials).

So, possible fixes:

1.
- System-install of VS 2013 SP2.
- Set DEPOT_TOOLS_WIN_TOOLCHAIN=0 (this causes gyp to use the system one 
instead of the local one)
- More instructions at 
http://www.chromium.org/developers/how-tos/build-instructions-windows#TOC-System
-level-toolchain

2.
- If you're not debugging, you can just add "fastbuild=1" to GYP_DEFINES. This 
disables symbols, but this should compile/link with any version of the 
toolchain.

Original comment by scottmg@chromium.org on 1 Aug 2014 at 7:50

GoogleCodeExporter commented 9 years ago
Just to clarify, even if you have Pro installed, the build is not using it 
unless you set DEPOT_TOOLS_WIN_TOOLCHAIN=0.

Original comment by scottmg@chromium.org on 1 Aug 2014 at 7:52

GoogleCodeExporter commented 9 years ago
Thanks Scott! Now I have set DEPOT_TOOLS_WIN_TOOLCHAIN=0 and I have VS2013 SP2, 
but still gets error:

[62/18168] CXX obj\device\hid\device_hid.hid_report_descriptor.obj
FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft 
Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showInclu
des /FC @obj\device\hid\device_hid.hid_report_descriptor.obj.rsp /c 
..\..\device\hid\hid_report_descriptor.cc /Foobj\device\hid\device_hid.h
id_report_descriptor.obj /Fdobj\device\hid\device_hid.cc.pdb
c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1826) : 
error C2220: warning treated as error - no 'object' file genera
ted
c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1826) : 
warning C4702: unreachable code
[62/18168] CXX obj\device\hid\device_hid.hid_connection_win.obj
FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft 
Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showInclu
des /FC @obj\device\hid\device_hid.hid_connection_win.obj.rsp /c 
..\..\device\hid\hid_connection_win.cc /Foobj\device\hid\device_hid.hid_con
nection_win.obj /Fdobj\device\hid\device_hid.cc.pdb
c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1826) : 
error C2220: warning treated as error - no 'object' file genera
ted
c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1826) : 
warning C4702: unreachable code
ninja: build stopped: subcommand failed.

Original comment by bo...@foxitsoftware.com on 1 Aug 2014 at 10:54

GoogleCodeExporter commented 9 years ago
Yes, per those instructions we manually patch xtree 
http://www.chromium.org/developers/how-tos/build-instructions-windows#TOC-System
-level-toolchain

"""
If Pro, you must to manually patch Microsoft Visual Studio 
12.0\VC\include\xtree to add #pragma warning(disable: 4702) near the top where 
there's another.
"""

(I wish we didn't)

Original comment by scottmg@chromium.org on 1 Aug 2014 at 10:55

GoogleCodeExporter commented 9 years ago
I shouldn't miss that instruction! Thanks Scott, works now!

Original comment by bo...@foxitsoftware.com on 1 Aug 2014 at 11:01

GoogleCodeExporter commented 9 years ago
Hi

I have VS2013 Community Edition installed.

When I compile the latest version, it works beautifully.

I have followed the following steps to download the code and try to build:

1.Get Depot_tools
2. Put Depot_tools in the Path
3. Run fetch chromium command to get the latest code
3. set DEPOT_TOOLS_WIN_TOOLCHAIN=0
4. since i need to make some modifications in the build, I have created a 
include.gypi file in my users folder
{
  'variables': {
    'google_api_key':               '****',
    'google_default_client_id':     '****',
    'google_default_client_secret': '****',
    'proprietary_codecs':1,
    'ffmpeg_branding':'Chrome'
  }
}
5. I created a folder out\Release
6. I run the build command c:\workspace\chromium\src>python build\gyp_chromium
7. I run the command to compile: C:\workspace\chromium\src>ninja -C out\Release 
mini_installer

and there you go, the chrome is built successfully.

Now when I try to build a specific tag 37.0.2062.94, i get into the trouble.

I have followed all the instructions followed here and otherwise:

1. git checkout -b release37 37.0.2062.94 (success)
2. gclient sync --with_branch_heads jobs 16 (success)
3. DEPOT_TOOLS_WIN_TOOLCHAIN=0
4. Patch Xtree #pragma warning(disable: 4702)
5. I run the build command with fastbuild=1 c:\workspace\chromium\src>python 
build\gyp_chromium -Dfastbuild=1 (success with my override file in 
c:\Users<Username>\.gyp\include.gypi)
6. I run the command to compile: C:\workspace\chromium\src>ninja -C out\Release 
mini_installer

But still getting error mentioned in #13

C:\workspace\chromium\src>ninja -C out\Release mini_installer
ninja: Entering directory `out\Release'
[7/16871] CXX obj\chrome\installer\uti...aller_util_nacl_win64.app_commands.obj
FAILED: ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft 
Visual Studio 12.0\VC\bin\amd64\cl.exe" /nologo /showIncludes /FC 
obj\chrome\inst
aller\util\installer_util_nacl_win64.app_commands.obj.rsp /c 
..\..\chrome\installer\util\app_commands.cc 
/Foobj\chrome\installer\util\installer_util_nacl_win64.app_commands.obj 
/Fdobj\chrome\installer_util_nacl_win64.cc.pdb
c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1826) : 
error C2220: warning treated as error - no 'object' file generated
c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1826) : 
warning C4702: unreachable code
[7/16871] CXX obj\third_party\pdfium\f...dk\src\pdfwindow\pdfwindow.PWL_Wnd.obj 
ninja: build stopped: subcommand failed.

Any help would be really appreciated?

Regard
VN

Original comment by vikas.na...@engagis.com on 4 Dec 2014 at 5:32

GoogleCodeExporter commented 9 years ago
#15 I'm not sure, but I think the #pragma patch must have been incorrect.

You can see what the packaging script does here 
https://chromium.googlesource.com/chromium/tools/depot_tools/+/refs/heads/master
/win_toolchain/package_from_installed.py maybe you can emulate that.

Original comment by scottmg@chromium.org on 4 Dec 2014 at 5:40