Apacheのconfigure時のエラー「configure: error: no acceptable C compiler found in $PATH」の原因と解決方法
Linux(例:CentOS 5)でApacheをソースからインストールするためにconfigureを実行すると、
configure: error: in `/var/tmp/httpd-2.2.17/srclib/apr':
configure: error: no acceptable C compiler found in $PATH
というエラーが出てconfigureに失敗することがある。
《例》
[root@nobuneko local]# cd /var/tmp/httpd-2.2.17
[root@nobuneko httpd-2.2.17]# ./configure --prefix=/usr/local/apache2 --enable-so
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Configuring Apache Portable Runtime library ...
checking for APR... reconfig
configuring package in srclib/apr now
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
Configuring APR library
Platform: x86_64-unknown-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.4.2
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/var/tmp/httpd-2.2.17/srclib/apr':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
configure failed for srclib/apr
「no acceptable C compiler found」というエラーメッセージより、Cコンパイラが見つからない、ということが分かるので、yumなどでCコンパイラをインストールする。
[root@nobuneko httpd-2.2.17]# yum install gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
base | 2.1 kB 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.1.2-50.el5 set to be updated
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Running transaction check
---> Package glibc-devel.x86_64 0:2.5-58.el5_6.4 set to be updated
--> Processing Dependency: glibc-headers = 2.5-58.el5_6.4 for package: glibc-devel
--> Processing Dependency: glibc = 2.5-58.el5_6.4 for package: glibc-devel
--> Processing Dependency: glibc-headers for package: glibc-devel
--> Running transaction check
--> Processing Dependency: glibc = 2.5-58.el5_6.3 for package: nscd
---> Package glibc.i686 0:2.5-58.el5_6.4 set to be updated
--> Processing Dependency: glibc-common = 2.5-58.el5_6.4 for package: glibc
---> Package glibc.x86_64 0:2.5-58.el5_6.4 set to be updated
---> Package glibc-headers.x86_64 0:2.5-58.el5_6.4 set to be updated
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Processing Dependency: kernel-headers for package: glibc-headers
--> Running transaction check
---> Package glibc-common.x86_64 0:2.5-58.el5_6.4 set to be updated
---> Package kernel-headers.x86_64 0:2.6.18-238.12.1.el5 set to be updated
---> Package nscd.x86_64 0:2.5-58.el5_6.4 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================
Package Arch Version Repository Size
==================================================================================================================
Installing:
gcc x86_64 4.1.2-50.el5 base 5.3 M
Installing for dependencies:
glibc-devel x86_64 2.5-58.el5_6.4 updates 2.4 M
glibc-headers x86_64 2.5-58.el5_6.4 updates 594 k
kernel-headers x86_64 2.6.18-238.12.1.el5 updates 1.2 M
Updating for dependencies:
glibc i686 2.5-58.el5_6.4 updates 5.3 M
glibc x86_64 2.5-58.el5_6.4 updates 4.8 M
glibc-common x86_64 2.5-58.el5_6.4 updates 16 M
nscd x86_64 2.5-58.el5_6.4 updates 167 k
Transaction Summary
==================================================================================================================
Install 4 Package(s)
Upgrade 4 Package(s)
Total download size: 36 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): nscd-2.5-58.el5_6.4.x86_64.rpm | 167 kB 00:00
(2/8): glibc-headers-2.5-58.el5_6.4.x86_64.rpm | 594 kB 00:00
(3/8): kernel-headers-2.6.18-238.12.1.el5.x86_64.rpm | 1.2 MB 00:00
(4/8): glibc-devel-2.5-58.el5_6.4.x86_64.rpm | 2.4 MB 00:01
(5/8): glibc-2.5-58.el5_6.4.x86_64.rpm | 4.8 MB 00:02
(6/8): gcc-4.1.2-50.el5.x86_64.rpm | 5.3 MB 00:03
(7/8): glibc-2.5-58.el5_6.4.i686.rpm | 5.3 MB 00:03
(8/8): glibc-common-2.5-58.el5_6.4.x86_64.rpm | 16 MB 00:09
------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 36 MB 00:23
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : glibc-common 1/12
Updating : glibc 2/12
Installing : kernel-headers 3/12
Updating : glibc 4/12
Updating : nscd 5/12
Installing : glibc-headers 6/12
Installing : glibc-devel 7/12
Installing : gcc 8/12
Cleanup : glibc-common 9/12
Cleanup : glibc 10/12
Cleanup : glibc 11/12
Cleanup : nscd 12/12
Installed:
gcc.x86_64 0:4.1.2-50.el5
Dependency Installed:
glibc-devel.x86_64 0:2.5-58.el5_6.4 glibc-headers.x86_64 0:2.5-58.el5_6.4
kernel-headers.x86_64 0:2.6.18-238.12.1.el5
Dependency Updated:
glibc.i686 0:2.5-58.el5_6.4 glibc.x86_64 0:2.5-58.el5_6.4 glibc-common.x86_64 0:2.5-58.el5_6.4
nscd.x86_64 0:2.5-58.el5_6.4
Complete!
これで、Cのコンパイラのインストールが完了。
この後、再度configureを実行すると、エラーにならず、configureに成功した。