在调用tensorfow(1.14版本)的时候提示ImportError: /lib64/libm.so.6: version `GLIBC_2.23’ not found,表明/lib64库中缺少glibc2.23版本的库,因为glibc库是一个比较重要的库,为了不影响其他人仅自己用,那么我们需要配置我们自己的环境。同时记录一下安装过程中出现的问题
安装glibc2.23
首先说明一点,我在centos下安装的时候出现了一些问题,我觉着很多人应该都会遇到,为了避免再次遇到以及解决问题的网页找不到,源网页是这里,非常感谢。我这里先记录一下:
第一个问题,问题的形式如下:
setenv.c: In function '__unsetenv':
setenv.c:279:6: error: suggest explicit braces to avoid ambiguous 'else' [-Werror=parentheses]
if (ep != NULL)
^
cc1: all warnings being treated as errors
../o-iterator.mk:9: recipe for target '/builddir/build/BUILD/glibc-arm-linux-gnu-2.23/build-arm-linux-gnu-glibc/stdlib/setenv.o' failed
make[2]: *** [/builddir/build/BUILD/glibc-arm-linux-gnu-2.23/build-arm-linux-gnu-glibc/stdlib/setenv.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/builddir/build/BUILD/glibc-arm-linux-gnu-2.23/glibc-2.23/stdlib'
Makefile:214: recipe for target 'stdlib/subdir_lib' failed
make[1]: *** [stdlib/subdir_lib] Error 2
make[1]: Leaving directory '/builddir/build/BUILD/glibc-arm-linux-gnu-2.23/glibc-2.23'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2
解决办法(请注意,下面的代码显示的是diff之后的结果,前面标注+号的地方是需要增加的地方,需要修改的位置第一个文件为680行左右,第二个文件的位置在277行左右)
-----------------------------------------第一个文件-------------------------------------
diff -up glibc-arm-linux-gnu-2.23/glibc-2.23/nis/nis_call.c.gcc61 glibc-arm-linux-gnu-2.23/glibc-2.23/nis/nis_call.c
--- glibc-arm-linux-gnu-2.23/glibc-2.23/nis/nis_call.c.gcc61 2016-02-18 18:54:00.000000000 +0100
+++ glibc-arm-linux-gnu-2.23/glibc-2.23/nis/nis_call.c 2016-05-19 18:44:24.288550322 +0200
@@ -680,6 +680,7 @@ nis_server_cache_add (const_nis_name nam
/* Choose which entry should be evicted from the cache. */
loc = &nis_server_cache[0];
if (*loc != NULL)
+ {
for (i = 1; i < 16; ++i)
if (nis_server_cache[i] == NULL)
{
@@ -690,6 +691,7 @@ nis_server_cache_add (const_nis_name nam
|| ((*loc)->uses == nis_server_cache[i]->uses
&& (*loc)->expires > nis_server_cache[i]->expires))
loc = &nis_server_cache[i];
+ }
old = *loc;
*loc = new;
---------------------------------------------第二个文件---------------------------------------
diff -up glibc-arm-linux-gnu-2.23/glibc-2.23/stdlib/setenv.c.gcc61 glibc-arm-linux-gnu-2.23/glibc-2.23/stdlib/setenv.c
--- glibc-arm-linux-gnu-2.23/glibc-2.23/stdlib/setenv.c.gcc61 2016-02-18 18:54:00.000000000 +0100
+++ glibc-arm-linux-gnu-2.23/glibc-2.23/stdlib/setenv.c 2016-05-19 18:41:09.778640989 +0200
@@ -277,6 +277,7 @@ unsetenv (const char *name)
ep = __environ;
if (ep != NULL)
+ {
while (*ep != NULL)
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
{
@@ -290,6 +291,7 @@ unsetenv (const char *name)
}
else
++ep;
+ }
UNLOCK;
第二个问题,问题形式如下:
问题提示在/tmp之后的位置可能会有一些不一样,因为这是临时文件,主要是后边的问题提示一致即可按照这个方法解决。
/tmp/cc8lsExU.s: Error: symbol `loc1@GLIBC_2.2.5' can't be versioned to common symbol
/tmp/cc8lsExU.s: Error: symbol `loc2@GLIBC_2.2.5' can't be versioned to common symbol
/tmp/cc8lsExU.s: Error: symbol `locs@GLIBC_2.2.5' can't be versioned to common symbol
解决方法:
记得,这里前面写负号的需要删除,或者直接将带负号的行转变为带+号的行。
------------------------------------------第一个文件(只有一个文件)-------------------------------------
diff --git a/misc/regexp.c b/misc/regexp.c
index 19d76c0..9017bc1 100644
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -29,14 +29,17 @@
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
-/* Define the variables used for the interface. */
-char *loc1;
-char *loc2;
+#include <stdlib.h> /* Get NULL. */
+
+/* Define the variables used for the interface. Avoid .symver on common
+ symbol, which just creates a new common symbol, not an alias. */
+char *loc1 = NULL;
+char *loc2 = NULL;
compat_symbol (libc, loc1, loc1, GLIBC_2_0);
compat_symbol (libc, loc2, loc2, GLIBC_2_0);
/* Although we do not support the use we define this variable as well. */
-char *locs;
+char *locs = NULL;
compat_symbol (libc, locs, locs, GLIBC_2_0);