loentar / axis2c-unofficial

Unofficial backports and unofficial support for Apache Axis2/C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compile --enable-json fails

peebles opened this issue · comments

I am on Ubuntu 18.04. Following the instructions for building from source. Installed json-c. Then:

./configure --prefix=$AXIS2C_HOME --enable-json

and got

...
Making all in transport/http/util
make[4]: Entering directory '/axis/axis2c-unofficial/src/core/transport/http/util'
/bin/bash ../../../../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../../.. -I../../../../../include -I../../../../../src/core/engine -I../../../../../util/include -I../../../../../axiom/include -I/usr/include/json-c  -D_LARGEFILE64_SOURCE -DAXIS2_GUTHTHILA_ENABLED -DAXIS2_SVR_MULTI_THREADED  -DAXIS2_JSON_ENABLED  -g -O2 -D_LARGEFILE64_SOURCE -ansi -Wall -Wno-implicit-function-declaration -g -O0 -D_GNU_SOURCE -DAXIS2_GUTHTHILA_ENABLED -DAXIS2_SVR_MULTI_THREADED  -DAXIS2_JSON_ENABLED -Wno-unused-but-set-variable -MT axis2_json_reader.lo -MD -MP -MF .deps/axis2_json_reader.Tpo -c -o axis2_json_reader.lo `test -f 'json/axis2_json_reader.c' || echo './'`json/axis2_json_reader.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../../.. -I../../../../../include -I../../../../../src/core/engine -I../../../../../util/include -I../../../../../axiom/include -I/usr/include/json-c -D_LARGEFILE64_SOURCE -DAXIS2_GUTHTHILA_ENABLED -DAXIS2_SVR_MULTI_THREADED -DAXIS2_JSON_ENABLED -g -O2 -D_LARGEFILE64_SOURCE -ansi -Wall -Wno-implicit-function-declaration -g -O0 -D_GNU_SOURCE -DAXIS2_GUTHTHILA_ENABLED -DAXIS2_SVR_MULTI_THREADED -DAXIS2_JSON_ENABLED -Wno-unused-but-set-variable -MT axis2_json_reader.lo -MD -MP -MF .deps/axis2_json_reader.Tpo -c json/axis2_json_reader.c  -fPIC -DPIC -o .libs/axis2_json_reader.o
In file included from /usr/include/json-c/json.h:25:0,
                 from json/axis2_json_reader.c:22:
/usr/include/json-c/linkhash.h:344:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned'
 static _LH_INLINE unsigned long lh_get_hash(const struct lh_table *t, const void *k)
                   ^~~~~~~~
json/axis2_json_reader.c: In function 'json_tokener_error_to_str':
json/axis2_json_reader.c:35:5: warning: enumeration value 'json_tokener_error_size' not handled in switch [-Wswitch]
     switch (error)
     ^~~~~~
Makefile:422: recipe for target 'axis2_json_reader.lo' failed
make[4]: *** [axis2_json_reader.lo] Error 1
make[4]: Leaving directory '/axis/axis2c-unofficial/src/core/transport/http/util'
...

If I remove the offending "_LH_INLINE" and re-compile, it works. However, when I try to build the tests:

cd test
make
make[4]: *** No rule to make target '../../../../src/core/transport/http/common/libaxis2_http_common.la', needed by 'test_http_transport'.  Stop.

and indeed, there is no libaxis2_http_common.* anywhere in the system.

I believe it's better to remove -Werror from automakes instead of modifying something in /usr/include.

But it will not help, because of unknown symbol

/usr/include/json-c/linkhash.h:344:19: **error**: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned'
 static _LH_INLINE unsigned long lh_get_hash(const struct lh_table *t, const void *k)

