error LNK2001: unresolved external symbol "...::`vftable'"

error LNK2001: unresolved external symbol "...::`vftable'"

Hi, everyone,

For ICU4C build using ICC on Windows got error:

2>     Creating library ..\..\lib64\icuind.lib and object ..\..\lib64\icuind.exp
2>quant.obj : error LNK2001: unresolved external symbol "const icu_56::UnicodeMatcher::`vftable'" (??_7UnicodeMatcher@icu_56@@6B@)
2>strmatch.obj : error LNK2001: unresolved external symbol "const icu_56::UnicodeMatcher::`vftable'" (??_7UnicodeMatcher@icu_56@@6B@)
2>..\..\bin64\icuin56d.dll : fatal error LNK1120: 1 unresolved externals

(logs added in attachment). Error reproduced for ICC builds with '/Od' or '/O1' compiler keys, and not reproduced for ICC builds with '/O2' key or builds using MSVC.

Environment:
- Windows 10,
- Visual Studio 2015 Update 1 with integrated Intel Parallel Studio XE 2016 Update 1,
- ICU-56.1.

Steps to reproduce error:
1. extract ICU sources from archive,
2. open solution '<ICU sources>\source\allinone\allinone.sln' and:
- convert it to use Intel Compiler,
- select Debug configuration and any platform,
3. build project 'i18n'; this reproduce error in build log.

Error reproduced for few other libraries (for debug+shared builds only), and Developers from Intel Open Source Technology Center have come to the conclusion that this is an ICC bug (see QTBUG-48062).

Alexander

 

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi @Sav,
Thanks for filing this issue and bringing this to our attention. Yes, I can reproduce the issue and have filed the issue with the developers. I'll touch base with you as soon as I've an update or the release with the fix is out. Appreciate your patience till then.
Regards,
Kittur

Best Reply

@sav, BTW the issue id is:  DPD200409396

Kittur

It looks like virtual function table of object type UnicodeMatcher was not resolved.

@iliyapolak: good catch, I guess that could be case but I've not confirmed with the dev group - thanks;.

Kittur

Hi Kittur,

It looks so. I would try to put a breakpoint on __vfptr and walk that table with its corresponding entries (virtual functions), but I am not sure if it will help to solve the issue.

@iliyapolak:  I agree, thanks.

Kittur

Anyway such a problem should be approached by the Compiler engineers.

I agree and I've already passed on the feedback to the compiler dev. folks  - thanks.

Kittur

For ICU shell-based build using ICC on Windows got error:

sh-4.4$ (CC="icl" CXX="icl" CFLAGS="-Od -MDd" CXXFLAGS="-Od -Zi -MDd" ./configure --enable-debug --disable-release --enable-shared --disable-static && make)
[snip]
sh-4.4$ make
Note: rebuild with "make VERBOSE=1 " to show all compiler parameters.
make[0]: Making `all' in `stubdata'
make[1]: Entering directory '/c/libICU-58.2/build/source/stubdata'
make[1]: Leaving directory '/c/libICU-58.2/build/source/stubdata'
make[0]: Making `all' in `common'
make[1]: Entering directory '/c/libICU-58.2/build/source/common'
make[1]: Leaving directory '/c/libICU-58.2/build/source/common'
make[0]: Making `all' in `i18n'
make[1]: Entering directory '/c/libICU-58.2/build/source/i18n'
LINK.EXE -DLL  -nologo -base:"0x4a900000" -IMPLIB:../lib/icuind.lib -out:../lib/icuind58.dll ucln_in.o fmtable.o format.o msgfmt.o umsg.o numfmt.o unum.o decimfmt.o decimalformatpattern.o dcfmtsym.o digitlst.o fmtable_cnv.o choicfmt.o datefmt.o smpdtfmt.o reldtfmt.o dtfmtsym.o udat.o dtptngen.o udatpg.o nfrs.o nfrule.o nfsubs.o rbnf.o numsys.o unumsys.o ucsdet.o ucal.o calendar.o gregocal.o timezone.o simpletz.o olsontz.o astro.o taiwncal.o buddhcal.o persncal.o islamcal.o japancal.o gregoimp.o hebrwcal.o indiancal.o chnsecal.o cecal.o coptccal.o dangical.o ethpccal.o coleitr.o coll.o sortkey.o bocsu.o ucoleitr.o ucol.o ucol_res.o ucol_sit.o collation.o collationsettings.o collationdata.o collationtailoring.o collationdatareader.o collationdatawriter.o collationfcd.o collationiterator.o utf16collationiterator.o utf8collationiterator.o uitercollationiterator.o collationsets.o collationcompare.o collationfastlatin.o collationkeys.o rulebasedcollator.o collationroot.o collationrootelements.o collationdatabuilder.o collationweights.o collationruleparser.o collationbuilder.o collationfastlatinbuilder.o strmatch.o usearch.o search.o stsearch.o translit.o utrans.o esctrn.o unesctrn.o funcrepl.o strrepl.o tridpars.o cpdtrans.o rbt.o rbt_data.o rbt_pars.o rbt_rule.o rbt_set.o nultrans.o remtrans.o casetrn.o titletrn.o tolowtrn.o toupptrn.o anytrans.o name2uni.o uni2name.o nortrans.o quant.o transreg.o brktrans.o regexcmp.o rematch.o repattrn.o regexst.o regextxt.o regeximp.o uregex.o uregexc.o ulocdata.o measfmt.o currfmt.o curramt.o currunit.o measure.o utmscale.o csdetect.o csmatch.o csr2022.o csrecog.o csrmbcs.o csrsbcs.o csrucode.o csrutf8.o inputext.o wintzimpl.o windtfmt.o winnmfmt.o basictz.o dtrule.o rbtz.o tzrule.o tztrans.o vtzone.o zonemeta.o standardplural.o upluralrules.o plurrule.o plurfmt.o selfmt.o dtitvfmt.o dtitvinf.o udateintervalformat.o tmunit.o tmutamt.o tmutfmt.o currpinf.o uspoof.o uspoof_impl.o uspoof_build.o uspoof_conf.o decfmtst.o smpdtfst.o ztrans.o zrule.o vzone.o fphdlimp.o fpositer.o ufieldpositer.o decNumber.o decContext.o alphaindex.o tznames.o tznames_impl.o tzgnames.o tzfmt.o compactdecimalformat.o gender.o region.o scriptset.o uregion.o reldatefmt.o quantityformatter.o measunit.o sharedbreakiterator.o scientificnumberformatter.o digitgrouping.o digitinterval.o digitformatter.o digitaffix.o valueformatter.o digitaffixesandpadding.o pluralaffix.o precision.o affixpatternparser.o smallintformatter.o decimfmtimpl.o visibledigits.o dayperiodrules.o i18n.res ../lib/icuucd.lib ../stubdata/icudtd.lib advapi32.lib
   Creating library ../lib/icuind.lib and object ../lib/icuind.exp
