在Solaris 10中以SPARC计算机(64位)错误编译Apache 2.4.6

时间:2013-11-11 08:44:31

标签: apache sparc solaris-10

我从上周一开始在SPARC机器上编译Solaris 10中的Httpd 2.4.6。我得到一些错误,我不知道如何解决。

根据这篇文章,我已经在Solaris 10 x86中成功编译了Httpd 2.4.6: Compile Apache 2.4.2 in Solaris 10 in a x86 machine (64bits) errors

我尝试了几个编译器标志,这些标志因不同的错误而失败。 以下是我进行构建的步骤:

export PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/xpg4/bin:/usr/sfw/bin:/usr/sfw/sbin:/usr/ccs/bin
#export LDFLAGS=" -L/usr/sfw/lib -R/usr/sfw/lib -L/usr/X/lib -R/usr/X/lib -L/usr/X11/lib -R/usr/X11/lib -L/usr/ccs/lib -R/usr/ccs/lib "
#export LDFLAGS="-L/usr/sfw/lib/sparcv9 -L/usr/lib/sparcv9 -L/usr/sfw/lib -R/usr/sfw/lib -L/usr/X/lib -R/usr/X/lib -L/usr/X11/lib -R/usr/X11/lib -L/usr/ccs/lib -R/usr/ccs/lib "
#export LDFLAGS="-L/usr/local/lib -R/usr/local/lib -R/usr/lib -L/usr/lib -R/usr/openwin/lib -L/usr/openwin/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/BerkeleyDB.4.2/lib -R/usr/local/BerkeleyDB.4.2/lib -L/usr/sfw/lib/sparcv9 -L/usr/lib/sparcv9 -L/usr/sfw/lib -R/usr/sfw/lib -L/usr/X/lib -R/usr/X/lib -L/usr/X11/lib -R/usr/X11/lib -L/usr/ccs/lib -R/usr/ccs/lib "
#export LD_LIBRARY_PATH=/usr/lib:/usr/sfw/lib
#export LD_LIBRARY_PATH_64=/usr/lib/64:/usr/sfw/lib/64
#Dont use CC, use GCC! This is VERY important. It wont work otherwise!!
export CC=gcc
#export CFLAGS="-m64 -O3"
export CFLAGS="-m64 -O2 -L/usr/local/lib -R/usr/local/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/openwin/lib -R/usr/openwin/lib -I/usr/local/rrdtool-1.2.19/include -I/usr/local/BerkeleyDB.4.7/include -I/usr/local/include/cairo"
export CPPFLAGS="-m64 -I/usr/local/include -I/usr/local/ssl/include -I/usr/local/include/ncurses -I/usr/openwin/include -I/usr/local/rrdtool-1.2.19/include -I/usr/local/BerkeleyDB.4.7/include -I/usr/local/include/lzo"
export LDFLAGS="-L/usr/local/lib -R/usr/local/lib -R/usr/lib -L/usr/lib -R/usr/openwin/lib -L/usr/openwin/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/X11R6/lib -R/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.7/lib -R/usr/local/BerkeleyDB.4.7/lib"
#export CFLAGS=” -O2 -mcpu=v9 -m64″
#export CPP_FLAGS="-m64 -O3"
#export CPP_FLAGS="-m64 -O3 -I/usr/sfw/include -I/usr/local/include -I/usr/local/ssl/include -I/usr/local/include/ncurses -I/usr/local/BerkeleyDB.4.2/include -I/usr/openwin/include"
#export CPP_FLAGS="-I/usr/sfw/include"
#export CXX_FLAGS="-m64 -O3"

bzip2 -dc apr-1.4.8.tar.bz2 | tar xf -
bzip2 -dc apr-util-1.5.2.tar.bz2 | tar xf -
bzip2 -dc httpd-2.4.6.tar.bz2.tar.bz2.tar.bz2 | tar xf -
mv apr-util-1.5.2/ httpd-2.4.6/srclib/apr-util
mv apr-1.4.8/ httpd-2.4.6/srclib/apr


gzip -dc m4-1.4.17.tar.gz | tar xf -
cd m4-1.4.17
./configure --prefix=/opt/cmtools/m4-1.4.17
gmake
gmake install
gmake clean

