[zeromq-dev] Revisited: Example for building against ZMQ with CMake + UDP Multicast Support
Stephan again
opfer at vs.uni-kassel.de
Wed Sep 26 17:10:55 CEST 2018
And the static library installed from this repository seems to have the
draft api included. Here is the test for that:
nm -gC /usr/lib/x86_64-linux-gnu/libzmq.a | grep zmq_msg_group
nm: src_libzmq_la-devpoll.o: no symbols
nm: src_libzmq_la-gssapi_mechanism_base.o: no symbols
nm: src_libzmq_la-gssapi_client.o: no symbols
nm: src_libzmq_la-gssapi_server.o: no symbols
nm: src_libzmq_la-kqueue.o: no symbols
nm: src_libzmq_la-poll.o: no symbols
nm: src_libzmq_la-pollset.o: no symbols
nm: src_libzmq_la-precompiled.o: no symbols
nm: src_libzmq_la-select.o: no symbols
nm: src_libzmq_la-vmci.o: no symbols
nm: src_libzmq_la-vmci_address.o: no symbols
nm: src_libzmq_la-vmci_connecter.o: no symbols
nm: src_libzmq_la-vmci_listener.o: no symbols
0000000000000fb0 T zmq_msg_group(zmq_msg_t*) <- matched
Kind Regards
Stephan
On 26.09.2018 17:05, Stephan again wrote:
>
> I Installed it from:
>
> http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-draft/xUbuntu_18.04/
>
> Hoping that it was compiled accordingly...
>
> This:
>
> g++ Discovery.cpp /usr/lib/x86_64-linux-gnu/libzmq.a -lpthread
> -DZMQ_BUILD_DRAFT_API=1 -DENABLE_DRAFTS=On -o test
>
> makes it even worth:
>
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-socket_base.o): In
> function `zmq::socket_base_t::connect(char const*)':
> (.text+0x4b26): undefined reference to `pgm_freeaddrinfo'
> /tmp/cc62suQj.o: In function `msg_send(zmq_msg_t*, void*, char const*,
> char const*)':
> Discovery.cpp:(.text+0x8e): undefined reference to `zmq_msg_set_group'
> /tmp/cc62suQj.o: In function `msg_recv_cmp(zmq_msg_t*, void*, char
> const*, char const*)':
> Discovery.cpp:(.text+0x148): undefined reference to `zmq_msg_group'
> /tmp/cc62suQj.o: In function `main':
> Discovery.cpp:(.text+0x30e): undefined reference to `zmq_leave'
> Discovery.cpp:(.text+0x37f): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x3c3): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x407): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x57c): undefined reference to `zmq_join'
> Discovery.cpp:(.text+0x668): undefined reference to `zmq_leave'
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-zmq_utils.o): In
> function `zmq_curve_keypair':
> (.text+0x3e6): undefined reference to `crypto_box_keypair'
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-zmq_utils.o): In
> function `zmq_curve_public':
> (.text+0x482): undefined reference to `crypto_scalarmult_base'
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-ip.o): In function
> `zmq::initialize_network()':
> (.text+0x480): undefined reference to `pgm_init'
> (.text+0x511): undefined reference to `pgm_error_free'
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-ip.o): In function
> `zmq::shutdown_network()':
> (.text+0x585): undefined reference to `pgm_shutdown'
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-random.o): In
> function `zmq::random_open()':
> (.text+0x95): undefined reference to `sodium_init'
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-random.o): In
> function `zmq::random_close()':
> (.text+0xc1): undefined reference to `randombytes_close'
> /usr/lib/x86_64-linux-gnu/libzmq.a(src_libzmq_la-pgm_socket.o): In
> function `zmq::pgm_socket_t::init_address(char const*,
> pgm_addrinfo_t**, unsigned short*)':
> (.text+0x17e): undefined reference to `pgm_getaddrinfo'
> (.text+0x26f): undefined reference to `pgm_error_free'
>
> ....
>
> Kind Regards
>
> Stephan
>
>
>
> On 26.09.2018 16:55, Jake wrote:
>> ZeroMQ itself needs to be compiled with ENABLE_DRAFTS in CMake.
>> You've added it to the compiler flags when building your own
>> application. Did you compile ZeroMQ yourself or are you using a
>> distro-provided version?
>>
>> For the static library, one way is to give the full path to the .a
>> file instead of using -lzmq. gcc default behavior prefers the shared
>> object when both are present.
>>
>> -Jake
>>
>>
>> On Wed, Sep 26, 2018 at 10:51 AM Stephan again
>> <opfer at vs.uni-kassel.de <mailto:opfer at vs.uni-kassel.de>> wrote:
>>
>> Hi Bill,
>>
>> adding -DENABLE_DRAFTS=On does not help:
>>
>> g++ Discovery.cpp -lzmq -DZMQ_BUILD_DRAFT_API=1
>> -DENABLE_DRAFTS=On -o test
>>
>> I also checked my installed libraries with "nm -gC <library |
>> grep zmq_msgs_group":
>>
>> /usr/lib/x86_64-linux-gnu/libzmq.a -> match
>> /usr/lib/x86_64-linux-gnu/libzmq.so -> no match
>> /usr/lib/x86_64-linux-gnu/libzmq.so.5 -> no match
>> /usr/lib/x86_64-linux-gnu/libzmq.so.5.1.5 -> no match
>>
>> I am not so into this dynamic and static library stuff, but my
>> build chain is linking agains
>> "/usr/lib/x86_64-linux-gnu/libzmq.so". Is that the problem? How
>> do I force it on command line to link against the static version.
>>
>> Kind Regards
>>
>> Stephan
>>
>>
>> On 26.09.2018 16:08, Bill Torpey wrote:
>>> Hi Stephan:
>>>
>>> The RADIO/DISH sockets are considered DRAFT, which is probably
>>> why you’re getting these errors.
>>>
>>> There are a couple of possibilities:
>>>
>>> - You may be linking against a version of libzmq that doesn’t
>>> include the draft APIs. In order to build with draft support,
>>> the build needs to specify "-DENABLE_DRAFTS=On” on the cmake
>>> command line. Make sure your libzmq was built with support for
>>> the draft APIs.
>>>
>>>
>>> - You also need to enable draft APIs in your code, similar to
>>> following:
>>>
>>> #define ZMQ_BUILD_DRAFT_API
>>> #include <zmq.h>
>>>
>>> The #define makes the draft APIs visible to your code.
>>>
>>> (Never mind — you’re already doing this on the compile command).
>>>
>>> Hope this helps.
>>>
>>> Bill
>>>
>>>> On Sep 26, 2018, at 9:13 AM, Stephan again
>>>> <opfer at vs.uni-kassel.de <mailto:opfer at vs.uni-kassel.de>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I asked this question/issue one and a half year ago
>>>> (https://lists.zeromq.org/mailman/private/zeromq-dev/2017-January/031309.html).
>>>> The difference is that I now would like to use zeromq (draft
>>>> api) version 4.2.5 under Ubuntu 18.04.
>>>>
>>>> My minimal (not) working example can be found here:
>>>> https://gist.github.com/StephanOpfer/5b9f3f76e6610536078cb9c16072aac9
>>>>
>>>> Compiling it with this command:
>>>>
>>>> g++ Discovery.cpp -lzmq -DZMQ_BUILD_DRAFT_API=1 -o test
>>>>
>>>> produces this:
>>>>
>>>> /tmp/ccUwelWs.o: In function `msg_send(zmq_msg_t*, void*,
>>>> char const*, char const*)':
>>>> Discovery.cpp:(.text+0x8e): undefined reference to
>>>> `zmq_msg_set_group'
>>>> /tmp/ccUwelWs.o: In function `msg_recv_cmp(zmq_msg_t*,
>>>> void*, char const*, char const*)':
>>>> Discovery.cpp:(.text+0x148): undefined reference to
>>>> `zmq_msg_group'
>>>> /tmp/ccUwelWs.o: In function `main':
>>>> Discovery.cpp:(.text+0x30e): undefined reference to `zmq_leave'
>>>> Discovery.cpp:(.text+0x37f): undefined reference to `zmq_join'
>>>> Discovery.cpp:(.text+0x3c3): undefined reference to `zmq_join'
>>>> Discovery.cpp:(.text+0x407): undefined reference to `zmq_join'
>>>> Discovery.cpp:(.text+0x57c): undefined reference to `zmq_join'
>>>> Discovery.cpp:(.text+0x668): undefined reference to `zmq_leave'
>>>> collect2: error: ld returned 1 exit status
>>>>
>>>> Any help is welcome. :)
>>>>
>>>> Kind Regards
>>>>
>>>> Stephan
>>>>
>>>>
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
>>>> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>>
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
>>> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
>> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180926/e9edd594/attachment.htm>
More information about the zeromq-dev
mailing list