Ubuntu: C compiler cannot create executables



Question:

Everything was right. I have installed gdb from github and installed in /usr/local/bin. After that i removed default gdb(/usr/bin) using the following command

sudo apt-get remove gdb  

Now, when try to configure i am getting following errors:

checking whether the C compiler works... no  configure: error: C compiler cannot create executables  See `config.log' for more details  

It's look like c compiler issue. But i have gcc,g++ and build-essential installed. Even i did configure and make before the gdb(github) installation. My system is ubuntu 14.04 (64bit). I also found that by including 'O3' in CFLAGS it can be solved. But it's not working for me. Please help.

EDIT

When i try to compile a simple c file using gcc (gcc test.c) i got this error:

/usr/local/bin/ld: this linker was not configured to use sysroots  

I also tried to re-install binutils. But it didn't help.


Solution:1

I tried to install the latest version of gdb(7.8) in ubuntu. But somehow ld (part of binutil) from gdb package is not supported by ubuntu 14.04. So i have to uninstall it. But there is no gdb uninstall script. So i did the following:

Step 1: edit /etc/environment and move /usr/local/bin to then end of the line. I let the system to load /usr/bin first.    Step 2: update path: source /etc/environment    Step 3: remove gdb files: sudo rm -rf /usr/local/bin/gdb* /usr/local/bin/ld    Step 4: re-install binutils: sudo apt-get install --reinstall binutils  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »