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

vs2017 building issue #1780

Closed
Manimozhis95 opened this issue Nov 2, 2017 · 15 comments · Fixed by microsoft/vcpkg#7186
Closed

vs2017 building issue #1780

Manimozhis95 opened this issue Nov 2, 2017 · 15 comments · Fixed by microsoft/vcpkg#7186
Labels

Comments

@Manimozhis95
Copy link

Any one build successfully CZMQ using vs2017

@bluca
Copy link
Member

bluca commented Nov 2, 2017

@evoskuil @somdoron @sigiesec does any of you guys know about VS and CZMQ? There's been questions on the mailing list as well

@sigiesec
Copy link
Member

sigiesec commented Nov 2, 2017

No, sorry, I have never used czmq.

@Formulator
Copy link

Formulator commented Nov 2, 2017

Sorry I haven't VS2017 installed, but I’ve been trying to build CZMQ on Windows 10 using VS2015, the build fails after a few seconds and I get errors; https://pastebin.com/a2r2KJi0

This is what I’ve done so far;

git clone --depth 1 -b stable https://github.com/jedisct1/libsodium.git
cd libsodium\builds\msvc\build
buildall.bat
cd ..\..\..\..

:: if libsodium is on disk, the Windows build of libzmq will automatically use it
git clone git://github.com/zeromq/libzmq.git
cd libzmq\builds\msvc
configure.bat
cd build
buildall.bat
cd ..\..\..\..

git clone git://github.com/zeromq/czmq.git
cd czmq\builds\msvc
configure.bat
cd vs2015
build.bat

Would love to get CZMQ building smoothly on Windows!

@myd7349
Copy link
Contributor

myd7349 commented Nov 3, 2017

I tried to build czmq using VS2017 on Win10 about one and a half months ago. The auxiliary tools I used is zproject and gsl. I installed them on Win10 via WSL(Windows Subsystem for Linux). I can't remember all the details. But the following instruction may help(It looks terrible though).

  1. Install gsl
    Just follow the README.md;
  2. Clone zproject(DO NOT install it yet, there is some work to do before we install it)
    Since zproject does not support VS2017 target currently, we need to modify a template file to make it work out.
    The file you need to modify is zproject_vs20xx.gsl. Search all the vs2015 stuffs in this file, copy them, then change vs2015 to vs2017 for this copy. Then we may got:
    function target_vs2015
        generate_vs20xx_main ("builds/msvc")
        generate_vs20xx_props ("builds/msvc/properties")
        generate_vs20xx_build ("builds/msvc/vs2015", "14")
    endfunction
    
    function target_vs2017
        generate_vs20xx_main ("builds/msvc")
        generate_vs20xx_props ("builds/msvc/properties")
        generate_vs20xx_build ("builds/msvc/vs2017", "15")
    endfunction
    
    at the end of zproject_vs20xx.gsl.
    Here, the VisualStudio solution file format version 15 is what I guess. And my guess is wrong. I will catch up it later.
  3. Install zproject and generate vs2017 solution for czmq with it
    Follow the README.md of zproject. After this step, you will got a vs2017 solution directory for czmq generated by gsl.
  4. Modify the solution and project files we got in the previous step
    When I tried to open the solution file czmq.sln I got in the previous step, it failed. The reason is that the file format version I guessed in step 2 is wrong.
    So I created a normal console application solution with vs2017 via the new project wizard(say helloworld.sln). And the solution file generated by vs2017 has a header like this:
    Microsoft Visual Studio Solution File, Format Version 12.00
    # Visual Studio 15
    VisualStudioVersion = 15.0.26730.8
    MinimumVisualStudioVersion = 10.0.40219.1
    
    Hmm, the file format version is 12, and there is also a VisualStudioVersion and MinimumVisualStudioVersion.
    Modify czmq.sln so that it has a similar header just like the one in helloworld.sln.
  5. Open czmq.sln with Visual Studio 2017 and modify the libczmq project so that it can find the prebuild libzmq library
    If you build libzmq with vs2010, you will get libzmq.lib, libzmq.dll. If build it with vs2017, however, you will get libzmq-v141-mt-gd-4_2_3.dll, libzmq-v141-mt-gd-4_2_3.lib. So you see, things changed. You have to modify the project file manully so that libzmq can be found by libczmq.
  6. Copy czmq/builds/msvc/platform.h to czmq/include
  7. Add #include "platform.h" into czmq/include/czmq_prelude.h. I think line 661 is a good place to include platform.h.

