New issue
Advanced search Search tips

Issue 764823 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug

Blocking:
issue 761475



Sign in to add a comment

Windows CanonOutputT linker error with jumbo in blink/platform

Project Member Reported by brat...@opera.com, Sep 13 2017

Issue description

When enabling jumbo for blink/platform there is a strange linker error in Windows (and Windows only):

FAILED: blink_platform.dll blink_platform.dll.lib blink_platform.dll.pdb
L:/src/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x86 False link.exe /nologo /IMPLIB:./blink_platform.dll.lib /DLL /OUT:./blink_platform.dll /PDB:./blink_platform.dll.pdb @./blink_platform.dll.rsp
url_lib.dll.lib(url_lib.dll) : error LNK2005: "public: __thiscall url::CanonOutputT<char>::CanonOutputT<char>(void)" (??0?$CanonOutputT@D@url@@QAE@XZ) already defined in platform_jumbo_1.obj
url_lib.dll.lib(url_lib.dll) : error LNK2005: "public: virtual __thiscall url::CanonOutputT<char>::~CanonOutputT<char>(void)" (??1?$CanonOutputT@D@url@@UAE@XZ) already defined in platform_jumbo_1.obj
url_lib.dll.lib(url_lib.dll) : error LNK2005: "public: int __thiscall url::CanonOutputT<char>::length(void)const " (?length@?$CanonOutputT@D@url@@QBEHXZ) already defined in platform_jumbo_1.obj
url_lib.dll.lib(url_lib.dll) : error LNK2005: "public: char * __thiscall url::CanonOutputT<char>::data(void)" (?data@?$CanonOutputT@D@url@@QAEPADXZ) already defined in platform_jumbo_1.obj
./blink_platform.dll : fatal error LNK1169: one or more multiply defined symbols found
ninja: build stopped: cannot make progress due to previous errors.

This might turn out to be another instance of bug 739340, but all I know so far is that it is triggered by something in third_party/WebKit/Source/platform/network/
 

Comment 1 by brat...@opera.com, Sep 13 2017

Cc: brucedaw...@chromium.org
Really looks like another instance of bug 739340.

We have the class structure:
URL_EXPORT StdStringCanonOutput inheriting from 
CanonOutput which is a typedef of CanonOutputT<char>

inside blink_platform URL_EXPORT will become a declspec(dllimport), and it ends up inside blink_platform through the blink/platform/network code which uses //media code which uses //url code.

weborigin/KURL.cpp, OriginAccessEntry.cpp, SecurityOrigin.cpp will then instantiate local url::RawCanonOutputT<char, 128> (or similar) objects. 

RawCanonOutputT<char, ...> is a template with no EXPORT or IMPORT so it will be instantiated locally. It inherits from CanonOutputT<char> (which is the same CanonOutput) and now we have the situation that has caused problems elsewhere.

Since I don't know how to work around it, nor what in more detail makes the compiler fail here (whether it's a compiler bug or just a side effect of how things work) I will just exclude the files using RawCanonOutputT from jumbo builds in windows component builds.
Just encountered the same thing in a (non official) jumbo build of net.dll:

[5819/8950] LINK(DLL) net.dll net.dll.lib net.dll.pdb
FAILED: net.dll net.dll.lib net.dll.pdb 
ninja -t msvc -e environment.x86 -- ../../third_party/llvm-build/Release+Asserts/bin/lld-link.exe /nologo /IMPLIB:./net.dll.lib /DLL /OUT:./net.dll /PDB:./net.dll.pdb @./net.dll.rsp
lld-link: error: undefined symbol: "__declspec(dllimport) class url::CanonOutputT<char> & __thiscall url::CanonOutputT<char>::operator=(class url::CanonOutputT<char> const &)" (__imp_??4?$CanonOutputT@D@url@@QAEAAV01@ABV01@@Z)
>>> referenced by obj/net/net/net_jumbo_12.obj:("class url::StdStringCanonOutput & __thiscall url::StdStringCanonOutput::operator=(class url::StdStringCanonOutput const &)" (??4StdStringCanonOutput@url@@QAEAAV01@ABV01@@Z))


Changing the structure of the url code is probably the way to go but that is not very tempting.
Components: Build

Sign in to add a comment