http://spdylay.sourceforge.net/
[ install Spdylay C library on Ubuntu 12.04 ]
root@ubuntu12-04-vm1:~# tail -1 /etc/lsb-release DISTRIB_DESCRIPTION="Ubuntu 12.04.1 LTS" root@ubuntu12-04-vm1:~# uname -ri 3.5.0-030500-generic x86_64 |
install required packages for spdylay.
# apt-get install -y autoconf pkg-config libcunit1 libcunit1-dev libxml2 libxml2-dev libevent-openssl-2.0-5 libssl-dev automake autotools-dev libtool libevent-dev make gcc g++ -y |
download spdylay-0.3.3.tar.bz2 from http://sourceforge.net/projects/spdylay/files/stable/
# bunzip2 spdylay-0.3.3.tar.bz2 # tar xvf spdylay-0.3.3.tar # cd spdylay-0.3.3 |
build
# autoreconf -i libtoolize: `./config.sub' is newer: use `--force' to overwrite libtoolize: `./install-sh' is newer: use `--force' to overwrite # automake # autoconf # ./configure configure: summary of build options: Version: 0.3.3 shared 3:0:2 Host type: x86_64-unknown-linux-gnu Install prefix: /usr/local C compiler: gcc CFLAGS: -g -O2 LDFLAGS: LIBS: -lz -ldl CPPFLAGS: C preprocessor: gcc -E C++ compiler: g++ CXXFLAGS: -g -O2 CXXCPP: g++ -E Library types: Shared=yes, Static=yes CUnit: yes OpenSSL: yes Libxml2: yes Libevent(SSL): yes Examples: yes # make |
There are sample codes of spdy client ( spdycat ) and server ( spdyd ) under examples directory.
# pwd /home/hattori/spdylay-0.3.3/examples |
# ./spdycat -snv https://www.google.com [ 0.291] NPN select next protocol: the remote server offers: * spdy/3 * spdy/2 * http/1.1 NPN selected the protocol: spdy/3 [ 0.300] recv SETTINGS frame <version=3, flags=0, length=20> (niv=2) [4(1):100] [7(0):65536] [ 0.301] send SYN_STREAM frame <version=3, flags=1, length=106> (stream_id=1, assoc_stream_id=0, pri=3) :host: www.google.com :method: GET :path: / :scheme: https :version: HTTP/1.1 accept: */* user-agent: spdylay/0.3.3 [ 0.355] recv SYN_REPLY frame <version=3, flags=0, length=542> (stream_id=1) :status: 200 OK :version: HTTP/1.1 cache-control: private, max-age=0 content-type: text/html; charset=ISO-8859-1 date: Tue, 01 Sep 2012 06:42:49 GMT expires: -1 p3p: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info." server: gws set-cookie: PREF=ID=258a9df3fdee5cd6:FF=0:TM=1346740969:LM=1346740969:S=zzz; expires=Thu, 01-Sep-2014 06:42:49 GMT; path=/; domain=.google.com set-cookie: NID=63=zzzz; expires=Wed, 06-Mar-2013 06:42:49 GMT; path=/; domain=.google.com; HttpOnly x-frame-options: SAMEORIGIN x-xss-protection: 1; mode=block [ 0.358] recv DATA frame (stream_id=1, flags=0, length=4096) [ 0.358] recv DATA frame (stream_id=1, flags=0, length=2569) [ 0.358] recv DATA frame (stream_id=1, flags=0, length=1527) [ 0.360] recv DATA frame (stream_id=1, flags=1, length=2800) [ 0.360] send GOAWAY frame <version=3, flags=0, length=8> (last_good_stream_id=0) ***** Statistics ***** #1: https://www.google.com/ Status: 200 OK Delta (ms) from SSL/TLS handshake(SYN_STREAM): SYN_REPLY: 55(54) Completed: 60(59) |
[ install spdylay python extension module on ubuntu 12.04 ]
Before installing python spdylay module , you need to build spdylay C library.
# python --version Python 2.7.3 |
install required packages
# apt-get install cython python-bitarray |
# pwd /home/hattori/spdylay-0.3.3/python # cython spdylay.pyx |
error..
# python setup.py build_ext running build_ext building 'spdylay' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c spdylay.c -o build/temp.linux-x86_64-2.7/spdylay.o spdylay.c:4:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 # |
# apt-get install python-dev -y |
try again .. error
# python setup.py build_ext running build_ext building 'spdylay' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c spdylay.c -o build/temp.linux-x86_64-2.7/spdylay.o spdylay.c:236:29: fatal error: spdylay/spdylay.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 |
copy spdylay.h into /usr/local/include/spdylay directory
# cp /home/hattori/spdylay-0.3.3/lib/includes/spdylay/* /usr/local/include/spdylay/ |
try ,, error
# python setup.py build_ext gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64- 2.7/spdylay.o -lspdylay -o build/lib.linux-x86_64-2.7/spdylay.so /usr/bin/ld: cannot find -lspdylay collect2: ld returned 1 exit status error: command 'gcc' failed with exit status |
copy library files under /home/hattori/spdylay-0.3.3/lib/.libs into /usr/lib directory
# ls /home/hattori/spdylay-0.3.3/lib/.libs/* /home/hattori/spdylay-0.3.3/lib/.libs/libspdylay.a /home/hattori/spdylay-0.3.3/lib/.libs/libspdylay.la /home/hattori/spdylay-0.3.3/lib/.libs/libspdylay.lai /home/hattori/spdylay-0.3.3/lib/.libs/libspdylay.so /home/hattori/spdylay-0.3.3/lib/.libs/libspdylay.so.1 /home/hattori/spdylay-0.3.3/lib/.libs/libspdylay.so.1.2.0 <snip> |
copy
# cp /home/hattori/spdylay-0.3.3/lib/.libs/* /usr/lib/ |
try. okay
# python setup.py build_ext # python setup.py install running install running build running build_ext running install_lib copying build/lib.linux-x86_64-2.7/spdylay.so -> /usr/local/lib/python2.7/dist-packages running install_egg_info Writing /usr/local/lib/python2.7/dist-packages/python_spdylay-0.1.1.egg-info |
# python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> import spdylay >>> >>> |
OMG ,,, to use spdylay for python , I need to use python 3.3 or later…
I should have read the README file…
I’ll try this next time..
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.