zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Szalay-Bekő Máté <szalay.beko.m...@gmail.com>
Subject Re: Compilation issues with ZkTreeUtil in v3.5.5
Date Mon, 14 Oct 2019 08:14:39 GMT
Hello Guys!

I had to do compilations of the C-client on different platforms with
different zookeeper versions recently, and usually it was a different
challenge all the time :)
I know it is possible to compile the C code without ant / maven, but I try
to stick to the maven-way of the build below. I think that should be the
'official' way. But it is a bit buggy for 3.5.5...

I recorded the following steps to build the 3.5.5 C-client in Ubuntu 18.4
using docker:


First, just start the docker image (I mount /tmp of the host machine to
make it easier to copy the results later)
docker run --volume /tmp:/root/host_tmp -it --rm ubuntu:18.04 /bin/bash


then we install some additional packages, download the zookeeper source
code and set a few environment variables needed for the build:
apt update && apt install -y libcppunit-dev maven default-jdk-headless
autoconf libtool g++ make software-properties-common pkg-config wget git

cd /root
wget
https://archive.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5.tar.gz
tar xzvf apache-zookeeper-3.5.5.tar.gz

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
export ACLOCAL="aclocal -I /usr/share/aclocal"

cd apache-zookeeper-3.5.5/


with the g++ 7.4.0 we have in ubuntu 18.4, we get some compilation errors,
so we have to apply patch for ZOOKEEPER-3539.patch
wget
https://github.com/apache/zookeeper/commit/44911cfb3f04af09947d51403d55418d422e5c41.patch
-O ZOOKEEPER-3539.patch

git apply ./ZOOKEEPER-3539.patch


Now it gets a bit dirty... before ZOOKEEPER-3436, it is not possible to
compile the C-client with maven without tests. If you would simply compile
the code now, you would get some permission problems when the tests get
started, what you can fix by:
chmod +x
/root/apache-zookeeper-3.5.5/zookeeper-client/zookeeper-client-c/../../zookeeper-client/zookeeper-client-c/tests/zkServer.sh


The line above will help you to start the tests. Now the compilation should
work. But some tests can fail (might be flaky?). I just saw e.g. the
testcase testReadOnly to fail. I remember I also had some problems with
this test in ZOOKEEER-2122, where I eventually I fixed it, (this PR is
still open) but it might be unrelated. I haven't investigated why this
fails for me on 3.5.5. So I simply choose to disable the tests here. We
could skip the tests with ZOOKEEPER-3436, but this patch unfortunately can
not be applied on 3.5.5 simply, so I did the following hack, which will
skip the test execution:
sed -i -e 's/clean check/clean install/g'
zookeeper-client/zookeeper-client-c/pom.xml


And now finally you can start the build using maven:
mvn clean install -Pfull-build -DskipTests


And you can find / save the compiled C-client code from docker to your host
machine in the following way.
(I also have an open PR which will help you with this, but it is not merged
yet: ZOOKEEPER-3530)
cp -R zookeeper-client/zookeeper-client-c/target/c/bin
/root/host_tmp/zookeeper-c-client/
cp -R zookeeper-client/zookeeper-client-c/target/c/lib
/root/host_tmp/zookeeper-c-client/
cp -R zookeeper-client/zookeeper-client-c/target/c/include
/root/host_tmp/zookeeper-c-client/


I hope it helps...

Mate

On Fri, Oct 11, 2019 at 7:51 PM Enrico Olivelli <eolivelli@gmail.com> wrote:

