Windows build stripping symbols not used in core/ even when exported?

21 views
Skip to first unread message

Mounir Lamouri

unread,
Apr 25, 2017, 6:37:58 AM4/25/17
to blin...@chromium.org, Nico Weber
In https://codereview.chromium.org/2830653002 I'm moving some code from
core/ to modules/. A consequence of this change is that two core/
methods (in core/layout/api/LayoutSliderItem.h) are no longer called
from core/ but only from modules/.

Two win builders (win_chromium_compile_dbg_ng and win_clang but not
win_chromium_*rel*) are failing to link with an error that looks like
this:
```
[40786/46075] LINK(DLL) blink_modules.dll blink_modules.dll.lib
blink_modules.dll.pdb
FAILED: blink_modules.dll blink_modules.dll.lib blink_modules.dll.pdb
E:/b/depot_tools/python276_bin/python.exe
../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x86
False link.exe /nologo /IMPLIB:./blink_modules.dll.lib /DLL
/OUT:./blink_modules.dll /PDB:./blink_modules.dll.pdb
@./blink_modules.dll.rsp
MediaControlElementsHelper.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: __thiscall
blink::LayoutSliderItem::LayoutSliderItem(class blink::LayoutSlider *)"
(__imp_??0LayoutSliderItem@blink@@QAE@PAVLayoutSlider@1@@Z) referenced
in function "public: static bool __cdecl
blink::MediaControlElementsHelper::IsUserInteractionEventForSlider(class
blink::Event *,class blink::LayoutObject *)"
(?IsUserInteractionEventForSlider@MediaControlElementsHelper@blink@@SA_NPAVEvent@2@PAVLayoutObject@2@@Z)

MediaControlElementsHelper.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: bool __thiscall
blink::LayoutSliderItem::InDragMode(void)const "
(__imp_?InDragMode@LayoutSliderItem@blink@@QBE_NXZ) referenced in
function "public: static bool __cdecl
blink::MediaControlElementsHelper::IsUserInteractionEventForSlider(class
blink::Event *,class blink::LayoutObject *)"
(?IsUserInteractionEventForSlider@MediaControlElementsHelper@blink@@SA_NPAVEvent@2@PAVLayoutObject@2@@Z)

./blink_modules.dll : fatal error LNK1120: 2 unresolved externals
```

Worth noting that the CL does not actually call these methods but only
remove the last callers from core/. I tried to export the class,
explicitly export the two methods that are mentioned (only one is
currently exported) but nothing seems to make the compilers happy.

Any idea why this might be happening? :)

Thanks,
-- Mounir

Fredrik Söderquist

unread,
Apr 25, 2017, 7:02:16 AM4/25/17
to Mounir Lamouri, blink-dev, Nico Weber
So if LayoutSliderItem.h is no longer included in core/ (I'm assuming), then those symbols would not actually be present for exporting and hence you can't import them. Did you try either to let core/ have definitions of said functions, or maybe just remove the export from LayoutSliderItem, moving it to LayoutSlider instead (don't know how these "API" wrappers are intended to work wrt to issues like this.)


/fs

Primiano Tucci

unread,
Apr 25, 2017, 10:05:22 AM4/25/17
to Fredrik Söderquist, Mounir Lamouri, blink-dev, Nico Weber
I think the problem with PS4/PS5 is that you are adding a _EXPORT macro to an inline function which is defined in the header.
I think that is causing the confusion. You are essentially saying, in the header: "hey this is the definition of the function. but also, i am telling you that this is __declspec(dllimport)"
So I think that at this point the compiler might drop the inline and adding a dependency on an imported function that will be never defined anywhere else.
either not marking the inline function as _EXPORT-ed, or moving its definition to the .cpp file should work. Which seems precisely what you are doing in PS6.

Mounir Lamouri

unread,
Apr 26, 2017, 8:18:50 AM4/26/17
to Primiano Tucci, Fredrik Söderquist, blink-dev, Nico Weber
Thanks for the feedback Frederik and Primiano. I did not realise that
the header had the full implementation inline, making the symbols indeed
not available in the core library. I've fixed this by adding a cpp file
for this class as it's probably the less invasive fix.

-- Mounir
> --
> You received this message because you are subscribed to the Google Groups
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to blink-dev+...@chromium.org.
Reply all
Reply to author
Forward
0 new messages