[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1203
  • Last Modified:

GCC - C compiler cannot create executables

I am attempting to configure Asterisk CDR logging to MySQL on an Asterisk 1.8.3.2 box.

I have already installed MySQL and created the database / user. This is working correctly. /etc/asterisk/cdr_mysql.conf is configured.

With all the required dependencies installed, I am unable to run ./configure:

root@Hutch:/usr/src/asterisk-1.8.3.2# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/usr/src/asterisk-1.8.3.2':
configure: error: C compiler cannot create executables
See `config.log' for more details.

Open in new window

Unfortunately, gcc doesn't seem to be working. I have removed and reinstalled as much as I can without removing 974MB of packages and disrupting all the core system on the Linux box. This hasn't fixed the problem. I don't quite understand why.

Any ideas before I backup the config and format the box?
0
tigermatt
Asked:
tigermatt
  • 6
  • 3
  • 3
  • +2
1 Solution
 
wesly_chenCommented:
> See `config.log' for more details.
Could you post the config.log?

Besides, your Linux need to install "glibc-headers" package which all the header files.
0
 
arnoldCommented:
run gcc and see what it outputs.
My guess is that you will get a message saying to install run apt-get install gcc which you should do and then you will have a working gcc (C compiler) on the system.
0
 
wesly_chenCommented:
Check this post
http://www.linuxquestions.org/questions/linux-newbie-8/checking-whether-the-c-compiler-gcc-works-no-199614/#post1020828

There is simple c code and compile it.
If you got the same error message : " stdio.h: No such file or directory"
Then your Linux are missing system headers files in /usr/include/, which is glibc-headers package.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tigermattAuthor Commented:

wesly_chen,

I get this:

root@Hutch:/home/matthew# gcc -o simple simple.c
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
root@Hutch:/home/matthew#

Open in new window


arnold,

Running gcc itself seems to work correctly:

root@Hutch:/home/matthew# gcc
gcc: no input files

Open in new window


-Matt
0
 
tigermattAuthor Commented:

Attached is the config.log as requested.

Digging into the log it seems to show the same error regarding -lc which I had in wesly_chen's example above.

-Matt
config.log
0
 
tigermattAuthor Commented:

Apologies for the multiple posts.

arnold,

apt-get install gcc - I am told I already have the newest version. I have removed/reinstalled to no effect.

wesly_chen,

I can't find a glibc-headers package in the repository to install.
0
 
wesly_chenCommented:
You missing glibc, need to install glibc, glibc-headers and glibc-devel.
If your Linux uses "rpm", please post
# rpm -qa |grep -i glibc
and post the result here.
0
 
wesly_chenCommented:
0
 
wesly_chenCommented:
0
 
Dave BaldwinFixer of ProblemsCommented:
In Ubuntu, 'libc6' is available thru your package manager (I used Synaptics) and that's the way you should install it.  "glibc-source" and glibc-doc" are also available if you need them.  They are not installed with gcc for some reason.  Has to be done separately.
0
 
arnoldCommented:
apt-get install glibc should do the trick as well
or do apt-get search glibc and then apt-get install <the list of found items>
0
 
eagerCommented:
Sorry folks -- I have trouble believing that there is a running Linux system anywhere which does not already have glibc installed (unless using uClibc).  All the suggestions to install glibc either using apt-get or by downloading a random glibc package are heading in the wrong direction.

When LD says that it cannot find -lc, this usually means that the search paths which it uses to find libc.so are incorrect.  You can dump the ld cache and see where it expects to find libc.so with the following command:

  $ sudo ldconfig -p | grep libc.so

On my system, this generates
        libc.so.6 (libc6, hwcap: 0x0018000000000000, OS ABI: Linux 2.6.9) => /lib/i686/nosegneg/libc.so.6
        libc.so.6 (libc6, OS ABI: Linux 2.6.9) => /lib/libc.so.6

You can reset the LD cache by running "sudo ldcache".  
0
 
Dave BaldwinFixer of ProblemsCommented:
@eager, the standard Ubuntu release does not include gcc or it's libraries.  They are in the repositories as separate items for download.  Ubuntu users have been complaining about the separate downloads for at least 5 years now.
0
 
eagerCommented:
@DaveBaldwin -- the standard Ubuntu release *does* include glibc, like ever other distro.  Yes, glibc-headers are not installed by default, which is an annoyance when you compile something with gcc, because *gcc* will fail when the include files are not found.  LD not being able to find libc.so is not caused by missing header files.  

As the OP found, trying to install glibc will (wisely) result in a message saying it is already installed.  
0
 
wesly_chenCommented:
Well, Asterisk Linux is a function specific Linux OS for PBX or phone system.
Early version of Asterisk used Fedora Core 3.

Based on the error messages,
> /usr/bin/ld: cannot find -lc
It seems that OS is stripped out part of glibc function or libraries.
For glibc-headers, we can check
/usr/include
directory to see the content.

So I recommended to re-install full version of glibc.
However, install glibc is not easy if there is not precompiled package from the OS distributor.

Above just my conclusion. It might not correct.  
0
 
eagerCommented:
@wesley -- it is difficult to run programs on a Linux system which does not include libc.so.  Only programs which are linked statically can run.  

It's easy to find out whether libc.so is installed and where it is located:

$ find /lib -name libc.\*

Installing new versions of glibc is very problematic and ill-advised.  If glibc is not built for the *exact same* kernel, including all patches, it's possible hat the kernel interface will have changed.  

0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 6
  • 3
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now