Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: MSVC2013 build.bat fails on project czmq_selftest with link error #1617

Closed
rodrigomadruga opened this issue Jan 31, 2017 · 11 comments
Closed
Labels

Comments

@rodrigomadruga
Copy link
Contributor

Running msvc\vs2013\build.bat fails on czmq_selftest project with the following link error:

czmq_selftest.obj : error LNK2001: unresolved external symbol _czmq_private_selftest

Using latest czmq from git, Windows 10 Pro x64.

Related build.log output:

Project "C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq.sln" (1) is building "C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\czmq_selftest.vcxproj" (4) on node 1 (default targets).
LinkageInfo:
  Linkage-czmq: dynamic
  Linkage-libzmq: dynamic
PrepareForBuild:
  Creating directory "DebugDEXE\".
  Creating directory "DebugDEXE\czmq_selftest.tlog\".
InitializeBuildStatus:
  Creating "DebugDEXE\czmq_selftest.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /IC:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\..\..\..\..\..\libzmq\include\ /IC:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\..\..\..\..\..\czmq\include\ /Zi /nologo /W3 /WX- /MP /Od /Oy- /D _CONSOLE /D _DEBUG /D UNICODE /D _UNICODE /D WIN32 /D _WIN32 /Gm- /EHsc /RTC1 /MDd /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"DebugDEXE\\" /Fd"DebugDEXE\vc120.pdb" /Gd /TC /analyze- /errorReport:queue ..\..\..\..\src\czmq_selftest.c
  czmq_selftest.c
Link:
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\DebugDEXE\czmq_selftest.exe" /NOLOGO /LIBPATH:C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\..\..\..\..\..\libzmq\bin\Win32\Debug\v120\dynamic\ /LIBPATH:C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\..\..\..\..\..\czmq\bin\Win32\Debug\v120\dynamic\ libzmq.lib libczmq.lib Iphlpapi.lib Rpcrt4.lib Ws2_32.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:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\DebugDEXE\czmq_selftest.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\DebugDEXE\czmq_selftest.lib" /MACHINE:X86 /SAFESEH DebugDEXE\czmq_selftest.obj
  C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\bin\Win32\Debug\v120\dynamic\libczmq.lib
czmq_selftest.obj : error LNK2001: unresolved external symbol _czmq_private_selftest [C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\czmq_selftest.vcxproj]
C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\DebugDEXE\czmq_selftest.exe : fatal error LNK1120: 1 unresolved externals [C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\czmq_selftest.vcxproj]
Done Building Project "C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq_selftest\czmq_selftest.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\TeamCity\buildAgent\work\d0ebe9b63be6990e\czmq\builds\msvc\vs2013\czmq.sln" (default targets) -- FAILED.

Build FAILED.
@bluca
Copy link
Member

bluca commented Jan 31, 2017

Everything is working on the CI:

https://ci.appveyor.com/project/zeromq/czmq/build/build-826

Are you building with DRAFT APIs? That symbol is still in draft state

@rodrigomadruga
Copy link
Contributor Author

Yes, building with DRAFT APIs, as it is set if .git is found in configure.bat:

:-  Check if we want to build the draft API
if "%1" == "--enable-drafts" goto :with_draft
if "%1" == "--disable-drafts" goto :no_draft
IF NOT EXIST "..\..\.git" GOTO no_draft

If I run configure.bat --disable-drafts, platform.h undefs CZMQ_BUILD_DRAFT_API but I get a lot of compile errors, in ztimerset.c and ztrie.c. These two classes are in DRAFT state correct?

Is there a step to regenerate the libczmq.vcxproj that I am missing?

Is the CI build using cmake to generate czmq.sln and vcxproj files also?

@bluca
Copy link
Member

bluca commented Feb 1, 2017

ztimerset and ztrie are draft yes
The CI is using CMake but that's the extent of my knowledge of the windows side, sorry
@bbdb68 do you have any suggestion?

@twhittock
Copy link
Contributor

twhittock commented Feb 1, 2017 via email

@evoskuil
Copy link
Contributor

evoskuil commented Feb 2, 2017

The proper VS approach is to expose the optional configuration using a property that sets a preprocessor define. This is exposed in the VS UI via an XML extension and accessible to builds via the msbuild command line.

@rodrigomadruga
Copy link
Contributor Author

I made a PR (#1619) with the changes proposed, following @evoskuil suggestion.

But the link error still exists when compiling with drafts-api enabled. Still investigating.

@ghost
Copy link

ghost commented Mar 20, 2017

The Link error is due to source files czmq_private_selftest.c and zgossip_msg.c missing in the visual studio project. Once added as additional source files to the visual studio project, compilation works. Unfortunately I don't know how to add them to the zproject configuration as czmq_selftest is not explicitly mentioned in project.xml but seems to be somehow implicitly added. Could someone point me into the right direction?

@jacktrades52
Copy link

To elaborate on mlodew's comment. If compiling from the command line, add the following lines to the czmq_selftest.vcxproj file in the czmq_selftest directory for your msvs version:

<ClCompile Include="..\..\..\..\src\czmq_private_selftest.c" />
<ClCompile Include="..\..\..\..\src\zgossip_msg.c" />

after the line

<ClCompile Include="..\..\..\..\src\czmq_selftest.c" />

As mlodew mentions, compilation works after that. Thanks mlodew for your temp workaround until this issue is resolved.

@bluca
Copy link
Member

bluca commented Apr 7, 2017

This is how it was handled for other build systems:

zeromq/zproject@9714a1d

@sgluss
Copy link
Contributor

sgluss commented Nov 10, 2017

I had this same problem, @jacktrades52 fix worked for me on windows 10 with VS2017

@stale
Copy link

stale bot commented Nov 10, 2018

This issue has been automatically marked as stale because it has not had recent activity for 90 days. It will be closed if no further activity occurs within 21 days. Thank you for your contributions.

@stale stale bot added the stale label Nov 10, 2018
@stale stale bot closed this as completed Dec 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants