[SERVER-24195] Windows --dbg=on --opt=off is broken because of link dependency on ICU Created: 18/May/16  Updated: 06/Jun/16  Resolved: 24/May/16

Status: Closed
Project: Core Server
Component/s: Build, Querying
Affects Version/s: None
Fix Version/s: 3.3.8

Type: Bug Priority: Critical - P2
Reporter: Kaloian Manassiev Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Use the following command and include the enterprise repo as well (not sure if this is a requirement):

scons -j 12 --dbg=on --opt=off --ssl --dynamic-windows --win-version-min=ws08r2 CPPPATH="D:/workspace/libs/snmp/include D:/workspace/libs/sasl/include D:/workspace/libs/openssl/include" LIBPATH="D:/workspace/libs/snmp/lib D:/workspace/libs/sasl/lib D:/workspace/libs/openssl/lib" VERBOSE=false mongos.exe

Sprint: Query 15 (06/03/16)
Participants:

 Description   

Building mongod/mongos on Windows with --opt=off/--dbg=on fails with the following error:

collator_interface_icu.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned char const * __cdecl icu_57::CollationKey::getByteArray(int &)const " (__imp_?getByteArray@CollationKey@icu_57@@QEBAPEBEAEAH@Z) referenced in function "public: virtual class mongo::CollatorInterface::ComparisonKey __cdecl mongo::CollatorInterfaceICU::getComparisonKey(class mongo::StringData)const " (?getComparisonKey@CollatorInterfaceICU@mongo@@UEBA?AVComparisonKey@CollatorInterface@2@VStringData@2@@Z)

The same build succeeds, when --opt=on is used.



 Comments   
Comment by Githook User [ 20/May/16 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-24195 collator_interface_icu_test needs ICU headers
Branch: master
https://github.com/mongodb/mongo/commit/99c8710c68d6008428f45f3730846db2e7143d71

Comment by Githook User [ 20/May/16 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-24195 Make ICU defines consistent btwn. ICU and client sources
Branch: master
https://github.com/mongodb/mongo/commit/770e967c7f9995b71af5ec9b45204d41b511f1ac

Comment by Eric Milkie [ 18/May/16 ]

ODR violation!
Glad it's easy to fix.

Comment by J Rassi [ 18/May/16 ]

Thanks, Eric. The issue indeed seems to be that the ICU sources are being built with the U_STATIC_IMPLEMENTATION define enabled (which sets a particular value for U_I18N_API), but mongo sources that include ICU headers are not being built with this define. This is causing (among other issues) CollationKey to be declared with __declspec(dllimport) in mongo sources that indirectly include <unicode/sortkey.h>, and the same class to be declared without __declspec(dllimport) in ICU sources.

Comment by Eric Milkie [ 18/May/16 ]

It might be because the class is marked: U_I18N_API
Which means on Windows it turns into dllimport (that's why you see it as part of the symbol name in the linker error).
I'm pretty sure you want to turn off all the API stuff, as everything we are using is compiled into one executable anyway. Look up where U_I16N_API is being defined and change it.

Comment by J Rassi [ 18/May/16 ]

collator_interface_icu.cpp includes <unicode/sortkey.h>, which provides an inline definition for getByteArray() ("inline const uint8_t* CollationKey::getByteArray(int32_t &count) const"). I would expect the definition of this symbol to be emitted into collator_interface_icu.obj.

I'm attempting to reproduce.

Comment by Mark Benvenuto [ 18/May/16 ]

What is the ETA for the fix as this blocks my ability to use debug builds on Windows?

Generated at Thu Feb 08 04:05:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.