loentar / axis2c-unofficial

Unofficial backports and unofficial support for Apache Axis2/C
Apache License 2.0
15 stars 10 forks source link

compile --enable-json fails #22

Open peebles opened 5 years ago

peebles commented 5 years ago

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'
...
peebles commented 5 years ago

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.

loentar commented 5 years ago

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

peebles commented 5 years ago
/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)
loentar commented 5 years ago

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.

peebles commented 5 years ago

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.

loentar commented 5 years ago

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

peebles commented 5 years ago

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.

peebles commented 5 years ago

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
...
peebles commented 5 years ago

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
loentar commented 5 years ago

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

peebles commented 5 years ago

The instructions say to git-clone it...

peebles commented 5 years ago

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

loentar commented 5 years ago

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

peebles commented 5 years ago

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.