Build, install & configure mod_spdy

https://code.google.com/p/mod-spdy/wiki/GettingStarted
chrome://net-internals/#spdy
https://svn.apache.org/viewvc/httpd/mod_spdy/trunk/

#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here.
#Before starting do declare the environment variables specified to the link above.

#When depot_tools is already updated than run once:
cd /ffp/home/root/compile/depot_tools
~/x.sh ffpg

export PATH=$PATH:/ffp/home/root/compile/depot_tools/
export GIT_SSL_NO_VERIFY=true

cd ~/compile
rm -r ~/compile/mod_spdy
cd ~/compile && mkdir mod_spdy
cd ~/compile/mod_spdy
#gclient config "http://mod-spdy.googlecode.com/svn/tags/current/src"
gclient config "http://mod-spdy.googlecode.com/svn/trunk/src"
gclient sync --force

#ERROR1:
	KeyError: 'Undefined variable deb_arch in /usr/local/zy-pkgs/ffproot/ffp/home/root/compile/mod_spdy/src/build/install.gyp while loading dependencies
#SOLUTION1:
	modify /ffp/home/root/compile/mod_spdy/src/build/install.gyp:
        'conditions': [				-> existing line
          ['target_arch=="ia32"', {	-> existing line
            'deb_arch': 'i386',		-> existing line
            'rpm_arch': 'i386',		-> existing line
          }],						-> existing line
		  ['target_arch=="arm"', {
			'deb_arch': 'ia32',
			'rpm_arch': 'ia32',
		  }],

#ERROR2:
	third_party/chromium/src/base/debug/debugger_posix.cc:21:22: fatal error: execinfo.h: No such file or directory
	 #include <execinfo.h>
	compilation terminated.
	make: *** [out/Release/obj.target/base/third_party/chromium/src/base/debug/debugger_posix.o] Error 1
#SOLUTION2:
	Comment (# character too) any include of execinfo.h (stack_trace_posix.cc, debugger_posix.cc).
	sed -i s/"#include <execinfo.h"/"\/\/#include <execinfo.h"/ third_party/chromium/src/base/debug/stack_trace_posix.cc
	sed -i s/"#include <execinfo.h"/"\/\/#include <execinfo.h"/ third_party/chromium/src/base/debug/debugger_posix.cc
	sed -i s/"#include <execinfo.h"/"\/\/#include <execinfo.h"/ third_party/chromium/src/base/sys_info_chromeos.cc

#ERROR3:
	third_party/chromium/src/base/debug/stack_trace_posix.cc:159:56: error: 'backtrace' was not declared in this scope
	   count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);
	make: *** [out/Release/obj.target/base/third_party/chromium/src/base/debug/stack_trace_posix.o] Error 1
#SOLUTION3:
	Modify /ffp/home/root/compile/mod_spdy/src/third_party/chromium/src/base/debug/stack_trace_posix.cc 
	by commenting lines using backtrace. At this moment (13 Feb 2015) the below are the parts that need commenting.
	Modify /ffp/home/root/compile/mod_spdy/src/third_party/chromium/src/base/debug/stack_trace_posix.cc (comment lines):
	//  count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);		-> commented line
	count_ = 0;								-> added line
	Modify /ffp/home/root/compile/mod_spdy/src/third_party/chromium/src/base/debug/stack_trace_posix.cc (comment lines):
	//  if (in_signal_handler == 0) {
	//    scoped_ptr_malloc<char*> trace_symbols(backtrace_symbols(trace, size));
	//    if (trace_symbols.get()) {
	//      for (int i = 0; i < size; ++i) {
	//        std::string trace_symbol = trace_symbols.get()[i];
	//        DemangleSymbols(&trace_symbol);
	//        handler->HandleOutput(trace_symbol.c_str());
	//        handler->HandleOutput("\n");
	//      }
	//
	//      printed = true;
	//    }
	//  }

#ERROR4 (other similar errors occur and all have a similar solution):
	CC(target) out/Release/obj.target/dynamic_annotations/third_party/chromium/src/base/third_party/dynamic_annotations/dynamic_annotations.o
	third_party/chromium/src/base/third_party/dynamic_annotations/dynamic_annotations.c:35:20: fatal error: stdlib.h: No such file or directory
#SOLUTION4:
	grep -r dynamic_annotations.o .
	#result of grep:
	./third_party/chromium/src/base/third_party/dynamic_annotations/dynamic_annotations.host.mk:146:
		$(obj).host/$(TARGET)/third_party/chromium/src/base/third_party/dynamic_annotations/dynamic_annotations.o
	./third_party/chromium/src/base/third_party/dynamic_annotations/dynamic_annotations.target.mk:160:
		$(obj).target/$(TARGET)/third_party/chromium/src/base/third_party/dynamic_annotations/dynamic_annotations.o
	#modify dynamic_annotations. ... .mk
	INCS_Release := \
		... \
		-I/ffp/include

#ERROR5:
	Something about not supporting sysroot.
#SOLUTION5:
	find . -type f -name *.mk -exec sed -i s/"\-\-sysroot=\/usr\/local\/zy-pkgs\/ffproot\/ffp\/home\/root\/compile\/mod_spdy\/src\/arm-sysroot"/""/g {} \;

#BULDING
export CFLAGS="$CFLAGS -Wno-error"
export CPPFLAGS="$CPPFLAGS -Wno-error"
export CXXFLAGS="$CXXFLAGS -Wno-error"
cd ~/compile/mod_spdy/src
#see http://adrhc.go.ro/public/mod_spdy-patch.sh
/i-data/md0/www/pages/public/mod_spdy-patch.sh
#./build_modssl_with_npn.sh --insecure -> instead of this do compile apache with npn patch applied
nohup make BUILDTYPE=Release &
renice -14 `pidof cc1plus` -p `pidof make` -p `pidof as`
tail -f nohup.out

#INSTALL & configure apache
cp -v out/Release/libmod_spdy.so /ffp/opt/apache-2.2.29-worker/modules/mod_spdy.so
#LoadModule	spdy_module		/ffp/opt/apache-2.2.29-worker/modules/mod_spdy.so
#SpdyEnabled on
#Open another tab and navigate to chrome://net-internals/#spdy, and verify that your hostname appears in the table.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.