Re: How do I build PDFium with ASAN?

307 views
Skip to first unread message

Wei Li

unread,
Apr 17, 2017, 1:14:02 PM4/17/17
to gwonwang lee, pdfium
Are you building pdfium in chromium repo? I am assuming you are using Clang to compile? If so, you just need to add "is_asan = true" in your gn args. Details for different OSes can be found https://www.chromium.org/developers/testing/addresssanitizer

On Sun, Apr 16, 2017 at 11:17 PM, gwonwang lee <parr...@gmail.com> wrote:

The current pdfium build succeeded.

 build step

1. fetch chromium
2. cd src
3. gn gen out/pdfium_only
4. ninja -C out/pdfium_only pdfium_test


I want appy ASAN
How do I build with ASAN?



 

--
You received this message because you are subscribed to the Google Groups "pdfium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+unsubscribe@googlegroups.com.
To post to this group, send email to pdf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/6d94fe20-b074-4322-81c8-e1b982df806e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lei Zhang

unread,
Apr 18, 2017, 1:04:15 AM4/18/17
to gwonwang lee, pdfium
What Wei said. Also, you can enable ASAN in the same way in a
standalone PDFium checkout from "fetch pdfium". If that's all you are
interested in, then you don't need to download all of Chromium.

On Sun, Apr 16, 2017 at 11:17 PM, gwonwang lee <parr...@gmail.com> wrote:
>
> The current pdfium build succeeded.
>
> build step
>
> 1. fetch chromium
> 2. cd src
> 3. gn gen out/pdfium_only
> 4. ninja -C out/pdfium_only pdfium_test
>
>
> I want appy ASAN
> How do I build with ASAN?
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pdfium+un...@googlegroups.com.

gwonwang lee

unread,
Apr 18, 2017, 2:02:27 AM4/18/17
to pdfium, parr...@gmail.com

MY Build environment


Windows 10  64bit
intel i7 3770


gn args setting 

target_arch = "x86"

is_clang = true

is_asan = true

is_debug = false



RESULT


D:\Chromium\src>gn args out_asan/pdfium_only
Waiting for editor on "D:\Chromium\src\out_asan\pdfium_only\args.gn"...
Generating files...
ERROR at //build/config/sanitizers/BUILD.gn:351:7: Assertion failed.
      assert(false, "win/asan does not work in 64-bit yet")



GYP Windows 32-bit build

DUCT TAPE ALERT! EXPERIMENTAL!

ASan for Windows is not yet production quality.  It is based on Clang for Windows and inherits the Clang/Win list of unsupported stuff.  You can try it, but it might just be broken for you.
If you are assigned an ASan/Win bug, you might not be able to reproduce the report locally.  In this case, you have to look at the stack on the bug, and you have to check in a speculative fix and rely on the FYI bots to tell you if your fix worked.

If you're feeling lucky, you can try using ASan/Win locally by running the steps below:

    # ASAn requires a 32-bit build on Windows for now; don't set target_arch=x64.
    set GYP_DEFINES=asan=1
    gclient runhooks
    ninja -C out\Release <targets>


 Is it not possible to build on a 64bit operating system?





2017년 4월 18일 화요일 오전 2시 14분 2초 UTC+9, Wei Li 님의 말:
Are you building pdfium in chromium repo? I am assuming you are using Clang to compile? If so, you just need to add "is_asan = true" in your gn args. Details for different OSes can be found https://www.chromium.org/developers/testing/addresssanitizer
On Sun, Apr 16, 2017 at 11:17 PM, gwonwang lee <parr...@gmail.com> wrote:

The current pdfium build succeeded.

 build step

1. fetch chromium
2. cd src
3. gn gen out/pdfium_only
4. ninja -C out/pdfium_only pdfium_test


I want appy ASAN
How do I build with ASAN?



 

--
You received this message because you are subscribed to the Google Groups "pdfium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.

Lei Zhang

unread,
Apr 18, 2017, 3:02:09 AM4/18/17
to gwonwang lee, pdfium
I think you want target_cpu in GN, not target_arch from GYP. In modern
PDFium, there's basically no use of GYP left, so any Chromium doc that
mentions GYP is outdated and should be read and used carefully.

There used to be a GYP to GN Conversion Cookbook, but it's gone,
though it probably remains in Chromium's git history somewhere. Here's
one copy, elsewhere:
https://chromium.googlesource.com/experimental/chromium/src/+/refs/wip/bajones/webvr/tools/gn/docs/cookbook.md
> https://groups.google.com/d/msgid/pdfium/7489d032-aa63-4283-b05b-644903678aea%40googlegroups.com.

Lei Zhang

unread,
Apr 18, 2017, 3:13:54 AM4/18/17
to gwonwang lee, pdfium
BTW, you could have worked out the need for target_cpu yourself by
looking in build/config/sanitizers/BUILD.gn just above line 351. Read
the source code.
Reply all
Reply to author
Forward
0 new messages