ZooKeeper C 绑定安装 [英] ZooKeeper C binding installation
问题描述
我正在尝试为 ZooKeeper 安装 C 绑定,同时使用构建系统 i386-pc-solaris2.11(我不知道这是否重要)连接到另一台计算机.无论如何,我连接到的计算机正在运行基于 linux 的操作系统.
I am trying to install the C binding for ZooKeeper while ssh'ed to another computer using a build system: i386-pc-solaris2.11 (I don't know if that is important). Anyways, the computer I ssh'ed to is running a linux based OS.
我在命令行中运行了以下代码:
I ran the following code in the command line:
cd ../zookeeper
cd src
cd c
./configure
make
上面的终端输入取自 Apache 网站,用于设置 C shell 客户端.我得到的错误代码来自于 make:
The terminal inputs above were taken from the Apache website for setting up the C shell client. The error code I am getting is originates from the 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 中.但是,我的本地计算机上的 C 客户端确实有 zookeeper 工作,我只需要它在此系统上工作.
cli_mt:localhost:2181 does not work as the ZooKeeper library is not installed in /usr/local/lib . I do however have zookeeper working in the C client on my local computer, I just need it working on this system.
请帮忙,这只是在linux电脑上安装zookeeper.我不太了解linux,也不太了解这个makefile给我的错误代码.
Please help, this is just the installation of zookeeper on a linux computer. I don't understand linux too well, nor do I understand the error code given to me from this makefile.
我发现我无权更改此服务器上的/usrs/local/lib 目录.我试过
I figured out that I do not have permissions to change the /usrs/local/lib directory on this server. I tried
distclean && ./configure --prefix=/workspace/kunalp/zookeeper/ --libdir=/workspace/kunalp/zookeeper/lib && make install
重新定位库目录.然而,这并没有解决问题,给了我以下错误:
to relocate the library directory. This however did not fix the problem, giving me the following error:
/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'
谢谢
推荐答案
Solaris 编译器没有 __sync_fetch_and_add.为了解决这个问题,我必须在 Solaris 编译器中找到一个等效的函数:atomic_add() 并将 __sync_fetch_and_add 替换为 mt_adaptor.c 中的 atomic_add().这修复了我的 make 命令
The Solaris compiler does not have __sync_fetch_and_add. To fix this I had to find an equivalent function in the Solaris compailer: atomic_add() and replace __sync_fetch_and_add with atomic_add() in mt_adaptor.c. This fixed my make command
这篇关于ZooKeeper C 绑定安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!