pmem / pmemkv

Key/Value Datastore for Persistent Memory
https://pmem.io
Other
397 stars 120 forks source link

How can I build pmemkv statically? #1074

Open bryanwux opened 2 years ago

bryanwux commented 2 years ago

QUESTION:

How can I build pmemkv statically?

Details

I am wondering why pmemkv only supports building as a shared library. Why not remove SHARED flag here https://github.com/pmem/pmemkv/blob/9f7de0cc1bb5a31c10d2feaa8d1c12cac1ab3b68/CMakeLists.txt#L298 and https://github.com/pmem/pmemkv/blob/9f7de0cc1bb5a31c10d2feaa8d1c12cac1ab3b68/CMakeLists.txt#L409 If users want to build it as a shared lib, they can manually set BUILD_SHARED_LIBS=on when cmake.

lukaszstolarczuk commented 2 years ago

Hi, I believe we can make some changes to allow static build, but the default value we'd like to provide is SHARED.

May I know what your use case is? It'd be nice to understand how you'd like to use our lib statically and what solution would you accept (if not BUILD_SHARED_LIBS=on). Also, what version of pmemkv you're using - would it be all right to add this new CMake option to the master branch?

bryanwux commented 2 years ago

Hi @lukaszstolarczuk , thank you for your reply. I am using the version 1.5.0 of pmemkv. The use case is I am considering using pmemkv in envoy http cache. I know this is uncommon but enovy only supports statically builds. What about leave the default build option to SHARED then add a new option for static build?