tatsuhiro-t / spdylay

The experimental SPDY protocol version 2, 3 and 3.1 implementation in C
http://tatsuhiro-t.github.io/spdylay/
MIT License
604 stars 102 forks source link

libevent failed #118

Open zshliao opened 9 years ago

zshliao commented 9 years ago

Hi I was following your instruction but it keeps failing when I tried to make install libevent (type.h was missing).. Is there any good instructions on how to install libevent? Also I'm wondering if you are willing to share the shrpx binary file?

zshliao commented 9 years ago

when I ran ./android-make i got following errors:

/home/zisheng/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: http-parser/http_parser.o: incompatible target /home/zisheng/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: spdycat.o: in function spdylay::update_htmlparser(spdylay::SpdySession, spdylay::Request, unsigned char const, unsigned int, int):spdycat.cc:407: error: undefined reference to 'http_parser_parseurl' /home/zisheng/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: spdycat.o: in function spdylay::run(char*, int):spdycat.cc:883: error: undefined reference to 'http_parser_parse_url'

tatsuhiro-t commented 9 years ago

It looks like http_parser.o was compiled targeted for unexpected architecture. Please first run make clean and re-run ./android-make again.

zshliao commented 9 years ago

Thank you so much for the reply now the compilation works.. But I did not see the shrpx binary under src folder, did i miss something there?

tatsuhiro-t commented 9 years ago

Iibevent may not be detected by configure script (./android-config for NDK). Configuring libevent is very similar to spdylay since libevent uses autotools too. I think following would work for libevent:

$ ./configure
    --disable-shared \
    --host=arm-linux-androideabi \
    --prefix=$ANDROID_HOME/usr/local
    CPPFLAGS="-I$ANDROID_HOME/usr/local/include" \
    LDFLAGS="-L$ANDROID_HOME/usr/local/lib"

And build libevent:

$ PATH=$ANDROID_HOME/toolchain/bin:$PATH make
zshliao commented 9 years ago

Thanks for the reply.. I used your command to configure the build system for libevent however it does not recognize the siable-shared option ./libevent.sh: 4: ./libevent.sh: --disable-shared: not found We are using the source from http://libevent.org/ libevent-2.0.21-stable Any help on how to solve this issue would be greatly appreciated.. Thanks

tatsuhiro-t commented 9 years ago

Some formatting mistake in configure cmd line. It should be read as:

$ ./configure \
    --disable-shared \
    --host=arm-linux-androideabi \
    --prefix=$ANDROID_HOME/usr/local \
    CPPFLAGS="-I$ANDROID_HOME/usr/local/include" \
    LDFLAGS="-L$ANDROID_HOME/usr/local/lib"
zshliao commented 9 years ago

Awesome! Thank you so much for that now libevent is built and detected by ./android-config

but running ./android-make still gives one erorr:

/home/zisheng/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lrt collect2: ld returned 1 exit status make[2]: * [spdycat] Error 1 make[2]: Leaving directory `/home/zisheng/spdylay-1.2.5/src' make[1]: * [all-recursive] Error 1 make[1]: Leaving directory`/home/zisheng/spdylay-1.2.5' make: *\ [all] Error 2

This is the summary of configuration:

configure: summary of build options:

Version:        1.2.5 shared 7:3:0
Host type:      arm-unknown-linux-androideabi
Install prefix: /usr/local
C compiler:     arm-linux-androideabi-gcc
CFLAGS:         -g -O2
LDFLAGS:        -L/home/zisheng//usr/local/lib
LIBS:           -lz 
CPPFLAGS:       -I/home/zisheng//usr/local/include
C preprocessor: arm-linux-androideabi-gcc -E
C++ compiler:   arm-linux-androideabi-g++
CXXFLAGS:       -g -O2
CXXCPP:         arm-linux-androideabi-g++ -E
Library types:  Shared=no, Static=yes
CUnit:          no
OpenSSL:        yes
Libxml2:        no
Libevent(SSL):  yes
Src:            yes
Examples:       yes

Not sure what I missed at this point.

Thank you very much in advance.

tatsuhiro-t commented 9 years ago

We use android NDK r9d gcc 4.8 and it compiles spdylay fine. No error related to -lrt.

tatsuhiro-t commented 9 years ago

Please check out this article if you haven't: http://tatsuhiro-t.github.io/spdylay/android-spdy-proxy.html