Автор Тема: Проблемы с libpcre  (Прочитано 4109 раз)

Оффлайн anyx

  • Участник
  • *
  • Сообщений: 30
Проблемы с libpcre
« : 16.03.2011 20:06:45 »
Всем привет.
Собрался установить Gource из исходников ( http://code.google.com/p/gource/ ).
Установил все пакеты, указанные в зависимостях, но при попытке сборки не находится pcre:

[root@localhost gource-0.32]# ./configure
checking for a BSD-compatible install... /bin/install -c
...
checking ftgl.h presence... yes
checking for ftgl.h... yes
checking pcre.h usability... no
checking pcre.h presence... no
checking for pcre.h... no
configure: error: pcre.h is required. Please see INSTALL

Гугл говорит. что нужно установить libpcre-devel, но пакет libpcre-devel, у меня уже установлен (8.12-alt2).

Кто-нибудь сталкивался с подобным?

ALTLinux 6.0.0 Beta

Оффлайн ruslandh

  • Поспешай не торопясь !
  • Модератор глобальный
  • *****
  • Сообщений: 32 360
  • Учиться .... Телепатами не рождаются, ими ....
Re: Проблемы с libpcre
« Ответ #1 : 16.03.2011 21:42:00 »
Значит скрипт configure не находит файл - надо смотреть лог и исходник configure - как он ищет, и почему не находит. Как вариант - ищет не там.

Оффлайн anyx

  • Участник
  • *
  • Сообщений: 30
Re: Проблемы с libpcre
« Ответ #2 : 16.03.2011 21:49:38 »
Да, я пробовал, но я не большой знаток shell'a.

Вот проверка наличия библиотеки:

ac_fn_cxx_check_header_mongrel "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default"
if test "x$ac_cv_header_pcre_h" = x""yes; then :

else
  as_fn_error "pcre.h is required. Please see INSTALL" "$LINENO" 5
fi

Вот описание функции:


# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
# ---------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_cxx_check_header_mongrel ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
  $as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
  # Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
$4
#include <$2>
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
  ac_header_compiler=yes
else
  ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }

# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <$2>
_ACEOF
if ac_fn_cxx_try_cpp "$LINENO"; then :
  ac_header_preproc=yes
else
  ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }

# So?  What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
  yes:no: )
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
    ;;
  no:yes:* )
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
( cat <<\_ASBOX
## ---------------------------------- ##
## Report this to acaudwell@gmail.com ##
## ---------------------------------- ##
_ASBOX
     ) | sed "s/^/$as_me: WARNING:     /" >&2
    ;;
esac
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
  $as_echo_n "(cached) " >&6
else
  eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}

} # ac_fn_cxx_check_header_mongrel

Можете помочь?

Оффлайн Карлсон

  • Участник
  • *
  • Сообщений: 1 699
Re: Проблемы с libpcre
« Ответ #3 : 16.03.2011 23:23:35 »
Можете помочь?

Помогите себе сами, это (в данном случае не сложно).

1.  Видим ошибку
checking for pcre.h... no
configure: error: pcre.h is required. Please see INSTALL

Читаем config.log:

configure:6990: checking pcre.h usability
configure:6990: g++ -c -g -O2 -pthread -pthread -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/freetype2 -I/usr/include/FTGL -I/usr/include/freetype2    -pthread -pthread -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/fr
conftest.cpp:60:18: error: pcre.h: No such file or directory
...
...
| /* confdefs.h */
| #define PACKAGE_NAME "Gource"
| #define PACKAGE_TARNAME "gource"
....
... выкинуто много несущественного
....
| #endif
| #include <pcre.h>


Видим, что не собирается банальный файл с #include <pcre.h>

2. Ищем, а есть ли такой файл
[karlson@roof gource-0.32]$ locate pcre.h
locate: warning: database `/var/lib/locate/locatedb' is more than 8 days old
/usr/include/pcre/pcre.h
/usr/share/doc/pcre-8.10/html/pcre.html

Ага, файл есть, но не в /usr/include, а глубже, в pcre/.

3. Ищем в configure.ac (это файл, из которого autotools делают скрипт configure) упоминание pcre.h, и заменяем на pcre/pcre.h
Запускаем пересоздание configure
[karlson@roof gource-0.32]$ autoreconf
/usr/share/aclocal/sigc++.m4:8: warning: underquoted definition of AM_PATH_SIGC
/usr/share/aclocal/sigc++.m4:8:   run info '(automake)Extending aclocal'
/usr/share/aclocal/sigc++.m4:8:   or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
Useless use of /d modifier in transliteration operator at /usr/share/automake-1.10/Automake/Wrap.pm line 60.

4. Запускаем configure, радуемся.

checking for ftgl.h... yes
checking pcre/pcre.h usability... yes
checking pcre/pcre.h presence... yes
checking for pcre/pcre.h... yes
checking GL/glew.h usability... yes
checking GL/glew.h presence... yes
checking for GL/glew.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands

5. Запускаем сборку...
In file included from src/commitlog.h:24,
                 from src/apache.h:27,
                 from src/apache.cpp:18:
src/core/regex.h:35:18: error: pcre.h: Нет такого файла или каталога

и говорим "Ах да....", конфиг исправили, а искодник забыли :)
Правим файл src/core/regex.h на предмет корректного указания хидера pcre/pcre.h и получаем свою программу.

Делов-то на пару минут :)

Вдогонку: не исключено, что это грязный хак, и можно как-то проще/правильнее. Но, кажись, и так сойдет.

Оффлайн anyx

  • Участник
  • *
  • Сообщений: 30
Re: Проблемы с libpcre
« Ответ #4 : 16.03.2011 23:38:54 »
Спасибо!
 :)