> Can you try with 3.5.6 release candidate 4?
>
> Enrico
>
> Il ven 11 ott 2019, 18:28 rajsura <rajkirans711@gmail.com> ha scritto:
>
> > I have used multiple versions of GCC and the issue exists in both the
> cases
> > (gcc-4.8.5 and gcc-7.3.1).
> >
> > I have followed the instructions given in README.txt. Also, due to
> > restructuring in 3.5.5, I had to update ZOOKEEPER_PATH in configure.ac
> as
> > below:
> >
> > # Zookeeper C client
> > ZOOKEEPER_PATH=${BUILD_PATH}/../../zookeeper-client/zookeeper-client-c
> >
> > I am encountering these errors during "make" phase:
> >
> > $ make
> > make  all-recursive
> > make[1]: Entering directory
> >
> >
> '/tmp/bar2/zookeeper-3.5.5-SNAPSHOT/zookeeper-contrib/zookeeper-contrib-zktreeutil'
> > Making all in src
> > make[2]: Entering directory
> >
> >
> '/tmp/bar2/zookeeper-3.5.5-SNAPSHOT/zookeeper-contrib/zookeeper-contrib-zktreeutil/src'
> > g++ -DHAVE_CONFIG_H -I. -I..
> >
> >
> -I/tmp/bar2/zookeeper-3.5.5-SNAPSHOT/zookeeper-contrib/zookeeper-contrib-zktreeutil/../../zookeeper-client/zookeeper-client-c/include
> > -I/tmp/bar2/zookeeper-3.5.5-SNAPSHOT/zookeeper-contrib/zookeeper-contri
> > b-zktreeutil/../../zookeeper-client/zookeeper-client-c/generated
> > -I../include -I/usr/local/include -I/usr/include -I/usr/include/libxml2
> -g
> > -O2 -MT ZkAdaptor.o -MD -MP -MF .deps/ZkAdaptor.Tpo -c -o ZkAdaptor.o
> > ZkAdaptor.cc
> > ZkAdaptor.cc: In member function ‘bool
> > zktreeutil::ZooKeeperAdapter::createNode(const string&, const string&,
> int,
> > bool)’:
> > ZkAdaptor.cc:276:18: error: ‘zoo_create’ was not declared in this scope
> >              rc = zoo_create( mp_zkHandle,
> >                   ^~~~~~~~~~
> > ZkAdaptor.cc:276:18: note: suggested alternative: ‘zoo_acreate’
> >              rc = zoo_create( mp_zkHandle,
> >                   ^~~~~~~~~~
> >                   zoo_acreate
> > ZkAdaptor.cc: At global scope:
> > ZkAdaptor.cc:334:26: warning: dynamic exception specifications are
> > deprecated in C++11 [-Wdeprecated]
> >              int version) throw(ZooKeeperException)
> >                           ^~~~~
> > ZkAdaptor.cc: In member function ‘bool
> > zktreeutil::ZooKeeperAdapter::deleteNode(const string&, bool, int)’:
> > ZkAdaptor.cc:344:18: error: ‘zoo_delete’ was not declared in this scope
> >              rc = zoo_delete( mp_zkHandle, path.c_str(), version );
> >                   ^~~~~~~~~~
> > ZkAdaptor.cc:344:18: note: suggested alternative: ‘zoo_adelete’
> >              rc = zoo_delete( mp_zkHandle, path.c_str(), version );
> >                   ^~~~~~~~~~
> >                   zoo_adelete
> > ZkAdaptor.cc: At global scope:
> > ZkAdaptor.cc:383:77: warning: dynamic exception specifications are
> > deprecated in C++11 [-Wdeprecated]
> >      vector< string > ZooKeeperAdapter::getNodeChildren (const string
> > &path)
> > throw (ZooKeeperException)
> >
> > ^~~~~
> > ZkAdaptor.cc: In member function ‘std::vector<std::basic_string&lt;char>
> >
> > zktreeutil::ZooKeeperAdapter::getNodeChildren(const string&)’:
> > ZkAdaptor.cc:395:18: error: ‘zoo_get_children’ was not declared in this
> > scope
> >              rc = zoo_get_children( mp_zkHandle,
> >                   ^~~~~~~~~~~~~~~~
> > ZkAdaptor.cc:395:18: note: suggested alternative: ‘zoo_aget_children’
> >              rc = zoo_get_children( mp_zkHandle,
> >                   ^~~~~~~~~~~~~~~~
> >                   zoo_aget_children
> >
> > Its weird because, "zookeeper.h" is accessible and these are still
> defined
> > in there.
> >
> > Am I missing something here? Thanks!
> >
> >
> >
> >
> >
> > --
> > Sent from: http://zookeeper-user.578899.n2.nabble.com/
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message