图片 2

在Linux系统中安装LAMP出现的错误总结,0具体问题总结及原因分析

1.编译环境错误:

总结一下用源代码安装LAMP环境中遇到常见的错误,从错误3开始是因为安装php后面带参数,导到没有找到开发包例如:./configure
–with-gd  –with-libjpeg会出现如下错误。

转:

Ubuntu
10.04下仅预装了gcc编译环境,但安装此套环境的源码包还需要g++(即c++)的编译环境,需要安装g++软件,但这两者的版本需要同步,否则安装会出错,比较好的解决方案是使用如下的命令:

1.checking for termcap functions library… configure: error: No
curses/termcap library found
      解决方法:yum install ncurses      –缺少ncurses安装包

sudo apt-get install build-essential

2.1)安装gd库出现以下错误:
    In file included from /root/php-5.3.6/ext/gd/libgd/gd_compat.c:8:
    /usr/local/jpeg/include/jpeglib.h:938: error: expected declaration
specifiers or ‘…’ before ‘FILE’
    /usr/local/jpeg/include/jpeglib.h:939: error: expected declaration
specifiers or ‘…’ before ‘FILE’
    make: *** [ext/gd/libgd/gd_compat.lo] Error 1

来安装整套编译环境的套装软件(因为单独安装gcc与g++可能引发两者的版本不同步),装好后,编译环境即配置完成

          解决方法:vim  php-5.3.6/ext/gd/libgd/gd_compat.c
                        #include <png.h>    –修改为#include
</usr/local/libpng/include/png.h>
                        #include <stdio.h>  –添加这行

 

 

  1. Configure: error: xml2-config not found. Please check your libxml2
    installation.

 

2.编译libxml2时出错:

Solutions :

 

错误信息如下图:

解决方法:yum install libxml2 libxml2-devel

Briefly,
the shell commands `./configure; make; make install’ should
configure,
build, and install this package. 
Tell
me:
configure
== configure
make ==
build
make
install == install

图片 1

  1. Configure: error: Please reinstall the BZip2 distribution

序:
我这几天编译Qtopia时积累了一些小经验,把编译错误大致分为三类错误:一、因环境变量不起作用及权限不足而导致
二、因缺少类库或安装包不全而导致 三、源代码问题函数错误而导致。
由于编译器版本太高,造成编译Qtopia-2.2.0时,出错很多,但是也只有这样才能够学习到东西,锻炼分析问题,解决问题的能力.但是如果为了节约时间,强烈推荐使用低版本的编译器。
以下为编译x86-qtopia-2.2.0得出经验,编译arm-qtopia-2.2.0时出现的编译错误也可以参考一下对对应内容自行修改。

解决方法:

Solutions :

编译前提:
OS:ubuntu
10.10
GCC:4.3.3
DB:ARM9-TQ2440
SourceCode:Qtopia-2.2.0

打开目录下的nanohttp.c,第1588行由 
fd = open(filename, O_CREAT | O_WRONLY);更换为 
fd = open(filename, O_CREAT | O_WRONLY,0777);

解决方法:yum install bzip2 bzip2-devel

首先安装EABI并设置交叉编译器的环境变量:
1、打开环境变量设置文件environment
zyx@zyx:~$ sudo
gedit /etc/environment
2、在其中添加”:/opt/EmbedSky/4.3.3/bin”,修改后为
PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/EmbedSky/4.3.3/bin”
3、使修改后的环境变量生效
zyx@zyx:~$ sudo
source /etc/environment

网上查了一下,说该错误是由于gcc-4.3对语法检查严格所产生的错误

  1. Configure: error: libjpeg.(also) not found.

一、因环境变量不起作用及权限不足出现编译错误的解决办法:
1.编译错误:
zyx@zyx:~$ sudo
./x86-qtopia-2.2.0-konqueror_build
the qpe
program is already !
the
konqueror directory is already !
Build
konqueror , please wait …

3.zlib库的解压错误:

Solutions :

.:
46: setQpeEnv: not found

如使用tar命令解压zlib包出错且确认该包是完整的,请使用其他的图形化解压软件[甚至可以用windows下的winrar]先解压此包,然后将解压得到的文件夹复制过去再进行编译安装即可.

解决方法:yum install libjpeg libjpeg-devel

原因:配置环境没有起作用。

4.编译autoconf时出现error:
GNU M4 1.4 is required: 

6.Configure: error: libpng.(also) not found.

解决办法:
在x86-qtopia-2.2.0-konqueror_build编译脚本配置文件中
第26行
.setQpeEnv
改成
./setQpeEnv 
重新编译
若不起作用
继续改成 
source ./x86-qtopia-2.2.0/setQpeEnv
重新编译
若仍不起作用
就直接将
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/setQpeEnv
的内容
直接copy到此处,再将原来的注释掉
重新编译即可

出现此错误是由于系统没有安装相关的软件包,打开网址:ftp.gnu.org/gnu/m4/下载用户喜欢的任一版本,用如下的命令进行编译安装即可:

Solutions :

我的做法:

(sudo)
./configure
(sudo) make
(sudo) make install

解决方法:yum install libpng libpng-devel

图片 2

5.安装gd库时出错 make[2]:
*** [gd_png.lo] Error 1:

7.Configure: error: Cannot find MySQL header files under /usr.

2.编译错误(此为arm编译脚本运行时出现的错误):
chmod:
cannot access `set*Env’: No such file or directory
 done
