1
Download zookeeper-3.3.6.zip
Compile/zookeeper-3.3.6/src/C
./Configure -- prefix =/HFX/zookeeper
Make
Make install
-- Prefix is similar to this type of parameter,./configure -- Help
After compilation, you can see the following path:
[HFX @ 74 ~] $ CD zookeeper/
[HFX @ 74 zookeeper] $ LL
Total 24
Drwxrwxr-x 2 HFX 4096 Mar 11 Bin
Drwxrwxr-x 3 HFX 4096 Mar 11 16:43 include
Drwxrwxr-x 2 HFX 4096 Mar 11 lib
Indicates that the compilation is successful.
2
Use: add the compiled lib file path to the cmake file. If you need to compile a multi-threaded ClientProgram, Please add the compilation option-dthreaded, and link at the same timeZookeeper_mt LibraryIf you need to compile a single-threaded client programNoAdd the compilation option-dthreaded, which should be linked at the same timeZookeeper_st library.
Include_directories (
./
/Usr/local/include
/Home/HFX/zookeeper/include/C-client-Src
)
Link_directories (
/Usr/local/lib
/Home/HFX/zookeeper/lib
)
Add_executable (test $ {src_list })
# Add_library (zoo_queue shared $ {src_list })
Target_link_libraries (test zookeeper_mt pthread dl)
This protects the compiled lib files.
How to Use zookeeper APIs
For specific APIs, refer to the official website or other blogs. We recommend this:
Http://www.cnblogs.com/haippy/archive/2013/02/21/2920280.html