@kyanny's blog

My thoughts, my life. Views/opinions are my own.

apache 1.3.42 をビルドすると htpasswd.c:101: error: conflicting types for 'getline' というエラーが出る

apache 1.3.42 をビルドすると htpasswd.c:101: error: conflicting types for 'getline' というエラーが出る場合は glibc の stdio ライブラリの getline 関数と競合しているので、このパッチを当てるか、該当箇所を置き換えてやれば良い

make 時のエラーメッセージは以下のような内容。

===> src/support
make[2]: Entering directory `/home/kyanny/cicindela/apache_1.3.42/src/support'
gcc -c  -I../os/unix -I../include   -DLINUX=22 -DHAVE_SET_DUMPABLE -DUSE_HSREGEX -DNO_DL_NEEDED `../apaci` htpasswd.c
htpasswd.c:101: error: conflicting types for 'getline'
/usr/include/stdio.h:673: note: previous declaration of 'getline' was here
make[2]: *** [htpasswd.o] Error 1
make[2]: Leaving directory `/home/kyanny/cicindela/apache_1.3.42/src/support'
make[1]: *** [build-support] Error 1
make[1]: Leaving directory `/home/kyanny/cicindela/apache_1.3.42'
make: *** [build] Error 2

具体的に glibc のどのバージョンからこの問題が起こるようになったのか調べがついていないけど、手元の CentOS 6.2 (さくらの VPS 1G) では遭遇した。あと Amazon EC2 の Amazon Linux 32bit (ami-087acb09) / 64bit (ami-e47acbe5) いずれでも遭遇した。

CentOS 6.2 に入っていた glibc のバージョンは以下。

Installed Packages
Name        : glibc
Arch        : x86_64
Version     : 2.12
Release     : 1.47.el6_2.9
Size        : 12 M
Repo        : installed
From repo   : updates
Summary     : The GNU libc libraries
URL         : http://sources.redhat.com/glibc/
License     : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Description : The glibc package contains standard libraries which are used by
            : multiple programs on the system. In order to save disk space and
            : memory, as well as to make upgrading easier, common system code is
            : kept in one place and shared between programs. This particular package
            : contains the most important sets of shared libraries: the standard C
            : library and the standard math library. Without these two libraries, a
            : Linux system will not function.