Win10 Visual Studio 2015,c++ x64 compilation ZMQ

Source: Internet
Author: User



PS. I build the process of stepping on the pit, record memo



Download: (1) Official website: Http://zeromq.org/intro:get-the-software, concise compiling method, CMake, here not much to repeat



(2) to GitHub download, https://github.com/zeromq, I download is 4.1.x stable, in https://github.com/zeromq/zeromq4-1



Preparation: First download the source package decompression, to any directory, I extracted the root directory for E:\zeromq4-1-master\zeromq4-1-master



Compile:



(1) In the root directory, there is a builds folder, open and then open the inside of the Msvc folder, which has vs2008 to vs2013 project folder, in view of my use is vs2015, so, choose to open vs2013 Project, double-click Libzmq.sln Open the solution side case, it will be necessary to modify the configuration file, click OK, modified will automatically load the project






(2) in the menu bar of the target platform to select x64, and in the configuration options, there are 6 options, divided into 3 categories, Dyn, Static, Ltcg,dyn represents a dynamic library, static is the library, LTCG is a relatively unfamiliar option, This is described in detail in Microsoft's MSDN documentation: Https://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx.



          ---; brief description: /LTCG, link-time code generation, Due to generate code obj can be optimized globally .  is generally used for release version of the build .  this option and the Add-on link (https:// Msdn.microsoft.com/zh-cn/library/4khtbfyf.aspx Microsoft's MSDN Introduction, detailed instructions on this, citing a friend of the article: http://www.cnblogs.com/Dahaka/ archive/2011/08/01/2124256.html)   is a conflict debug version generation speed is not slow , please keep the debug version does not <---



I compiled the dynamic link library, so the use of the Dynrelease option, and then right-click on the LIBZMQ project, select Build (Compile), at this point to start compiling, but in the middle of the error, as follows


Severity	Code	Description	Project	File	Line	Suppression State
Error	LNK1181	cannot open input file ‘libsodium.lib‘	libzmq	E:\zeromq4-1-master\zeromq4-1-master\builds\msvc\vs2013\libzmq\LINK	1


Tip cannot be opened libsodium.lib, this is an advanced and easy-to-use encryption library. It is mainly used for encryption, decryption, signing and generating password hashes, and so on. This is a portable, cross-compiler supported, installable, NACI-based development that provides a compatible API. At this point, double-click the error to see the following compiled statement, starting at line 30 of Libsodium.import.props


<Target Name="Linkage-libsodium-dynamic" AfterTargets="AfterBuild" Condition="‘$(Linkage-libsodium)‘ == ‘dynamic‘">
    <Copy Condition="$(Configuration.IndexOf(‘Debug‘)) != -1"
          SourceFiles="$(ProjectDir)..\..\..\..\..\libsodium\bin\$(PlatformName)\Debug\$(PlatformToolset)\dynamic\libsodium.dll"
          DestinationFiles="$(TargetDir)libsodium.dll"
          SkipUnchangedFiles="true" />
    <Copy Condition="$(Configuration.IndexOf(‘Debug‘)) != -1"
          SourceFiles="$(ProjectDir)..\..\..\..\..\libsodium\bin\$(PlatformName)\Debug\$(PlatformToolset)\dynamic\libsodium.pdb"
          DestinationFiles="$(TargetDir)libsodium.pdb"
          SkipUnchangedFiles="true" />
    <Copy Condition="$(Configuration.IndexOf(‘Release‘)) != -1"
          SourceFiles="$(ProjectDir)..\..\..\..\..\libsodium\bin\$(PlatformName)\Release\$(PlatformToolset)\dynamic\libsodium.dll"
          DestinationFiles="$(TargetDir)libsodium.dll"
          SkipUnchangedFiles="true" />
  </Target>


Here (ProjectDir): \.. \.. \.. \.. \libsodium, one of the . \ There are five, and the directory where the props file is located is the root directory for all projects of the solution, where the compilation works for (ProjectDir)-LIBZMQ,






Its directory is E:\zeromq4-1-master\zeromq4-1-master\builds\msvc\vs2013\libzmq, then: \ Returns the parent directory five times, then goes back to the E:\zeromq4-1-master (note the beginning of the solution directory)



(3) Download Libsodium, directly to GitHub download can https://github.com/jedisct1/libsodium, download unzip, I solve the directory for E:\libsodium-master, open the root directory of E:\ Libsodium-master\builds\msvc vs2015, double-click libsodium.sln,configuration (Configuration) Select Dynrelease, platform Select x64, then compile, process quickly, Because there is no other, so the compilation will not be wrong. The bin folder is generated in the root directory, and the compiled results are inside. At this point, I think the LIBZMQ project will include the Libsodium path, but as in step (2) The contents of the props file, this will not be successful.



The correct approach: Copy the entire compiled root folder libsodium-master to E:\zeromq4-1-master, and change thename to Libsodium, at which time E : \zeromq4-1-master has two folders, one is Libsodium (root of Libsodium), one is zeromq4-1-master (root directory of ZMQ) ,





At this point, the compilation results of Libsodium are as consistent as the props file description, resulting in: \.. \.. \.. \.. \libsodium of E:\zeromq4-1-master\libsodium\bin\x64\Release\v140\dynamic, corresponding platformname for X64,platformtoolset for v140 , the following file is consistent with what you need to copy the reference to,






          (4) After the work is ready, the second step of the compilation, can be completed successfully, the results are as follows


1>------ Build started: Project: libzmq, Configuration: ReleaseDLL x64 ------
1>  ConfigurationType : DynamicLibrary
1>  Configuration     : ReleaseDLL
1>  PlatformToolset   : v140
1>  TargetPath        : E:\zeromq4-1-master\zeromq4-1-master\builds\msvc\vs2013\libzmq\..\..\..\..\bin\x64\Release\v140\dynamic\libzmq.dll
1>  Option-openpgm    :
1>  Option-sodium     : true
1>  Option-gssapi     :
1>  Linkage-libsodium : dynamic
1>     Creating library E:\zeromq4-1-master\zeromq4-1-master\builds\msvc\vs2013\libzmq\..\..\..\..\bin\x64\Release\v140\dynamic\libzmq.lib and object E:\zeromq4-1-master\zeromq4-1-master\builds\msvc\vs2013\libzmq\..\..\..\..\bin\x64\Release\v140\dynamic\libzmq.exp
1>  libzmq.vcxproj -> E:\zeromq4-1-master\zeromq4-1-master\builds\msvc\vs2013\libzmq\..\..\..\..\bin\x64\Release\v140\dynamic\libzmq.dll
1>  libzmq.vcxproj -> E:\zeromq4-1-master\zeromq4-1-master\builds\msvc\vs2013\libzmq\..\..\..\..\bin\x64\Release\v140\dynamic\libzmq.pdb (Full PDB)
1>  Copying libsodium.dll -> E:\zeromq4-1-master\zeromq4-1-master\bin\x64\Release\v140\dynamic\libsodium.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


A bin file will also appear in the root directory, resulting in E:\zeromq4-1-master\zeromq4-1-master\bin\x64\Release\v140\dynamic:






At this point, the compilation is completed, using the Include header file in E:\zeromq4-1-master\zeromq4-1-master\include, there are zmq.h and zmq_utils.h















Win10 Visual Studio 2015,c++ x64 compilation ZMQ


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.