zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.75k stars 2.36k forks source link

problem: no way to disable draft when compiling #1942

Closed somdoron closed 8 years ago

somdoron commented 8 years ago

As part of preparing for version 4.2 we need a way to compile zeromq without new draft addition to the API.

Following are new and draft addition to libzmq:

We also need to disable the new socket types: gather, scatter, client, server, dish, radio. We can define them in zmq.h only if draft macro is defined, if draft macro is not defined we can include them in the precompiled.hpp so internal code will still compile.

Lastly we need a way to define the macro from autotools, cmake and visual studio. I don't have much experience with autotools and cmake and appreciate help with this.

hitstergtd commented 8 years ago

Also, do we need up the ABI version in Makefile.am, from 5.0.0 to 6.0.0 or something?

somdoron commented 8 years ago

@hitstergtd Actually I don't know... the version should be compatible with 4.1, so do we still need to push the version?

hitstergtd commented 8 years ago

It goes back to release planning, and since we have not been following plans and such, I have no idea. Moreover, it depends what your rough timeframe is for dropping 4.2. But based on what I am reading in Makefile.am, it seems that every release drop was an ABI bump.

In case we have to back port changes in the future from master, that might possibly break ABI, wouldn't it be better to bump the ABI and be on the safe side?

somdoron commented 8 years ago

@hitstergtd you are right

bluca commented 8 years ago

The ABI triplet should be bumped, but if the release is backward compatible the age should be bumped too (IE: 6:0:1) (see: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html ). At least once in the past this wasn't done, and packagers had to patch it to fix it manually. There are tools to check for ABI compatibility, like: https://github.com/lvc/abi-compliance-checker

We already had this discussion on the mailing list I think? The only dubious change was to the definition of zmq_msg_t to a union, everything else is ABI compatible, or at least it was last time I checked at the time of that discussion.

bluca commented 8 years ago

Regarding the draft, I did the work for zproject/czmq so I can help with that.

So do we want something similar? A section in the public header behind an #ifdef ?

somdoron commented 8 years ago

@bluca yes. We can handle the new socket type macros later. thanks

bluca commented 8 years ago

One of the differences is that the tests are built completely separately (in CZMQ/zproject they are part of the class source file) and link to the shared library. That is good, as it means they can only use the public exported API. But it also means we can't run them when DRAFT is disabled.

somdoron commented 8 years ago

can we do conditional tests if build draft flag is on ? I know the Makefile.am has some condition on tests according to the OS or build flags (like libsoduim, PGM tipc), like so:

if BUILD_TIPC
test_apps += \
    tests/test_connect_delay_tipc \
    tests/test_pair_tipc \
    tests/test_reqrep_device_tipc \
    tests/test_reqrep_tipc \
    tests/test_router_mandatory_tipc \
    tests/test_shutdown_stress_tipc \
    tests/test_sub_forward_tipc \
    tests/test_term_endpoint_tipc

so the same but for drafts

bluca commented 8 years ago

Yes, that's how I'm handling it :-) I mentioned it as an issue because it might very well be possible, although unlikely, to break those draft functionality without noticing when building without drafts. Hopefully having the default of draft ENABLED when building from a git repo will help with that.

I'm almost done with autotools. Working through a couple of issues.