I needed to make apache with some configurations by myself, but I couldn't find how to make it for ARM processor... So I needed to search for the way by myself, and found it. Then I'll share that.
How to do that?
Very simple. Replace some lines with using qemu-arm-static
on makefiles for apr and apache like the following sample.
If you have a trouble of making apache for ARM, try this approach.
makefile sample
HOST_PREFIX ?= x86_64-linux-gnu
CROSS_PREFIX ?= arm-linux-gnueabihf
LD_ROOT_PATH ?= /usr/local/$(CROSS_PREFIX)-4.8/$(CROSS_PREFIX)
URL_APACHE ?= http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.4.20.tar.gz
URL_APR ?= http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/apr/apr-1.5.2.tar.gz
URL_APRUTIL ?= http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/apr/apr-util-1.5.4.tar.gz
DIR_INSTALL ?= /var/tmp/apache
DIR_APACHE = $(basename $(basename $(notdir $(URL_APACHE))))
DIR_APR = $(DIR_APACHE)/srclib/apr
DIR_APRUTIL = $(DIR_APACHE)/srclib/apr-util
$(DIR_APACHE)/Makefile:$(notdir $(URL_APACHE)) $(TARGET_OPENSSL) $(TARGET_EXPAT) $(TARGET_PCRE) $(TARGET_ZLIB)
@+$(MAKE) -s $(TARGET_APR_UTIL) $(TARGET_APR)
cd $(DIR_APACHE); ?
./configure ... ?
--with-dbm=sdbm --with-berkeley-db=no ?
--with-gdbm=no --with-ndbm=no ?
--with-suexec-userdir=/usr ?
--with-ssl=$(DIR_INSTALL) ?
--with-expat=$(DIR_INSTALL) ?
--with-pcre=$(DIR_INSTALL) ?
--with-z=$(DIR_INSTALL) ?
--build=$(HOST_PREFIX) ?
--host=$(CROSS_PREFIX) ?
--target=$(CROSS_PREFIX)
ifeq ($(findstring arm,$(CROSS_PREFIX)),arm)
cd $(DIR_APR); ?
cp -f Makefile Makefile.org; ?
sed -e 's;tools/gen_test_char >;qemu-arm-static -L $(LD_ROOT_PATH)/libc tools/gen_test_char >;g' ?
Makefile.org > Makefile
cd $(DIR_APACHE); ?
cp -f server/Makefile server/Makefile.org; ?
sed -e 's;?./gen_test_char > ;qemu-arm-static -L $(LD_ROOT_PATH)/libc ./gen_test_char > ;g' server/Makefile.org > server/Makefile; ?
cp -f support/Makefile support/Makefile.org; ?
sed -e 's;PROGRAM_DEPENDENCIES = ;PROGRAM_DEPENDENCIES = -pthread;g' support/Makefile.org > support/Makefile
endif
What's this approach?
Apache has some tools which should be run on host machine (x86) if cross-compiling, so the make rule of tools for host machine (x86) needs to be separated from lib/binary for target (ARM).
On the other hand, my approach is very simple. All of the related files for apache is built for ARM, and some of tools which should be run on x86 are run with qemu.
So you need to modify just a line on makefile for both apache and apr to use qemu-arm-static.
zlib for ARM
under writing..
expat for ARM
under writing..
pcre for ARM
under writing..
SSL library for ARM
under writing..
fix pthread related errors
I encountered some errors related to pthread. These errors didn't raised when making for x86...
You can fix it by adding -pthread
to PROGRAM_DEPENDENCIES
on apache makefile like following.
cd $(DIR_APACHE); ?
cp -f server/Makefile server/Makefile.org; ?
sed -e 's;?./gen_test_char > ;qemu-arm-static -L $(LD_ROOT_PATH)/libc ./gen_test_char > ;g' server/Makefile.org > server/Makefile; ?
cp -f support/Makefile support/Makefile.org; ?
sed -e 's;PROGRAM_DEPENDENCIES = ;PROGRAM_DEPENDENCIES = -pthread;g' support/Makefile.org > support/Makefile