[conspire] Breezy Badger/configure something

Rick Moen rick at linuxmafia.com
Tue Jan 3 17:07:20 PST 2006

Quoting John Andrews (jla1200 at netzero.net):

[Ubuntu/Kubuntu 5.10, compiling units 1.74 as an exercise:]

> It seems okay to this point.


> Why doesn't this ./configure --prefix$HOME/unit174 command work right [?]

Seems to need a "=", there.   Observe:

  $ cd /tmp
  $ mkdir foo
  $ tar xzf units-1.74.tar.gz 
  $ cd units-1.74
  $ ./configure --prefix=/tmp/foo
  creating cache ./config.cache
  checking for gcc... gcc
  checking whether the C compiler (gcc  ) works... yes
  checking whether the C compiler (gcc  ) is a cross-compiler... no
  checking whether we are using GNU C... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ANSI C... 
  checking how to run the C preprocessor... gcc -E
  checking for function prototypes... yes
  checking for working const... yes
  checking for a BSD compatible install... /usr/bin/install -c
  checking for tparm in -lncurses... yes
  checking for readline in -lreadline... yes
  checking for readline/readline.h... yes
  checking for string.h... yes
  checking for stdlib.h... yes
  checking for strchr... yes
  checking for strspn... yes
  checking for strtok... yes
  updating cache ./config.cache
  creating ./config.status
  creating Makefile

By the way, if you follow the diagnostic's advice about using the "--help" 

  $ ./configure --help | more
  Usage: configure [options] [host]
  Options: [defaults in brackets after descriptions]
    --cache-file=FILE       cache test results in FILE
    --help                  print this message
    --no-create             do not create output files
    --quiet, --silent       do not print `checking...' messages
    --version               print the version of autoconf that created configure
  Directory and file names:
    --prefix=PREFIX         install architecture-independent files in PREFIX

> THIS PART i THOUGHT SHOULD WORK CORRECTLY. Why isn't gcc on my $PATH. i know 
> it's installed.
> jla at vstrom:~/download$ cd units-1.74
> jla at vstrom:~/download/units-1.74$ ./configure
> loading cache ./config.cache
> checking for gcc... no
> checking for cc... no
> configure: error: no acceptable cc found in $PATH
> jla at vstrom:~/download/units-1.74$

This is one of those areas where you'll have to help us.  On the system
in front of me:

  $ which cc

I'm guessing that you get this?

  $ which cc
  cc: Command not found.

> Why isn't gcc on my $PATH?

Well, first of all, you didn't tell us what $PATH _is_ on your system.
Again, on the machine in front of me:

  $ echo $PATH 

The "which" command returns "/usr/bin/cc" specifically because (1) "/usr/bin" 
is among the directories included in $PATH, and (2) there's a file in
that directory by that name that has its executable bit set.

  $ ls -l /usr/bin/cc
  lrwxr-xr-x    1 root     root            3 Jul 16 01:53 /usr/bin/cc -> gcc

As you can see, it happens to be a symbolic link.  You could create a
"cc" symlink, I suppose -- though I'd put it in /usr/local/bin, rather
than /usr/bin.

A little googling on "Ubuntu cc symlink" reveals the sensible
alternative notion that you can just set an environment variable called "CC",
defining it to be wherever the gcc binary lives.  You decide.   If you 
prefer to declare the CC environment variable, you can just put this
somewhere appropriate in your ~/.bashrc script:

export CC

(This assumes that there's a /usr/bin/gcc executable present.  Adjust to
suit whatever you have.)

If that seems too complex or you're queasy about what "somewhere
appropriate" means in this context, just do the symlink thing:

$ su -
# ln -s /usr/bin/gcc /usr/local/bin/cc
# exit

That's probably simpler, really.

Second point:  

> Why isn't gcc on my $PATH?

Wrong question.  You _didn't go looking for_ "gcc", and nor did the
configure script:  The configure script looked for "cc".  

For whatever reason, Ubuntu chose to neither define that environment
variable nor establish a (hard or soft) "cc" executable.  Maybe they 
didn't expect their target audience to compile much software from
tarballs (which seems likely enough) -- or expected that most software
compiled on a Linux box would search for "gcc" instead of just failing
to find "cc" and falling over.  Or both. 

Anyhow, that should help.

More information about the conspire mailing list