Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to compile SDL-1.2.15 on Ubuntu 12.04


The install guide says that I need to start by calling the configure file. Looking at the comments, this seems to be needed to create a makefile with which to compile the library. So, I start by typing:

sudo sh ./configure

To which I get the following error message:

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
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.

I've checked the log file (see below), but have been unable to determine the underlying problem. Any ideas on how to proceed?

This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was generated by GNU Autoconf 2.61. Invocation command line was

  $ ./configure 

## --------- ##
## Platform. ##
## --------- ##

hostname = ubuntu
uname -m = i686
uname -r = 3.2.0-24-generic-pae
uname -s = Linux
uname -v = #39-Ubuntu SMP Mon May 21 18:54:21 UTC 2012

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin

## ----------- ##
## Core tests. ##
## ----------- ##

configure:2136: checking build system type
configure:2154: result: i686-pc-linux-gnu
configure:2176: checking host system type
configure:2191: result: i686-pc-linux-gnu
configure:2261: checking for gcc
configure:2277: found /usr/bin/gcc
configure:2288: result: gcc
configure:2526: checking for C compiler version
configure:2533: gcc --version >&5
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

configure:2536: $? = 0
configure:2543: gcc -v >&5
Using built-in specs.
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
configure:2546: $? = 0
configure:2553: gcc -V >&5

gcc: error: unrecognized option '-V'

gcc: fatal error: no input files

compilation terminated.

configure:2556: $? = 4

configure:2579: checking for C compiler default output file name

configure:2606: gcc    conftest.c  >&5

configure:2609: $? = 0

configure:2647: result: a.out

configure:2664: checking whether the C compiler works

configure:2674: ./a.out

./configure: line 2675: ./a.out: Permission denied

configure:2677: $? = 126

configure:2686: error: cannot run C compiled programs.

If you meant to cross compile, use `--host'.
See `config.log' for more details.
share|improve this question

2 Answers 2

You launched the configuration script as root (via sudo). It was testing your compiler and created a file that is executable by root only. So an attempt to execute it as normal user fails.

Normally you don't need sudo when building software, use it only when installing.

Update: upon a closer examination, it looks like you ran the configure script at least twice: first with sudo and then without. You might have forgotten to clean up, so there's a stale a.out file belonging to root and not executable by unprivileged user.

Update2: based on the comments below, I have to add another explanation to what happened. You tried to compile your package on a non-POSIX filesystem. Filesystems like FAT32 do not store file permissions, which is why you could not run ./configure and the script could not run a.out to check whether your compiler works.

share|improve this answer
Thanks for your response! Your answer certainly sounds plausible, but I can't find any a.out files to delete. –  Bluemoon88 Jun 2 '12 at 15:24
I just deleted the entire directory structure, reinstalled it, and then typed sh ./configure. Still the same problem. –  Bluemoon88 Jun 2 '12 at 16:10
Two points to mention here. First, you logs say that a.out was created, but could not be executed due to insufficient permissions. Second, it is very strange that you can't run ./configure. Is it true for any script/application? This might be the clue to why you're having this problem. –  Vitalie Ciubotaru Jun 2 '12 at 16:21
No, only this application. The answer lies in the thread I started yesterday, where I answered my own question. Maybe you can understand it better than me: askubuntu.com/questions/144785/… –  Bluemoon88 Jun 2 '12 at 16:32
What's strange is that I wasn't using csh, I was using dash (Ubuntu default). And now I've switched to bash to see if that helps. But none of that seems to fix yesterday's problem or today's. –  Bluemoon88 Jun 2 '12 at 16:36

First install essential package.

sudo apt-get install build-essential

then try

If you get error again then try this

sudo ./configure

share|improve this answer
I tried what you suggested, but build-essential is already the newest version. ./configure doesn't work at all, I have to do sh ./configure. –  Bluemoon88 Jun 2 '12 at 15:55
Gcc is already installed from this output checking for gcc... gcc –  warl0ck Jun 4 '12 at 2:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.