New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 654776 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

Windows build warnings LNK4217 and LNK4209 in Mojo

Project Member Reported by elawrence@chromium.org, Oct 11 2016

Issue description

Version: 56.2880

What steps will reproduce the problem?
(1) Build on Windows

LINK(DLL) blink_platform.dll blink_platform.dll.lib
quads.mojom-blink.obj : warning LNK4217: locally defined symbol ?Read@?$StructTraits@VSizeDataView@mojom@gfx@@UWebSize@blink@@@mojo@@SA_NVSizeDataView@mojom@gfx@@PAUWebSize@blink@@@Z (public: static bool __cdecl mojo::StructTraits<class gfx::mojom::SizeDataView,struct blink::WebSize>::Read(class gfx::mojom::SizeDataView,struct blink::WebSize *)) imported in function "public: static bool __cdecl mojo::internal::Serializer<class gfx::mojom::SizeDataView,struct blink::WebSize>::Deserialize(class gfx::mojom::internal::Size_Data *,struct blink::WebSize *,struct mojo::internal::SerializationContext *)" (?Deserialize@?$Serializer@VSizeDataView@mojom@gfx@@UWebSize@blink@@@internal@mojo@@SA_NPAVSize_Data@2mojom@gfx@@PAUWebSize@blink@@PAUSerializationContext@23@@Z)

shared_quad_state.mojom-blink.obj : warning LNK4049: locally defined symbol ?Read@?$StructTraits@VSizeDataView@mojom@gfx@@UWebSize@blink@@@mojo@@SA_NVSizeDataView@mojom@gfx@@PAUWebSize@blink@@@Z (public: static bool __cdecl mojo::StructTraits<class gfx::mojom::SizeDataView,struct blink::WebSize>::Read(class gfx::mojom::SizeDataView,struct blink::WebSize *)) imported transferable_resource.mojom-blink.obj : warning LNK4049: locally defined symbol ?Read@?$StructTraits@VSizeDataView@mojom@gfx@@UWebSize@blink@@@mojo@@SA_NVSizeDataView@mojom@gfx@@PAUWebSize@blink@@@Z (public: static bool __cdecl mojo::StructTraits<class gfx::mojom::SizeDataView,struct blink::WebSize>::Read(class gfx::mojom::SizeDataView,struct blink::WebSize *)) imported

gpu_info.mojom-blink.obj : warning LNK4049: locally defined symbol ?Read@?$StructTraits@VSizeDataView@mojom@gfx@@UWebSize@blink@@@mojo@@SA_NVSizeDataView@mojom@gfx@@PAUWebSize@blink@@@Z (public: static bool __cdecl mojo::StructTraits<class gfx::mojom::SizeDataView,struct blink::WebSize>::Read(class gfx::mojom::SizeDataView,struct blink::WebSize *)) imported

args.gn is:
# Build arguments go here. Examples:
#   is_component_build = true
#   is_debug = false
# See "gn args <out_dir> --list" for available build arguments.
#is_chrome_branded = true    ; branding=Chrome, internal only
#is_official_build = true
# use_goma = true
#is_clang = true             

# Use /debug:fastlink
is_win_fastlink = true    

# Recommended for faster builds, required for debug builds        
is_component_build = true 

# "x86" "x64"
target_cpu = "x86"

# Disable symbol generation for faster builds, use 1 for function names only
symbol_level = 0                   

# Improves build times, and nacl is rarely used anyway
enable_nacl = false                

Discussion of this warning: https://blogs.msdn.microsoft.com/russellk/2005/03/20/lnk4217/
 

Comment 1 by wfh@chromium.org, Oct 13 2016

Labels: OS-Windows
Also getting this...

Comment 2 by wfh@chromium.org, Oct 13 2016

Owner: roc...@chromium.org
Status: Assigned (was: Untriaged)

Comment 3 by roc...@chromium.org, Oct 13 2016

Cc: roc...@chromium.org jam@chromium.org
Owner: xlai@chromium.org
Assigning to xlai based on r416022 where the blink dependency on cc mojom appears to have been introduced.

This looks familiar and is most likely caused by the offscreen_canvas_mojo_bindings applying the export macro hack while also publicly exposing other bindings (at least quads.mojom) which are not generated with the same hack enabled. So you are exporting interface methods that depend on non-exported symbols from cc/ipc:interfaces.

This is basically not supported. One workaround would be to avoid exposing anything from cc interfaces in your mojom's public interface methods. You can do something like:

struct FooParams {
  cc.mojom.Thing1 foo;
  cc.mojom.Thing2 bar;
}

and then

interface Qux {
  DoFoo(FooParams params);
};

as a workaround. This should avoid the export issue.

Comment 4 by xlai@chromium.org, Oct 14 2016

