You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve cpp-client-lib: provide another libpulsarwithdeps.a in dep/rpm (#6458)
Fix#6439
We shouldn't static link libssl in libpulsar.a, as this is a security red flag. we should just use whatever the libssl the system provides. Because if there is a security problem in libssl, all the machines can just update their own libssl library without rebuilding libpulsar.a.
As suggested, this change not change the old behavior, and mainly provides 2 other additional pulsar cpp client library in deb/rpm, and add related docs of how to use 4 libs in doc.
The additional 2 libs:
- pulsarSharedNossl (libpulsarnossl.so), similar to pulsarShared(libpulsar.so), with no ssl statically linked.
- pulsarStaticWithDeps(libpulsarwithdeps.a), similar to pulsarStatic(libpulsar.a), and archived in the dependencies libraries of `libboost_regex`, `libboost_system`, `libcurl`, `libprotobuf`, `libzstd` and `libz` statically.
Passed 4 libs rpm/deb build, install, and compile with a pulsar-client example code.
* also add libpulsarwithdeps.a together with libpulsar.a into cpp client release
* add documentation for libpulsarwithdeps.a, add g++ build examples
* add pulsarSharedNossl target to build libpulsarnossl.so
* update doc
* verify 4 libs in rpm/deb build, installed, use all good
Copy file name to clipboardExpand all lines: site2/docs/client-libraries-cpp.md
+43-6Lines changed: 43 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,37 @@ Pulsar C++ client is supported on **Linux** and **MacOS** platforms.
18
18
19
19
> Since 2.1.0 release, Pulsar ships pre-built RPM and Debian packages. You can download and install those packages directly.
20
20
21
+
Four kind of libraries `libpulsar.so` / `libpulsarnossl.so` / `libpulsar.a` / `libpulsarwithdeps.a` are included in your `/usr/lib` after rpm/deb download and install.
22
+
By default, they are build under code path `${PULSAR_HOME}/pulsar-client-cpp`, using command
These libraries rely on some other libraries, if you want to get detailed version of dependencies libraries, please reference [these](https://github.com/apache/pulsar/blob/master/pulsar-client-cpp/pkg/rpm/Dockerfile)[files](https://github.com/apache/pulsar/blob/master/pulsar-client-cpp/pkg/deb/Dockerfile).
25
+
26
+
1.`libpulsar.so` is the Shared library, it contains statically linked `boost` and `openssl`, and will also dynamically link all other needed libraries.
27
+
The command the when use this pulsar library is like this:
28
+
```bash
29
+
g++ --std=c++11 PulsarTest.cpp -o test /usr/lib/libpulsar.so -I/usr/local/ssl/include
30
+
```
31
+
32
+
2.`libpulsarnossl.so` is the Shared library that similar to `libpulsar.so` except that the library `openssl` and `crypto` are dynamically linked.
33
+
The command the when use this pulsar library is like this:
34
+
```bash
35
+
g++ --std=c++11 PulsarTest.cpp -o test /usr/lib/libpulsarnossl.so -lssl -lcrypto -I/usr/local/ssl/include -L/usr/local/ssl/lib
36
+
```
37
+
38
+
3.`libpulsar.a` is the Static library, it need to load some dependencies library when using it.
39
+
The command the when use this pulsar library is like this:
4.`libpulsarwithdeps.a` is the Static library, base on `libpulsar.a`, and archived in the dependencies libraries of `libboost_regex`, `libboost_system`, `libcurl`, `libprotobuf`, `libzstd` and `libz`,
45
+
The command the when use this pulsar library is like this:
After install, Pulsar libraries will be placed under `/usr/lib`.
86
+
50
87
### Build
51
88
52
89
> If you want to build RPM and Debian packages from the latest master, follow the instructions below. All the instructions are run at the root directory of your cloned Pulsar repository.
53
90
54
91
There are recipes that build RPM and Debian packages containing a
55
-
statically linked `libpulsar.so` / `libpulsar.a` with all the required
92
+
statically linked `libpulsar.so` / `libpulsarnossl.so` / `libpulsar.a` / `libpulsarwithdeps.a` with all the required
56
93
dependencies.
57
94
58
95
To build the C++ library packages, build the Java packages first.
@@ -71,8 +108,8 @@ This builds the RPM inside a Docker container and it leaves the RPMs in `pulsar-
71
108
72
109
| Package name | Content |
73
110
|-----|-----|
74
-
| pulsar-client | Shared library `libpulsar.so`|
75
-
| pulsar-client-devel | Static library `libpulsar.a`and C++ and C headers |
For complete examples, refer to [C++ client examples](https://github.com/apache/pulsar/tree/master/pulsar-client-cpp/examples).
220
+
For complete examples, refer to [C++ client examples](https://github.com/apache/pulsar/tree/master/pulsar-client-cpp/examples).
0 commit comments