pulsar-client-cpp icon indicating copy to clipboard operation
pulsar-client-cpp copied to clipboard

[Feature request] Conan recipe to build C++ client and publication to conan-center

Open cbornet opened this issue 7 years ago • 11 comments

Conan.io is a popular C++ package manager. It would be very handy to have a conan recipe to build the C++ client. It would make it easy to build even on Windows, even with MSVC. Ultimately, you could pre-build conan packages for various platforms and compilers and publish them to conan-center so that it's easy to include the client lib in a conan-enabled project.

cbornet avatar Nov 15 '18 11:11 cbornet

I checked and all dependencies used by the C++ client seem to exist in conan except log4cxx (but it is optional, isn't it ?): Boost, OpenSSL, zlib, json-cpp, curl, gtest/gmock --> conan-center Boost-Python, protobuf --> bincrafters

Also the only Linux-only dependency seems to be the crc32 lib. Couldn't it be possible to use a cross-platform CRC32 so that the client can be built on Windows ?

cbornet avatar Nov 15 '18 13:11 cbornet

Related to apache/pulsar#15 apache/pulsar#2461 apache/pulsar#2680

cbornet avatar Nov 15 '18 13:11 cbornet

@cbornet I don't have any experience with Conan.io but it seems to be a good way to package the client lib.

log4cxx (but it is optional, isn't it ?):

Yes, log4cxx is optional and disabled by default

Boost-Python, protobuf --> bincrafters

boost-python is only needed at compile time (and we should refactor the CMakeList.txt to not require it at compile time as it's only used to build the python client wrapper).

Also the only Linux-only dependency seems to be the crc32 lib. Couldn't it be possible to use a cross-platform CRC32 so that the client can be built on Windows ?

We don't depend on crc32 libraries. We have a crc32-c implementation imported in our sources.

merlimat avatar Nov 15 '18 18:11 merlimat

We don't depend on crc32 libraries. We have a crc32-c implementation imported in our sources.

Yes. My point was more that this crc32-c implementation depends on pthread which is not natively supported on windows. Sorry for not being clear enough. But there's actually a conan package for pthread on windows so maybe it could be used.

cbornet avatar Nov 15 '18 23:11 cbornet

Oh, I see : https://github.com/apache/pulsar/blob/579e0dc74039c081301662e5fd55209c1a4abe5c/pulsar-client-cpp/lib/checksum/crc32c_sw.cc#L47

It should be easy to just switch to same thing from boost https://www.boost.org/doc/libs/1_68_0/doc/html/thread/synchronization.html#thread.synchronization.once

merlimat avatar Nov 15 '18 23:11 merlimat

We actually use that in another place: https://github.com/apache/pulsar/blob/8b2929b3e5403fb44653976dc74be287666f7b96/pulsar-client-cpp/lib/c/c_MessageId.cc#L37

merlimat avatar Nov 15 '18 23:11 merlimat

Yes that's even better

cbornet avatar Nov 15 '18 23:11 cbornet

ITNOA

__builtin_expect does not exist in Windows on MSVC, did you any plan to resolve this?

I think vcpkg is popular package manager too, so I think adding pulsar to vcpkg is important too, but we can see many errors on this procedure

soroshsabz avatar Apr 02 '19 02:04 soroshsabz

related to apache/pulsar#3800

soroshsabz avatar Apr 02 '19 02:04 soroshsabz