By the way, I also tried CMake. But it just can not find libzmq. Since I am not familier with CMake, so I just give it up.

@somdoron
Copy link
Member

somdoron commented Nov 3, 2017 via email

@sgluss
Copy link
Contributor

sgluss commented Nov 10, 2017

@myd7349 did you try the step specified by jacktrades52 in this issue: #1617

This worked for me, got CZMQ built on Win10/VS2017

I also had to:
-switch all the solutions to x64 config for libzmq/czmq
-make sure build targets match for libzmq/czmq

This was necessary because of how the Linker inherits the path for external library files: if any of the build parameters are different between libzmq and czmq (x64 vs 32, or build targeted to 140 for one, 141 for the other) then libzmq will not be found.

Check your linker config, you'll see the inherited external library path there, along with the build variables in the path which must match between libzmq/czmq

@myd7349
Copy link
Contributor

myd7349 commented Nov 13, 2017

@sgluss No, I didn't try it yet. I will try it later.

@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
@myd7349
Copy link
Contributor

myd7349 commented Dec 15, 2018

Hey guys!
I just created a PR to add czmq into vcpkg: microsoft/vcpkg#4979 .
Once merged, Visual Studio 2017 users on Windows may install czmq via vcpkg:

vcpkg install czmq:x64-windows

@Formulator
Copy link

Nice work @myd7349 , vcpkg sounds like an awesome time-saver! When you get czmq ported I'd like to give it a try building my Windows / Linux app which uses boost, czmq & zeromq. One question I have is: Typically I normally build zeromq using libsodium as the crypto library because I discovered throughput performance issues with the default tweetnacl. How would I install zeromq within vcpkg making sure that libsodium was used for crypto? Thanks for any clarification.

@myd7349
Copy link
Contributor

myd7349 commented Dec 17, 2018

@Formulator Thanks for your kindly reply. As far as I know, zeromq port in vcpkg doesn't link to libsodium. I also created a PR for using zeromq with libsodium: microsoft/vcpkg#4214 .

Once merged, we can reinstall zeromq like this:

vcpkg install zeromq[sodium]

Even if this PR was not accepted, we may modify local zeromq portfile as what I did in the above PR.

@myd7349
Copy link
Contributor

myd7349 commented Jul 3, 2019

Hi! @Formulator Good news! I finally finish this work. Now, we can install czmq + zeromq + libsodium in vcpkg like this:

vcpkg install zeromq[sodium]
vcpkg install czmq

@Formulator
Copy link

Wow! @myd7349 thanks, I compiled & ran my app on Windows 10 using Visual Studio 2019 with czmq via vcpkg. So easy, fast and simple..... Except for one issue:

Error CMake Error at vcpkg/installed/x86-windows/share/czmq/czmqConfig.cmake:31 (if): if given arguments: "AND" "FALSE" Unknown arguments specified vcpkg/installed/x86-windows/share/czmq/czmqConfig.cmake 31

Not sure what the logic at czmqConfig.cmake line 31 intends:

find_dependency(ZeroMQ)
if ( AND FALSE)
find_dependency(OpenSSL)
find_dependency(ZLIB)
endif ()

But by commenting out the if & endif lines I bypassed the error and got it to function.

@myd7349
Copy link
Contributor

myd7349 commented Jul 7, 2019

Hi! @Formulator It is caused by a mistake I made in vcpkg_check_features, and should have been fixed in microsoft/vcpkg#7158 .

@Formulator
Copy link

Sorted @myd7349 , rebuilt czmq using vcpkg commit. Problem solved! Thanks.

ras0219-msft added a commit to microsoft/vcpkg that referenced this issue Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants