2

从上周一开始,我一直在 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) 错误

我尝试了几个编译器标志,但都因不同的错误而失败。以下是我如何构建的步骤:

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

感谢任何线程。谢谢。

4

1 回答 1

3

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

尝试将 OpenSSL 构建为 64 位。

您可能会发现您需要编辑 OpenSSL“配置”文件以调整用于您的硬件和编译器组合的编译器标志。例如,如果使用 Sun Studio 编译器在 Solaris x86 上构建,则配置脚本包含“-fast”编译器标志。我发现当您在带有 AMD 处理器的机器上构建时,这会伤害您,但计划在带有 Intel 处理器的机器上使用代码:“-fast”标志为您的编译器启用所有适用的优化,包括事情像 AMD 3DNow!扩展名。最好在运行之前编辑配置文件,并在这种情况下将“-fast”替换为适合您的最低公分母英特尔系统的架构优化。

此外,不要试图使用 OpenSSL进行并行制作(“gmake -j n ”)。OpenSSL 的 Configure 生成的 Makefile 不是并行安全的,并且不会构建。

于 2014-03-05T19:59:51.777 回答