Well, I just tried and it still works under Ubuntu 16.04 (I don't have another version). If you ready to patch, feel free to create pull request.

I believe libaxis2_http_common needs to be replaced with libaxis2_http_sender and libaxis2_http_receiver. If I do this, then I can compile the core/transport/http test and run it successfully.

Well, then you should check how it works in other OSes like MAC and Win..

Seems like the _LH_INLINE thing is a json-c problem. The http_common/sender/receiver thing under tests seems like a axis2/c issue.

By the way, if you have docker installed or available to you, then you can use this Dockerfile to test on any version of ubuntu:

FROM ubuntu:18.04
RUN apt-get update && \
    apt-get install -y p7zip-full automake autoconf libtool pkg-config mercurial git wget
RUN mkdir /axis
WORKDIR /axis
RUN wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/axis2c-unofficial/axis2c-unofficial-src-0e7108ceb231.7z
RUN 7z x axis2c-unofficial-src-0e7108ceb231.7z
RUN git clone https://github.com/json-c/json-c.git

ENV AXIS2C_HOME /usr

RUN cd json-c && \
    ./autogen.sh && \
    ./configure --prefix=$AXIS2C_HOME && \
    make -j8 && make install

RUN cd axis2c-unofficial/ && \
    ./configure --prefix=$AXIS2C_HOME --enable-json && \
    make -j8 && make install

# (cd /usr/bin; ./axis2_http_server)
# http://localhost:9090/axis2/services

Then just:

docker build -t axis .
docker run --rm -it -p 9090:9090 axis bash
ls
...

Still fails for me on 16.04. Using this recipe (docker):

FROM ubuntu:16.04
RUN apt-get update && \
    apt-get install -y p7zip-full automake autoconf libtool pkg-config mercurial git wget curl

# For libcurl
RUN apt-get install -y openssl libssl-dev libz-dev libcurl4-openssl-dev

RUN mkdir /axis
WORKDIR /axis
RUN wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/axis2c-unofficial/axis2c-unofficial-src-0e7108ceb231.7z
RUN 7z x axis2c-unofficial-src-0e7108ceb231.7z
RUN git clone https://github.com/json-c/json-c.git

ENV AXIS2C_HOME /usr

RUN cd json-c && \
    ./autogen.sh && \
    ./configure --prefix=$AXIS2C_HOME && \
    make -j8 && make install

RUN cd axis2c-unofficial/ && \
    ./configure --prefix=$AXIS2C_HOME --enable-json --enable-libcurl && \
    make -j8 && make install

# (cd /usr/bin; ./axis2_http_server)
# http://localhost:9090/axis2/services

Same issue with json-c:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../../.. -I../../../../../include -I../../../../../src/core/engine -I../../../../../util/include -I../../../../../axiom/include -I/usr/include/json-c -D_LARGEFILE64_SOURCE -DAXIS2_GUTHTHILA_ENABLED -DAXIS2_SVR_MULTI_THREADED -DAXIS2_LIBCURL_ENABLED -DAXIS2_JSON_ENABLED -g -O2 -D_LARGEFILE64_SOURCE -ansi -Wall -Wno-implicit-function-declaration -g -O0 -D_GNU_SOURCE -DAXIS2_GUTHTHILA_ENABLED -DAXIS2_SVR_MULTI_THREADED -DAXIS2_LIBCURL_ENABLED -DAXIS2_JSON_ENABLED -Wno-unused-but-set-variable -MT axis2_json_reader.lo -MD -MP -MF .deps/axis2_json_reader.Tpo -c json/axis2_json_reader.c  -fPIC -DPIC -o .libs/axis2_json_reader.o
In file included from /usr/include/json-c/json.h:25:0,
                 from json/axis2_json_reader.c:22:
/usr/include/json-c/linkhash.h:344:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'unsigned'
 static _LH_INLINE unsigned long lh_get_hash(const struct lh_table *t, const void *k)
                   ^
json/axis2_json_reader.c: In function 'json_tokener_error_to_str':
json/axis2_json_reader.c:35:5: warning: enumeration value 'json_tokener_error_size' not handled in switch [-Wswitch]
     switch (error)
     ^
make[4]: *** [axis2_json_reader.lo] Error 1

I have libjson-c-dev version 0.11-4ubuntu2.

The instructions say to git-clone it...

Can you post the header file: /usr/include/json-c/linkhash.h

The instructions say to git-clone it...

Yes, in the time of writing instruction it was true. But now you just have to install it from apt.

linkhash.h.txt

The apt version is 0.11 and the git-clone version is 0.13. I have confirmed that 0.11 works. Or at least I can get a clean compile. If I make the common vs. sender/receiver change then the test directory compiles and the core/transport/http test passes.