Hot questions for Using ZeroMQ in libsodium

Question:

Edit as of ZMQ version 4.1: Configure automatically looks for libsodium, so this is no longer required. If for some reason you wish to build it WITHOUT libsodium and you have it built and installed, configure libzmq with '--without-libsodium'.


So I'm having problems building/making zeromq with libsodium.

im using msys2 as the shell - specifically the mingw32_shell - , and zmq 4.1.0 rc1 with libsodium 1.0.1 and mingw-w64 32bit (gcc 4.9.2).

im currently able to compile libsodium like this

cd .../libsodium
bash configure
make
make check
make install

and everything is fine, all the tests pass and the libs and includes end up in the /usr/local/ folders that msys2 seems to know about.

then when i try to build zeromq with these commands

cd .../zeromq
bash configure --with-libsodium
make
make check
make install

i never get past the configure stage, as configure returns

checking for sodium_init in -lsodium... no
configure: error: libsodium is not installed.  Install it or don't pass --with-libsodium to configure script

i have tried the methods suggested in this post - ZeroMQ doesn't spot libsodium - but to no success.

therefore my question is thus: how do i either set the locations for zeromq's configure to look for libsodium to spot, whether with --with-libsodium, --with-libsodium-include-dir= and --with-libsodium-lib-dir=, or have them 'installed' in a location that msys2's shell is able to find?


Answer:

I assume you tried it already since the link you provided mentions it:

--with-libsodium=/usr/local

I tried this and it worked for me. However, I don't recommend this because for MSYS2, it is cleaner if /usr/local is used only for MSYS2 software, and not MinGW-w64 software. For MinGW-w64 i686 software, the 'right' prefix for 'local' is /mingw32/local

I've just now added libsodium as a dependency on the zeromq package.

Github MinGW-w64 zeromq PKGBUILD commit e32ae0

I will ask Alexey to rebuild and repackage it tomorrow.

Question:

I'm trying to compile the zeromq sources and I have the following error:

I'm using Visual studio 2013 update 4 / windows 7 x64

First of all I compile the libsodium library satisfactorily.

Then I link the libsodium header files directory path to additional dependencies and libsodium.lib to additional library directories. I also specify the name of library in additional dependencies.

I try to compile it under win32 architecture and x64 architecture but I get the same errors.

I know that a __imp prefix is used as a bridge to the function that I want to use so if I linked the libraries appropiately why do I get this error?

Console log:

1>Creating library E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.lib and object E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.exp
1>ctx.obj : error LNK2019: unresolved external symbol __imp__randombytes_close referenced in function "public: __thiscall zmq::ctx_t::~ctx_t(void)" (??1ctx_t@zmq@@QAE@XZ)
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__sodium_init referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t@zmq@@QAE@ABUoptions_t@1@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__sodium_init
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_keypair referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t@zmq@@QAE@ABUoptions_t@1@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>zmq_utils.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_beforenm referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome@curve_client_t@zmq@@AAEHPBEI@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_beforenm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box referenced in function "private: int __thiscall zmq::curve_client_t::produce_hello(class zmq::msg_t *)" (?produce_hello@curve_client_t@zmq@@AAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome@curve_client_t@zmq@@AAEHPBEI@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::encode(class zmq::msg_t *)" (?encode@curve_client_t@zmq@@UAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::decode(class zmq::msg_t *)" (?decode@curve_client_t@zmq@@UAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__randombytes referenced in function "private: int __thiscall zmq::curve_client_t::produce_initiate(class zmq::msg_t *)" (?produce_initiate@curve_client_t@zmq@@AAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__randombytes
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox referenced in function "private: int __thiscall zmq::curve_server_t::produce_welcome(class zmq::msg_t *)" (?produce_welcome@curve_server_t@zmq@@AAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox_open referenced in function "private: int __thiscall zmq::curve_server_t::process_initiate(class zmq::msg_t *)" (?process_initiate@curve_server_t@zmq@@AAEHPAVmsg_t@2@@Z)

Thanks in advance.


Answer:

You're probably compiling libsodium in a static way.

Try to compile it dinamically and link it again.