strmatch.o : error LNK2001: unresolved external symbol "const icu_58::UnicodeMatcher::`vftable'" (??_7UnicodeMatcher@icu_58@@6B@)
quant.o : error LNK2001: unresolved external symbol "const icu_58::UnicodeMatcher::`vftable'" (??_7UnicodeMatcher@icu_58@@6B@)
../lib/icuind58.dll : fatal error LNK1120: 1 unresolved externals
make[1]: *** [Makefile:191: ../lib/icuind58.dll] Error 96
make[1]: Leaving directory '/c/libICU-58.2/build/source/i18n'
make: *** [Makefile:143: all-recursive] Error 2

Error reproduced for ICC Debug+Shared builds only, and not reproduced, if:

used '/O2' key instead of '/Od'-'/O1'

OR

'-Zi' key removed

from CXXFLAGS environment variable.

Error was reported before in other threads: QTBUG-48062 (2015), Apache C++ Standard Library (2006), Win32 -MD link error (2003), Is JPEG2000 supported (2006), etc.

 

Environment:

  • Windows 10 x64,
  • IPSXE 2017 Update 2,
  • VS 2015 Update 3,
  • MSYS2 20161025,
  • ICU4C 58.2.

 

UPDATE: Steps to reproduce error using shell.

1. Install MSYS2 to some directory (see installation and configuration in case troubles), so path to its files won't contain spaces, e.g. 'c:\ProgramData\Msys64', and:

- run shell using command 'mingw64.exe' from MSYS2 installation folder,
- upgrade using command 'pacman -Syuu' (could require few runs, until all components be upgraded),
- install additional packages ('make' utility) using command 'pacman -S make',
- delete file 'usr\bin\link.exe' from MSYS2 installation folder (or it would conflict with MSVC linker),

2. Extract ICU4C 58.2 sources to some directory, e.g. 'c:\TEST' so it would look like:

c:\TEST\icu\as_is\
...
c:\TEST\icu\readme.html

3. Run 'Compiler 17.0 Update 2 for Intel 64 Visual Studio 2015 environment' command prompt from Windows Start menu, and run commands:

set MSYSTEM=MINGW64
set PATH=c:\ProgramData\Msys64\usr\bin;%PATH%
sh
cd /c/TEST/icu/source
(CC="icl" CXX="icl" CFLAGS="-Od -MDd" CXXFLAGS="-Od -Zi -MDd" ./configure --enable-debug --disable-release --enable-shared --disable-static && make)
[command 'make -j<n>' could also be used to speedup build]

which reproduce error:

A previous version ICU4C 54.1 (Oct, 2014) from ICU-Project archives also reproduce this error.

Didn't tested on earlier versions, since they didn't provide support for MSYS2. Wherein file 'runConfigureICU' in that versions, e.g. ICU4C 38 (Sep, 2007) contain comment:

# The Intel compiler has optimization bugs. So we disable optimization.

Although it relate to opposite issue and not reproduced in recent versions, it indicate, that ICU build errors, related ICC optimization flags on Windows, are "a long-playing record".

 

Alexander

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today