0

I received the following error in the logs while I was trying to build glibc:

configure:3180: checking whether g++ can link programs
configure:3203: g++ -o conftest -g -O2   conftest.cpp  >&5
configure:3203: $? = 0
configure:3226: g++ -o conftest -g -O2   -static conftest.cpp  >&5
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: cannot find -lm
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
configure:3226: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "glibc"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
| #define PACKAGE_URL "http://www.gnu.org/software/glibc/"
| #define PKGVERSION "(GNU libc) "
| #define REPORT_BUGS_TO "<http://www.gnu.org/software/libc/bugs.html>"
| /* end confdefs.h.  */
|
| #include <iostream>
|
| int
| main()
| {
|   std::cout << "Hello, world!";
|   return 0;
| }
|
configure:3241: result: no
configure:3248: error: you must configure in a separate build directory

Any ideas how to fix it?

How to reproduce it:

Download the glibc from here and try to make ./configure.

1 Answers1

0

I think the error itself if is a good hint? It says you should configure in a build directory, so make a directory called build in the top source directory and cd to it then run ../configure.

Dev2017
  • 857
  • 9
  • 31
  • wait, there is a problem with the libraries as well: `/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: cannot find -lm /usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: cannot find -lc` I think you need to use the -L flag to specify their absolute path. Check these links: http://stackoverflow.com/questions/9875772/linux-c-linker-usr-bin-ld http://stackoverflow.com/questions/25498239/linux-g-compiling-error-usr-bin-ld-cannot-find-l-usr-local-include – Dev2017 Feb 20 '17 at 16:09