30

I'm trying to install PCRE on my Ubuntu 11.10 Server. When I run the "make" command, I get a really long output which always ends in this error:

libtool: link: ( cd ".libs" && rm -f "libpcreposix.la" && ln -s "../libpcreposix.la" "libpcreposix.la" ) source='pcrecpp.cc' object='pcrecpp.lo' libtool=yes \
        DEPDIR=.deps depmode=none /bin/bash ./depcomp \
        /bin/bash ./libtool --tag=CXX   --mode=compile  -DHAVE_CONFIG_H -I.      -c -o pcrecpp.lo pcrecpp.cc libtool: compile: unrecognized option `-DHAVE_CONFIG_H' libtool: compile: Try `libtool
--help' for more information. make[1]: *** [pcrecpp.lo] Error 1 make[1]: Leaving directory `/home/root/src/pcre/pcre-8.12' make:
*** [all] Error 2

I did run "configure". Any ideas?

Ohas
  • 1,887
  • 4
  • 21
  • 29

7 Answers7

26

You need a C++ compiler installed, you'll most likely want g++.

With apt-get, run 'apt-get install g++', or 'apt-get install build-essential', since build-essential includes g++.

Fredrik Håård
  • 2,856
  • 1
  • 24
  • 32
  • Indeed, ${CXX} seems to have expanded to the empty string here. Arguably, pcre's configure should have caught that - or not attempt buliding pcrecpp. – jørgensen Jan 28 '12 at 01:44
  • Doing this didn't quite work for me. It's the same error. Do I need to specify some `configure` option? – Ry- Jan 28 '12 at 14:34
  • minitech: Can you see what $CXX expands to? What output does 'g++ --version' give? – Fredrik Håård Jan 30 '12 at 15:18
  • @minitech I don't know if you did, but I received the same error, even after installing build-essential. What I did was removing the pcre-8.31 dir. Unpacking it again, doing the ./configure and then make worked! – Philip Oct 03 '12 at 11:11
  • It's always good to clean up after a failed build after installing new packages; 'make clean' usually does the trick. – Fredrik Håård Nov 26 '12 at 09:17
  • 1
    I got this error during the install: https://bugzilla.redhat.com/show_bug.cgi?id=494006. Running yum clean metadata resolved the error and I was able to install gcc-c++. – yellavon May 05 '14 at 18:37
  • If gcc is installed and it supports c++, why is still needed to install g++? – zequihg50 Mar 30 '17 at 09:32
16

PCRE tries to build c++ output without having a c++ compiler. Try

./configure --disable-cpp 

to disable the C++ options.

XcodeJunkie
  • 424
  • 4
  • 10
8

I've had the same problem and the solution was to do everything suggested in the other answers and installing the developement files for PCRE:

  1. apt-get install build-essential
  2. apt-get install libtool
  3. apt-get install libpcre3-dev
  4. apt-get install libpcre3
BlackBear
  • 22,411
  • 10
  • 48
  • 86
8

Why not find PCRE using apt-cache search pcre | grep pcre and then use apt-get install to install PCRE? I think PCRE has been already included in the repository.

This is the result of the above command in my computer (Ubuntu 10.04):

$ apt-cache search pcre | grep pcre
libpcre3-dbg - Perl 5 Compatible Regular Expression Library - debug symbols
libpcre3-dev - Perl 5 Compatible Regular Expression Library - development files
libpcrecpp0 - Perl 5 Compatible Regular Expression Library - C++ runtime files
libpcre3 - Perl 5 Compatible Regular Expression Library - runtime files
cl-ppcre - Portable Regular Express Library for Common Lisp
gambas2-gb-pcre - The Gambas regexp component
haskell-pcre-light-doc - library documentation for pcre-light
libghc6-pcre-light-dev - Haskell library for Perl 5-compatible regular expressions
libghc6-pcre-light-prof - pcre-light library with profiling enabled
liblua5.1-rex-pcre-dev - PCRE development files for the Lua language version 5.1
liblua5.1-rex-pcre0 - Perl regular expressions library for the Lua language version 5.1
libpcre++-dev - C++ wrapper class for pcre (development)
libpcre++0 - C++ wrapper class for pcre (runtime)
libpcre-ocaml - OCaml bindings for PCRE (runtime)
libpcre-ocaml-dev - OCaml bindings for PCRE (Perl Compatible Regular Expression)
pcregrep - grep utility that uses perl 5 compatible regexes.
pike7.6-pcre - PCRE module for Pike
sqlite3-pcre - Perl-compatible regular expression support for SQLite
postfix-pcre - PCRE map support for Postfix
Yun Huang
  • 4,256
  • 7
  • 27
  • 36
  • 1
    People are trying to install version 8. TheBuggenie uses pcre version 8, god knows why they would use something that would make it impossible get started on their product. Painful installing thebuggenie. – Siddharth Jun 07 '12 at 05:18
6

When I run configure I get:

libpcre checking for windows.h... no configure: error: Invalid C++ compiler or C++ compiler flags

Fix was to install g++ as Fredrik mentioned. On CentOS: yum install gcc-c++

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
1

To install pcre package, you need to run 2 commands:

  1. apt-get install libpcre3 libpcre3-dev
  2. apt-get install build-essential libpcre3-dev libxslt1-dev libgd2-xpm-dev libgeoip-dev libssl-dev
swapnil
  • 11
  • 3
  • Hello! Very short answers are generally poorly-received here. If you can make your answer longer, you'll start getting upvotes. –  Oct 26 '16 at 12:50
0

I found an answer as to why, but not a cure; (i know this is an old question but I thought I would contribute anyway).

I found pcre was already installed on my system, but apparently libtool was not. When I tried to sudo apt-get install libtool i got

Package libtool is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Don't have much of an idea why this is happening, but working on finding out! Hopes this answers your question.

JXPheonix
  • 2,618
  • 3
  • 16
  • 14