Configure error for PECL Memcache on Ubuntu
Tagged:  •    •  

This is the second time I've run into this error and I'm sick of Googling around for the answer. So I'm documenting it here. When preparing to compile code on Linux, one runs the configure command. If you don't have your compilers in order, you'll be faced with a message like this:


root@robert-desktop:/usr/src/memcache-2.1.0# ./configure --enable-memcache
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... /usr/bin/cpp-4.0
checking for C compiler default output file name... conftest.in
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

The problem can be figured out by looking at the environment variables for your C compiler:


env | grep CC
CC=/usr/bin/cpp-4.0

The answer to the problem; set the CC variable to the gcc program instead (I think this allows it to compile as C++ but don't quote me on that):

CC=/usr/bin/gcc-4.0 ./configure --enable-memcache

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options