gzip -dc autoconf-2.69.tar.gz | tar xf -
cd autoconf-2.69
./configure --prefix=/opt/cmtools/autoconf-2.69 M4=/opt/cmtools/m4-1.4.17/bin/m4
gmake
gmake install
gmake clean


gzip -dc automake-1.13.2.tar.gz | tar xf -
cd automake-1.13.2 
./configure --prefix=/opt/cmtools/automake-1.13.2 PATH=/opt/cmtools/autoconf-2.69/bin:$PATH
gmake
gmake install
gmake clean


bzip2 -dc pcre-8.33.tar.bz2 | tar xf -
cd pcre-8.33/
./configure --disable-cpp CFLAGS="-g -O3" CC="gcc -m64" --prefix=/usr/local/pcre 
gmake
gmake install
gmake clean


gzip -dc openssl-1.0.1e.tar.gz | tar xf -
cd openssl-1.0.1e
./config --prefix=/usr/local/ssl shared -m32
gmake
gmake install
gmake clean


bzip2 -dc binutils-2.23.2.tar.bz2.tar.bz2.tar.bz2 | tar xf -
cd binutils-2.23.2
./configure --prefix=/opt/cmtools/binutils-2.23.2
gmake
gmake install
gmake clean

cd httpd-2.4.6

./configure --prefix=/usr/local/apache2 \
--enable-mods-shared=all \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http \
--enable-ssl=shared \
--enable-ssl \
--with-ssl=/usr/local/ssl \
--with-mpm=prefork --with-pcre=/usr/local/pcre \
-with-included-apr 

gmake
gmake install
gmake clean

尝试使用不同的编译标志时遇到的主要错误是:

ld: fatal: file /usr/local/lib/libpcre.so: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to .libs/httpd
collect2: ld returned 1 exit status
gmake[1]: *** [httpd] Error 1
gmake[1]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6'
gmake: *** [all-recursive] Error 1

ld: fatal: file /usr/local/ssl/lib/libssl.so: wrong ELF class: ELFCLASS32
ld: fatal: file /usr/local/ssl/lib/libcrypto.so: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to .libs/ab
collect2: ld returned 1 exit status
gmake[2]: *** [ab] Error 1
gmake[2]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake: *** [all-recursive] Error 1

Undefined                       first referenced
 symbol                             in file
TLSv1_2_client_method               ab.o
TLSv1_1_client_method               ab.o
BIO_set_callback                    ab.o
BIO_set_callback_arg                ab.o
BIO_get_callback_arg                ab.o
SSL_CTX_set_info_callback           ab.o
ld: fatal: Symbol referencing errors. No output written to .libs/ab
collect2: ld returned 1 exit status
gmake[2]: *** [ab] Error 1
gmake[2]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/opt/cmtools/soft/httpd-2.4.6/support'
gmake: *** [all-recursive] Error 1

以下是系统信息:

bash-3.00# uname -a
SunOS hegel 5.10 Generic_142909-17 sun4v sparc SUNW,SPARC-Enterprise-T5120
bash-3.00# cat /etc/release 
                   Oracle Solaris 10 9/10 s10s_u9wos_14a SPARC
     Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
                            Assembled 11 August 2010
bash-3.00# isainfo -b
64

赞赏任何线索。 感谢。

1 个答案:

答案 0 :(得分:3)

您正在将PCRE构建为64位库(“-m64”),但尝试将OpenSSL构建为32位库(“-m32”)并链接该PCRE。那不行。

尝试将OpenSSL构建为64位。

您可能会发现需要编辑OpenSSL“Configure”文件以调整用于硬件和编译器组合的编译器标志。例如,如果使用Sun Studio编译器在Solaris x86上构建,则Configure脚本包含“-fast”编译器标志。我发现当你在带有AMD处理器的盒子上构建时,这会让你感到很痛苦,但是计划在带有Intel处理器的盒子上使用代码:“ - fast”标志为你的编译盒启用所有适用的优化,包括东西喜欢AMD 3DNow!扩展。最好在运行之前编辑配置文件,并将“-fast”替换为对于您的最低公分母英特尔系统而言合理的体系结构优化。 OpenSSL使用一个不常见的配置脚本,忽略CFLAGS等常用环境变量,因此偶尔需要编辑配置。

另外,不要试图用OpenSSL做并行make(“gmake -j n ”)。由OpenSSL的Configure生成的Makefile不是并行安全的,它不会构建。