问题

//usr/lib/x86_64-linux-gnu/libapr-1.so.0:对‘uuid_generate@UUID_1.0’未定义的引用
现象

分析

现象与之前写的问题分析一致,但是同样的方法不能解决问题。
库版本引用问题的解决套路

1发现不同点

仔细查看,在

ldd /usr/lib/x86_64-linux-gnu/libapr-1.so.0 |grep uuid

显示

/usr/lib/x86_64-linux-gnu/libapr-1.so.0: /lib/x86_64-linux-gnu/libuuid.so.1: no version information available (required by /usr/lib/x86_64-linux-gnu/libapr-1.so.0)

这是之前没出现过的问题。

2详细分析

分析/lib/x86_64-linux-gnu/libuuid.so.1文件发现是指向/lib/x86_64-linux-gnu/libuuid.so.1.3.1的链接

 $ nm -C -D /lib/i386-linux-gnu/libuuid.so.1.3.0 

显示为

000000000020300c B __bss_start
                 U close
                 U __ctype_b_loc
                 w __cxa_finalize
000000000020300c D _edata
0000000000203060 B _end
                 U __errno_location
                 U fclose
                 U fcntl
                 U fdopen
                 U fflush
0000000000002154 T _fini
                 U __fprintf_chk
                 U ftruncate
                 U fwrite
                 U getpid
                 U gettimeofday
                 U getuid
                 w __gmon_start__
00000000000011c0 T _init
                 U __isoc99_fscanf
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U memcmp
                 U open
                 U rand
0000000000002090 T random_get_bytes
0000000000001f80 T random_get_fd
                 U read
                 U rewind
                 U __sprintf_chk
                 U srand
                 U __stack_chk_fail
                 U strlen
                 U strtoul
                 U umask
0000000000001300 T uuid_clear
0000000000001310 T uuid_compare
00000000000013b0 T uuid_copy
0000000000001a50 T uuid_generate
0000000000001930 T __uuid_generate_random
0000000000001a00 T uuid_generate_random
00000000000013f0 T __uuid_generate_time
0000000000001910 T uuid_generate_time
0000000000001920 T uuid_generate_time_safe
0000000000001af0 T uuid_is_null
0000000000001b20 T uuid_pack
0000000000001b70 T uuid_parse
0000000000001e20 T uuid_time
0000000000001ed0 T uuid_type
0000000000001ce0 T uuid_unpack
0000000000001e00 T uuid_unparse
0000000000001e10 T uuid_unparse_lower
0000000000001df0 T uuid_unparse_upper
0000000000001f20 T uuid_variant
                 U __xstat

确实没有版本信息,因此怀疑文件在过程中出了问题,去同事电脑用同样命令查看

nm -C -D /lib/x86_64-linux-gnu/libuuid.so.1.3.0                      
                 U access
                 U close
                 U connect
                 U __ctype_b_loc
                 w __cxa_finalize
                 U dcgettext
                 U __errno_location
                 U fclose
                 U fcntl
                 U fdopen
                 U fflush
                 U flock
                 U __fprintf_chk
                 U fscanf
                 U ftruncate
                 U fwrite
                 U getpid
                 U getppid
                 U gettimeofday
                 U getuid
                 w __gmon_start__
                 U ioctl
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U jrand48
                 w _Jv_RegisterClasses
                 U memcmp
                 U nanosleep
                 U open
                 U random
                 U read
                 U rewind
                 U socket
                 U __sprintf_chk
                 U srandom
                 U __stack_chk_fail
                 U strlen
                 U strncpy
                 U strtoul
                 U syscall
                 U time
                 U __tls_get_addr
                 U umask
0000000000000000 A UUID_1.0
0000000000000000 A UUID_2.20
0000000000001610 T uuid_clear
0000000000001620 T uuid_compare
00000000000016c0 T uuid_copy
0000000000000000 A UUIDD_PRIVATE
0000000000002370 T uuid_generate
0000000000002260 T __uuid_generate_random
0000000000002330 T uuid_generate_random
0000000000001850 T __uuid_generate_time
0000000000002240 T uuid_generate_time
0000000000002250 T uuid_generate_time_safe
0000000000002400 T uuid_is_null
0000000000002480 T uuid_parse
0000000000002720 T uuid_time
00000000000027d0 T uuid_type
0000000000002700 T uuid_unparse
0000000000002710 T uuid_unparse_lower
00000000000026f0 T uuid_unparse_upper
0000000000002820 T uuid_variant
                 U write
                 U __xstat

证明了我的怀疑。

解决

复制文件替换掉原有文件

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