0

I get this error whenever I want to build a program in eclipse.

fatal error: gnu/stubs-32.h: No such file or directory
make: ***[test] Error 1

And this is my simple program

 #include <cstdio>

 int main(){
     printf("Hello");
 }

How to fix this? I'm using Ubuntu 12.04 LTS 32 bit. Any solution will be appreciated.

micmec
  • 23
  • 7

1 Answers1

0

These errors indicate that the supporting 32-bit libraries have not been properly installed!

So you have install missing libraries:

sudo apt-get install gcc-multilib
export LIBRARY_PATH=/usr/lib/$(gcc -print-multiarch)
export C_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)
export CPLUS_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)

Save the export instructions (for example in your .bashrc).

To test on the fly:

  • close eclipse
  • open a console
  • type exports instructions
  • launch eclipse from console

Question is answered also here.

edit

Your problem is that you have gcc in

/usr/local/lib

Instead that in:

/usr/lib

So check this solution:

  • open a console
  • export PATH=/usr/local/bin:$PATH
  • sudo ldconfig
  • launch eclipse
Community
  • 1
  • 1
Luca Davanzo
  • 21,000
  • 15
  • 120
  • 146
  • I got this output when tried to install libc6-dev-i386. Reading package lists... Done Building dependency tree Reading state information... Done Package libc6-dev-i386 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libc6-dev-i386' has no installation candidate – micmec Jan 08 '14 at 14:39
  • take a look to the edit – Luca Davanzo Jan 08 '14 at 14:43
  • maybe is not necessaries the export.. test it and let me know.. – Luca Davanzo Jan 08 '14 at 14:44
  • Just when I try `export LIBRARY_PATH=/usr/lib/$(gcc -print-multiarch)` I got these output. `gcc: error: unrecognized option ‘-print-multiarch’` `gcc: fatal error: no input files` `compilation terminated.` Is this normal? – micmec Jan 08 '14 at 14:49
  • maybe you have an old gcc.. what's the result of "gcc --version" ? – Luca Davanzo Jan 08 '14 at 14:50
  • this is output from `gcc --version`. "gcc (GCC) 4.6.1 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." – micmec Jan 08 '14 at 14:55
  • And this is output from `gcc -v`. "Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.6.1/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../gcc-4.6.1/configure --disable-checking --enable-languages=c,c++ --enable-multiarch --enable-shared --enable-threads=posix --program-suffix=-4.6 --with-gmp=/usr/local/lib --with-mpc=/usr/lib --with-mpfr=/usr/lib --without-included-gettext --with-system-zlib Thread model: posix gcc version 4.6.1 (GCC)" – micmec Jan 08 '14 at 14:56
  • that effort! look at last edit, maybe is only a location problem.. gcc usually is in /usr/lib – Luca Davanzo Jan 08 '14 at 15:03
  • I got this error when `sudo ldconfig`. "/sbin/ldconfig.real: /usr/local/lib/libstdc++.so.6.0.16-gdb.py is not an ELF file - it has the wrong magic bytes at the start." Why is it? – micmec Jan 08 '14 at 15:13
  • sorry I've post you the wrong export, close the console and test in another.. hope it works.. – Luca Davanzo Jan 08 '14 at 15:18
  • Thanks. I happen to found a solution for this. I've found that if I copy stubs-32.h from /usr/include/i386-linux-gnu/gnu to '/usr/include/gnu` then I can compile the program. I still don't understand why I need to copy it though? – micmec Jan 08 '14 at 15:58