!
 done
!
the
konqueror directory is already !
Build
konqueror , please wait …
 
./arm-qtopia-2.2.0-konqueror_build:
58: source: not found

出错原因:

Note that the MySQL client library is not bundled anymore!

原因:配置环境没有起作用。

系统无法找到png.h文件

Solutions:

解决办法:
在arm-qtopia-2.2.0-konqueror_build编译脚本配置文件中
第25行
source arm-qtopia-2.2.0/setQpeEnv 用#号注释掉

解决方法:

解决方法:yum install mysql-devel

直接将
/opt/EmbedSky/Qte/arm-qtopia-2.2.0/setQpeEnv
的内容
直接copy到此处,重新编译即可。

进入gd库的解压目录编辑gd_png.c文件,找到如下的代码:

 
8.没有安装snmp开发包
checking for SNMP support… yes
checking OpenSSL dir for SNMP… no
checking whether to enable UCD SNMP hack… no
checking for net-snmp-config… (cached) /usr/bin/net-snmp-config
configure: error: snmp.h not found. Check your SNMP installation.
[root@RedHat1
php-5.2.17]#

3.编译错误(此为arm编译脚本运行时出现的错误):
make:
arm-linux-g++: Command not found
make:
*** [main.o] Error 127
make:
arm-linux-g++: Command not found
make:
*** [.obj/linux-arm-g++//filebrowser.o] Error 127
make:
/opt/EmbedSky/Qte/arm-qtopia-2.2.0/qt2/bin/uic: Command not
found
make:
*** [settingsdialogbase.h] Error 127
make:
arm-linux-g++: Command not found
make:
*** [.obj/linux-arm-g++//TEScreen.o] Error 127
./arm-qtopia-2.2.0_build:
line 69: cd: arm-qtopia-2.2.0/qtopia/image/opt/Qtopia/lib/fonts/: No
such file or directory
mv:
cannot stat `helvetica_120_50.qpf’: No such file or
directory
mv:
cannot stat `helvetica_120_50_t5.qpf’: No such file or
directory
mv:
cannot stat `bak_helvetica_120_50_t5.qpf’: No such file or
directory
mv:
cannot stat `bak_helvetica_120_50.qpf’: No such file or
directory
cp:
cannot stat `qtopia/image/opt’: No such file or directory
chmod:
cannot access `set*Env’: No such file or directory
./arm-qtopia-2.2.0-konqueror_build:
55: source: not found
configure:
WARNING: If you wanted to set the –build type, don’t use
–host.
    If a
cross compiler is detected then cross compile mode will be
used.
configure:
error: C compiler cannot create executables
See
`config.log’ for more details.
make:
*** No targets specified and no makefile found.  Stop.

#include
“png.g”

解决方法:yum install net-snmp net-snmp-devel

原因:安装EABI时已安装了交叉编译器并设置了交叉编译器的环境变量,也能够通过命令找到arm-linux-g++和arm-linux-gcc,如下:
zyx@zyx:/opt/EmbedSky$ arm-linux-g++
-v
Using
built-in specs.
Target:
arm-none-linux-gnueabi
Configured
with:
/scratch/maxim/arm-lite/src-4.3-arm-none-linux-gnueabi-lite/gcc-4.3/configure
–build=i686-pc-linux-gnu –host=i686-pc-linux-gnu
–target=arm-none-linux-gnueabi –enable-threads –disable-libmudflap
–disable-libssp –disable-libstdcxx-pch –with-gnu-as –with-gnu-ld
–with-specs=’%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}’
–enable-languages=c,c++ –enable-shared –enable-symvers=gnu
–enable-__cxa_atexit –with-pkgversion=’Sourcery G++ Lite
2009q1-176′ –with-bugurl=
–disable-nls –prefix=/opt/codesourcery
–with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc
–with-build-sysroot=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/libc
–with-gmp=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
–with-mpfr=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
–disable-libgomp –enable-poison-system-directories
–with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin
–with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin
Thread
model: posix
gcc
version 4.3.3 (Sourcery G++ Lite 2009q1-176)

将之修改为:

9.apache端口被占用了
[root@redhat1 bin]# ./httpd
(98)Address already in use: make_sock: could not bind to address
[::]:80
(98)Address already in use: make_sock: could not bind to address
0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[root@redhat1 bin]#

zyx@zyx:/opt/EmbedSky$ arm-linux-gcc
-v
Using
built-in specs.
Target:
arm-none-linux-gnueabi
Configured
with:
/scratch/maxim/arm-lite/src-4.3-arm-none-linux-gnueabi-lite/gcc-4.3/configure
–build=i686-pc-linux-gnu –host=i686-pc-linux-gnu
–target=arm-none-linux-gnueabi –enable-threads –disable-libmudflap
–disable-libssp –disable-libstdcxx-pch –with-gnu-as –with-gnu-ld
–with-specs=’%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}’
–enable-languages=c,c++ –enable-shared –enable-symvers=gnu
–enable-__cxa_atexit –with-pkgversion=’Sourcery G++ Lite
2009q1-176′ –with-bugurl=
–disable-nls –prefix=/opt/codesourcery
–with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc
–with-build-sysroot=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/libc
–with-gmp=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
–with-mpfr=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr
–disable-libgomp –enable-poison-system-directories
–with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin
–with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin
Thread
model: posix
gcc
version 4.3.3 (Sourcery G++ Lite 2009q1-176) 
zyx@zyx:/opt/EmbedSky$

#include
“/usr/local/libpng/include/libpng12/png.h”

解决方法:80端口被占用了,杀掉占用80端口的进程 

但是编译的时候就是找不到交叉编译器,这让我很费解;后来在看到网上说有可能是权限不足,在根用户下编译时可以找到g++.这样“configure:
error: C compiler cannot create executables
See
`config.log’ for more details.make: *** No targets specified and no
makefile found.  Stop.”的错误也迎刃而解。

注意:修改的文件目录即您安装libpng库时对应文件的目录,此处需要根据您的安装路径酌情修改

10.没有指定主机IP地址
[root@redhat1 bin]# ./httpd
httpd: Could not reliably determine the server’s fully qualified domain
name, using 2.2.2.117 for ServerName
[root@redhat1 bin]#

解决办法:使用根用户重新编译。
zyx@zyx:/opt/EmbedSky/Qte$ su
Password: 
root@zyx:/opt/EmbedSky/Qte#
./arm-qtopia-2.2.0-konqueror_build

6.Could
not reliably determine the server’s fully qualified domain name, using
127.0.1.1 for ServerName:

解决方法:vim /usr/local/apache/conf/httpd.conf

4.编译错误:
configure:
error: Qt (>= Qt 2.2.2) (headers and libraries) not found. Please
check your installation!
For more
details about this problem, look at the end of config.log.

这是一个 warning,出现在apache2启动或重起时。主要是因为在配置 apache2
时,没有指定相应的主机名,即 ServerName。修改/etc/httpd/httpd.conf ,
在最前加入 ServerName localhost:80 即可 

ServerName localhost          –添加这一行就可以了

原因:出现此类错有可能是下面讲到的第二大类编译错误第10个错误,但是并不一定都能解决问题。有时是用户权限问题,改成根用户重新编译即可。

发表评论

电子邮件地址不会被公开。 必填项已用*标注