0

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

http://www.linuxfromscratch.org/blfs/view/svn/multimedia/sdl.html

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
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2536: $? = 0
configure:2543: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
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.
Thomas Ward
  • 74,764

2 Answers2

3

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.

  • Thanks for your response! Your answer certainly sounds plausible, but I can't find any a.out files to delete. – Bluemoon88 Jun 02 '12 at 15:24
  • I just deleted the entire directory structure, reinstalled it, and then typed sh ./configure. Still the same problem. – Bluemoon88 Jun 02 '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 02 '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: http://askubuntu.com/questions/144785/cant-install-sdl-1-2-15-on-ubuntu-12-04 – Bluemoon88 Jun 02 '12 at 16:32
  • 1
    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 02 '12 at 16:36
  • I have just downloaded and configured the said package (Ubuntu 11.04 using bash as shell). The configure script has correct permissions, starts correctly upon calling ./configure and runs with no errors. I really believe that the problem is not in SDL, but instead is somewhere in your system settings (after all, you should be able to run ./configure). – Vitalie Ciubotaru Jun 02 '12 at 16:59
  • You may well be right, although I've not really changed any of the system settings due to my lack of expertise. I'll see if I can get this compiled on Windows, that might be the easier option. It could take me weeks to track down the problem, given that I've only been using Linux for a few weeks. Thanks for taking the time to help! – Bluemoon88 Jun 02 '12 at 17:56
  • On a hunch, I just tried running configure from a directory on the disk on which I have Linux installed, and it worked perfectly! I guess the fact that I had all the library files on another disk caused a problem somehow. I think it's time to move my dev files! – Bluemoon88 Jun 02 '12 at 18:23
  • Oh, so you tried to compile SDL on a Windows filesystem/partition? :-) – Vitalie Ciubotaru Jun 02 '12 at 19:07
  • Well, when you put it like that, it clearly seems like a bad thing to do! – Bluemoon88 Jun 02 '12 at 19:20
  • Windows filesystems (at least FAT, not sure about NTFS) do not store file attributes (owner, group, permissions etc.). This is why unix executables sometimes refuse to run from Windows partitions (and sometimes all files appear as executable). When you untarred your SDL archive, the executable bit of the configure script got lost and you could not run it, except by forcing with sh. For the same reason gcc tests failed. As a conclusion, (1) compile on the native Linux partition (say, inside your Ubuntu home directory, (2) try to do as you can without sudo. – Vitalie Ciubotaru Jun 02 '12 at 20:09
0

First install essential package.

sudo apt-get install build-essential

then try

If you get error again then try this

sudo ./configure

  • 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 02 '12 at 15:55
  • Gcc is already installed from this output checking for gcc... gcc – daisy Jun 04 '12 at 02:53