We are actually in the middle of discussion on whether compositor frame can be exposed in Blink at all. If we reach a conclusion that this should be refactored, then after the month-long refactoring, the bug in this issue will be solved automatically. Hopefully this is not an urgent bug at this moment.

Comment 5 by w...@chromium.org, Dec 17 2016

Cc: w...@chromium.org
We are hoping to address  issue 659007 , which requires that this be fixed; xlai@ is this still going away, or do we need to address the export macro issue as rockot@ suggests?

Comment 6 by xlai@chromium.org, Dec 17 2016

I am planning to take away compositor_frame as a direct import in offscreen_canvas_surface.mojom sometime in the future, but not sure if that can solve this issue or not.

Comment 7 by w...@chromium.org, Dec 19 2016

Blocking: 659007

Comment 8 by w...@chromium.org, Dec 19 2016

Re #6: OK, so it sounds like we should pursue an interim fix for the symbol exports in that code, to allow linker warnings-as-errors to land?

Comment 9 by w...@chromium.org, Dec 21 2016

Status: Fixed (was: Assigned)
This appears to have been fixed by crrev.com/2598703002.

Comment 10 by w...@chromium.org, Dec 21 2016

Status: Assigned (was: Fixed)
Re #9: My mistake; not fixed. :(

Comment 11 by leon....@intel.com, Dec 22 2016

Cc: leon....@intel.com
I've uploaded one fix https://codereview.chromium.org/2574593003/ which is still review ongoing.
Project Member

Comment 12 by bugdroid1@chromium.org, Dec 23 2016

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

commit c868aae8f9b8d51461afff79064c75339e6ce30c
Author: wez <wez@chromium.org>
Date: Fri Dec 23 08:09:04 2016

Use the /WX flag to have link warnings treated as errors.

Link steps with warnings typically lead to working binaries, but warnings can indicate dependency issues in the codebase, slow down builds, and otherwise just make it harder to find more relevant output in build logs.

This CL also adds exceptions to ignore certain linker warnings under specific configurations and targets.

BUG= 659007 ,  676418 , 676417,  654776 

Review-Url: https://codereview.chromium.org/2581893002
Cr-Commit-Position: refs/heads/master@{#440600}

[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/build/config/compiler/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/build/config/win/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/media/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/media/mojo/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/media/mojo/services/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/third_party/WebKit/Source/platform/BUILD.gn

Comment 13 by w...@chromium.org, Dec 23 2016

Blocking: -659007
Project Member

Comment 14 by bugdroid1@chromium.org, Jan 17 2017

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

commit 4724c1ac34d346dd8b44c4abc33b344a744a2d69
Author: leon.han <leon.han@intel.com>
Date: Tue Jan 17 06:52:48 2017

Fix Windows build warning LNK4217 for blink_platform.dll.

[1] third_party/WebKit/public:offscreen_canvas_mojo_bindings_blink
  ==> [2] cc/ipc:interfaces_blink
    ==> [3] gpu/ipc/common:interfaces_blink
The above three targets are all linked into blink_platform.dll,
but [2] and [3] use gfx.mojom.Size typemap defined in
third_party/WebKit/Source/platform/mojo/GeometryStructTraits.{cpp,h},
which is exported from bink_platform.dll.
Thus, generated C++ bindings of [2] and [3] include GeometryStructTraits.h
while themselves are part of blink_platform.dll, means they are
importing(dllimport) local defined symbols marked as dllexport, caused LNK4217.

This CL moves this struct traits to a separate source_set target,
instead of exporting it from blink_platform.dll.

BUG= 654776 , 669352 
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2574593003
Cr-Commit-Position: refs/heads/master@{#443994}

[modify] https://crrev.com/4724c1ac34d346dd8b44c4abc33b344a744a2d69/third_party/WebKit/Source/platform/BUILD.gn
[add] https://crrev.com/4724c1ac34d346dd8b44c4abc33b344a744a2d69/third_party/WebKit/Source/platform/mojo/BUILD.gn
[modify] https://crrev.com/4724c1ac34d346dd8b44c4abc33b344a744a2d69/third_party/WebKit/Source/platform/mojo/Geometry.typemap
[modify] https://crrev.com/4724c1ac34d346dd8b44c4abc33b344a744a2d69/third_party/WebKit/Source/platform/mojo/GeometryStructTraits.cpp
[modify] https://crrev.com/4724c1ac34d346dd8b44c4abc33b344a744a2d69/third_party/WebKit/Source/platform/mojo/GeometryStructTraits.h
[modify] https://crrev.com/4724c1ac34d346dd8b44c4abc33b344a744a2d69/third_party/WebKit/public/BUILD.gn

Comment 15 by xlai@chromium.org, Feb 17 2017

Status: Fixed (was: Assigned)
I no longer find the warnings in win builder compile log.

Sign in to add a comment