ZooKeeper C绑定安装

时间:2018-07-09 23:31:26

标签: c apache-zookeeper

我试图在使用构建系统SSH切换到另一台计算机时安装ZooKeeper的C绑定:i386-pc-solaris2.11(我不知道这是否重要)。无论如何,我要转至的计算机正在运行基于Linux的OS。

我在命令行中运行了以下代码:

cd ../zookeeper
cd src
cd c
./configure
make

以上终端输入来自Apache网站,用于设置C shell客户端。我收到的错误代码来自make:

libtool: link: ( cd ".libs" && rm -f "libzookeeper_mt.la" && ln -s 
"../libzookeeper_mt.la" "libzookeeper_mt.la" )
gcc -DHAVE_CONFIG_H -I.  -I./include -I./tests -I./generated -
D_POSIX_PTHREAD_SEMANTICS  -Wall -Werror -g -O2 -D_GNU_SOURCE -MT cli.o 
-MD -MP -MF .deps/cli.Tpo -c -o cli.o `test -f 'src/cli.c' || echo 
'./'`src/cli.c
mv -f .deps/cli.Tpo .deps/cli.Po
/bin/sh ./libtool  --tag=CC    --mode=link gcc -Wall -Werror -g -O2 -
D_GNU_SOURCE    -o cli_st cli.o libzookeeper_st.la 
libtool: link: gcc -Wall -Werror -g -O2 -D_GNU_SOURCE -o .libs/cli_st 
cli.o  ./.libs/libzookeeper_st.so -lnsl -lsocket -lm -R/usr/local/lib
gcc -DHAVE_CONFIG_H -I.  -I./include -I./tests -I./generated -
D_POSIX_PTHREAD_SEMANTICS  -DTHREADED -g -O2 -D_GNU_SOURCE -MT cli_mt-
cli.o -MD -MP -MF .deps/cli_mt-cli.Tpo -c -o cli_mt-cli.o `test -f 
'src/cli.c' || echo './'`src/cli.c
mv -f .deps/cli_mt-cli.Tpo .deps/cli_mt-cli.Po
/bin/sh ./libtool  --tag=CC    --mode=link gcc -DTHREADED -g -O2 -
D_GNU_SOURCE    -o cli_mt cli_mt-cli.o libzookeeper_mt.la 
libtool: link: gcc -DTHREADED -g -O2 -D_GNU_SOURCE -o .libs/cli_mt 
cli_mt-cli.o  ./.libs/libzookeeper_mt.so -lnsl -lsocket -lm -lpthread -
R/usr/local/lib
Undefined                       first referenced
 symbol                             in file
__ .sync_fetch_and_add                ./.libs/libzookeeper_mt.so
ld: fatal: symbol referencing errors. No output written to .libs/cli_mt
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `cli_mt'
Current working directory 
/workspace/kunalp/mysource/usr/src/kunalp/zookeeperC2/src/c
*** Error code 1
make: Fatal error: Command failed for target `all'

cli_mt:localhost:2181不起作用,因为ZooKeeper库未安装在/ usr / local / lib中。但是我确实有zookeeper在本地计算机上的C客户端中工作,我只需要它在此系统上工作即可。

请帮助,这只是在Linux计算机上安装zookeeper。我不太了解linux,也不了解这个makefile中给我的错误代码。

编辑:我发现我没有权限更改此服务器上的/ usrs / local / lib目录。我尝试过

distclean && ./configure --prefix=/workspace/kunalp/zookeeper/ --libdir=/workspace/kunalp/zookeeper/lib && make install

重新定位库目录。但是,这不能解决问题,给我以下错误:

/bin/sh ./libtool  --tag=CC    --mode=link gcc -DTHREADED -g -O2 -
D_GNU_SOURCE    -o cli_mt cli_mt-cli.o libzookeeper_mt.la 
libtool: link: gcc -DTHREADED -g -O2 -D_GNU_SOURCE -o .libs/cli_mt 
cli_mt-cli.o  ./.libs/libzookeeper_mt.so -lnsl -lsocket -lm -lpthread -
R/workspace/kunalp/zookeeper/lib
Undefined                       first referenced
symbol                             in file
 __sync_fetch_and_add                ./.libs/libzookeeper_mt.so
ld: fatal: symbol referencing errors. No output written to .libs/cli_mt
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `cli_mt'

谢谢

1 个答案:

答案 0 :(得分:0)

Solaris编译器没有__sync_fetch_and_add。为了解决这个问题,我必须在Solaris编译器中找到一个等效的函数:atomic_add(),并在mt_adaptor.c中将__sync_fetch_and_add替换为atomic_add()。这修复了我的make命令