Help needed in compiling using MSVC

48 views
Skip to first unread message

ami...@gmail.com

unread,
Jan 23, 2015, 11:21:40 AM1/23/15
to link-g...@googlegroups.com
Hello,
In order to check the Windows compatibility of the recent modifications (yet unpublished) I made in the link-grammar library, I would like to compile link-grammar under native Windows.
To that end I installed MSVC13 (in Windows 8.1).
I don't have much experience with Windows, and this is my first try to compile something on Windows (I'm a U*ix programmer.)

I used the MSVC12 solution file.
I solved some initial problems (used libtre 64bit regex library, defined GNUREGEX user macro, disabled Java binding) and now link-grammar-x64.dll is created (along with its .exp, .ilk, .lib and .pdb files) without any special problems
(but several compilation warnings, that I will try to fix if succeed to produce a working program.)

However, on LinkGrammarExe.vcxproj I get link errors:

---
Project "C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\LinkGrammarExe.vcxproj" on node 2 (Build target(s)).
Link:
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:PROMPT /OUT:"C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\x64\Debug\LinkGrammarExe.exe" /INCREMENTAL /NOLOGO "C:\cygwin64\home\amirp_000\link-grammar\gnuregex\lib\regex.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\x64\Debug\LinkGrammarExe.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\x64\Debug\LinkGrammarExe.lib" /MACHINE:X64 "Temp\LinkGrammarExex64Debug\command-line.obj"
  Temp\LinkGrammarExex64Debug\lg_readline.obj
  "Temp\LinkGrammarExex64Debug\link-parser.obj"
     Creating library C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\x64\Debug\LinkGrammarExe.lib and object C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\x64\Debug\LinkGrammarExe.exp
link-parser.obj : warning LNK4217: locally defined symbol issue_special_command imported in function special_command
command-line.obj : error LNK2019: unresolved external symbol parse_options_create referenced in function command_options_create
command-line.obj : error LNK2019: unresolved external symbol parse_options_delete referenced in function command_options_delete
...
command-line.obj : error LNK2019: unresolved external symbol lg_mbrtowc referenced in function clean_up_string
link-parser.obj : error LNK2019: unresolved external symbol __imp_linkgrammar_get_version referenced in function main
link-parser.obj : error LNK2019: unresolved external symbol __imp_linkgrammar_get_dict_version referenced in function main
...
link-parser.obj : error LNK2019: unresolved external symbol __imp_prt_error referenced in function main
C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\x64\Debug\LinkGrammarExe.exe : fatal error LNK1120: 91 unresolved externals
Done Building Project "C:\cygwin64\home\amirp_000\link-grammar\master\msvc12\LinkGrammarExe.vcxproj" (Build target(s)) -- FAILED.

Build FAILED.
---

Any help would be much appreciated.

Amir

ami...@gmail.com

unread,
Jan 23, 2015, 6:10:01 PM1/23/15
to link-g...@googlegroups.com
I found the reason of the link problem.

For some reason link-grammar-x64.lib is missing in the library list in the <Link> sections under Debug|x64 and Release|x64 in LinkGrammarExe.vcxproj.
Old line:
      <AdditionalDependencies>$(GNUREGEX)\lib\regex.lib;%(AdditionalDependencies)</AdditionalDependencies>
Fixed line:
      <AdditionalDependencies>$(SolutionDir)$(Platform)\$(Configuration)\link-grammar-x64.lib;$(GNUREGEX)\lib\regex.lib;%(AdditionalDependencies)</AdditionalDependencies>

With this fix, the link step succeeds with no additional problems! (I guess producing an x64 binary had not been tried using this project file.)
(I will send a pull request for the fix I made in LinkGrammarExe.vcxproj unless some Windows expert sends it before me).

I then got a runtime error 0xc0150002. It turned out it was because MSVCR80D.DLL is not found in my system, and it was required because I used the "debug" version of the precompiled libtre.
Using the "release" version of libtre solved this problem.

Now everything runs fine.

BTW, I generated regex.lib from libtre-0.7.5 as follows, using dlltool from cygwin (I don't know if there is a better way):
dlltool -l regex.lib -d libtre/win32/tre.def -D regex.dll libtre/win32/bin/x64_release/libtre_dll.dll

I guess it will be a good idea to add this to the README (I will try to do it too if this is indeed desired).

Amir
Reply all
Reply to author
Forward
0 new messages