kushal
kushal

Reputation: 43

Unable to compile C++ programs on CentOS

I am getting the below error during ./configure.

configure:3429: checking whether the C compiler works
configure:3451: gcc -m32 -D_FILE_OFFSET_BITS=64  -m32 conftest.c  >&5
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
configure:3455: $? = 1
configure:3493: result: no

configure:3498: error: in `/root/cjk/1.x/src/externals/mecab':
configure:3500: error: C compiler cannot create executables

I have tried couple of solutions mentioned in internet but to no avail. I have installed complete Developers package in the machine. I have installed glibc-devel.i686 package as well.

Upvotes: 2

Views: 2127

Answers (1)

Atafar
Atafar

Reputation: 717

I ran into the exact same issue (CentOS 6.5 x64, gcc 4.4.7). I made sure yum install glibc-devel.i686 was performed. A quick find / -name "libgcc_s.*" revealed:

/lib64/libgcc_s.so.1
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/libgcc_s.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/libgcc_s.so

So, perhaps you can try the workaround suggested here:

  1. Add the absolute path to the gcc_s library on the link line, OR
  2. (Recommended) If the library's filename has any major and minor version numbers appended to it, simply create a soft link to the library in the same location without the major and minor version numbers in the target filename.

I settled for compiling/linking my application statically by adding -static to my gcc invocation. So,

gcc -static -m32 ...

In that case make sure yum install glibc-static.i686 is done.

Upvotes: 1

Related Questions