关于undefined referenced xxxx的另一种原因

通常遇到undefined referenced xxx主要是因为引用的函数未定义,或者是找不到类库.

本文介绍的是另外一种情况: 要引用的函数被类库hidden了. 主要原因是编译类库的时候采用了-fvisibility=hidden

GLOBAL_CFLAGS =   -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fsigned-char -fvisibility=hidden

[email protected]:~$ objdump -t libinternalcommon.a

In archive libinternalcommon.a:

socket.o: file format elf32-little

SYMBOL TABLE:

00000000 l df ABS 00000000 socket.c

00000000 l d .text 00000000 .text

00000000 l d .data 00000000 .data

00000000 l d .bss 00000000 .bss

00000000 l d .mdebug.abi32 00000000 .mdebug.abi32

00000000 l O .bss 00000004 verbose

00000000 l d .rodata.str1.4 00000000 .rodata.str1.4

00000018 l O .rodata 00000010 func.4182

00000038 l O .rodata 00000014 func.4136

00000028 l O .rodata 0000000f func.4157

00000000 l O .rodata 00000017 func.4227

00000000 l d .rodata 00000000 .rodata

00000000 l .rodata.str1.4 00000000 LC000000024l.rodata.str1.400000000LC1

00000030 l .rodata.str1.4 00000000 LC20000003cl.rodata.str1.400000000LC3

00000054 l .rodata.str1.4 00000000 LC40000005cl.rodata.str1.400000000LC5

00000064 l .rodata.str1.4 00000000 LC60000006cl.rodata.str1.400000000LC7

00000080 l .rodata.str1.4 00000000 LC8000000a0l.rodata.str1.400000000LC9

000000b0 l .rodata.str1.4 00000000 LC10000000c4l.rodata.str1.400000000LC11

000000d0 l .rodata.str1.4 00000000 LC12000000e0l.rodata.str1.400000000LC13

000000e8 l .rodata.str1.4 00000000 LC14000000f4l.rodata.str1.400000000LC15

0000010c l .rodata.str1.4 00000000 LC1600000138l.rodata.str1.400000000LC17

00000140 l .rodata.str1.4 00000000 $LC18

00000000 l d .reginfo 00000000 .reginfo

00000000 l d .pdr 00000000 .pdr

00000000 l d .comment 00000000 .comment

00000000 l d .gnu.attributes 00000000 .gnu.attributes

00000000 g F .text 00000018 .hidden socket_set_verbose

00000000 O UND 00000000 _gp_disp

00000018 g F .text 00000278 .hidden socket_check_fd

00000000 UND 00000000 stderr

00000000 UND 00000000 fprintf

00000000 UND 00000000 select

00000000 UND 00000000 __errno_location

00000000 UND 00000000 strerror

00000290 g F .text 00000064 .hidden socket_accept

00000000 UND 00000000 accept

000002f4 g F .text 00000018 .hidden socket_shutdown

00000000 UND 00000000 shutdown

0000030c g F .text 00000018 .hidden socket_close

00000000 UND 00000000 close

00000324 g F .text 00000128 .hidden socket_create_unix

00000000 UND 00000000 unlink

00000000 UND 00000000 socket

00000000 UND 00000000 perror

00000000 UND 00000000 strncpy

00000000 UND 00000000 strlen

00000000 UND 00000000 bind

00000000 UND 00000000 listen

0000044c g F .text 00000220 .hidden socket_connect_unix

00000000 UND 00000000 stat

00000000 UND 00000000 connect

0000066c g F .text 0000017c .hidden socket_create

00000000 UND 00000000 setsockopt

000007e8 g F .text 00000224 .hidden socket_connect

00000000 UND 00000000 gethostbyname

00000a0c g F .text 000000f4 .hidden socket_receive_timeout

00000000 UND 00000000 recv

00000b00 g F .text 00000038 .hidden socket_receive

00000b38 g F .text 00000038 .hidden socket_peek

00000b70 g F .text 00000018 .hidden socket_send

00000000 UND 00000000 send

thread.o: file format elf32-little

SYMBOL TABLE:

00000000 l df ABS 00000000 thread.c

00000000 l d .text 00000000 .text

00000000 l d .data 00000000 .data

00000000 l d .bss 00000000 .bss

00000000 l d .mdebug.abi32 00000000 .mdebug.abi32

00000000 l d .reginfo 00000000 .reginfo

00000000 l d .pdr 00000000 .pdr

00000000 l d .comment 00000000 .comment

00000000 l d .gnu.attributes 00000000 .gnu.attributes

00000000 g F .text 00000024 .hidden thread_new

00000000 O UND 00000000 _gp_disp

00000000 UND 00000000 pthread_create

00000024 g F .text 00000008 .hidden thread_free

0000002c g F .text 00000018 .hidden thread_join

00000000 UND 00000000 pthread_join

00000044 g F .text 00000018 .hidden mutex_init

00000000 UND 00000000 pthread_mutex_init

0000005c g F .text 00000018 .hidden mutex_destroy

00000000 UND 00000000 pthread_mutex_destroy

00000074 g F .text 00000018 .hidden mutex_lock

00000000 UND 00000000 pthread_mutex_lock

0000008c g F .text 00000018 .hidden mutex_unlock

00000000 UND 00000000 pthread_mutex_unlock

000000a4 g F .text 00000018 .hidden thread_once

00000000 UND 00000000 pthread_once

debug.o: file format elf32-little

SYMBOL TABLE:

00000000 l df ABS 00000000 debug.c

00000000 l d .text 00000000 .text

00000000 l d .data 00000000 .data

00000000 l d .bss 00000000 .bss

00000000 l d .mdebug.abi32 00000000 .mdebug.abi32

00000000 l O .bss 00000004 debug_level

00000000 l d .rodata.str1.4 00000000 .rodata.str1.4

00000000 l .rodata.str1.4 00000000 LC00000000cl.rodata.str1.400000000LC1

0000001c l .rodata.str1.4 00000000 LC20000002cl.rodata.str1.400000000LC4

00000024 l .rodata.str1.4 00000000 LC300000030l.rodata.str1.400000000LC5

00000038 l .rodata.str1.4 00000000 LC600000040l.rodata.str1.400000000LC7

00000044 l .rodata.str1.4 00000000 LC800000060l.rodata.str1.400000000LC9

00000000 l d .reginfo 00000000 .reginfo

00000000 l d .pdr 00000000 .pdr

00000000 l d .comment 00000000 .comment

00000000 l d .gnu.attributes 00000000 .gnu.attributes

00000000 g F .text 00000018 .hidden internal_set_debug_level

00000000 O UND 00000000 _gp_disp

00000018 g F .text 0000017c .hidden debug_info_real

00000000 UND 00000000 vasprintf

00000000 UND 00000000 time

00000000 UND 00000000 malloc

00000000 UND 00000000 localtime

00000000 UND 00000000 strftime

00000000 UND 00000000 asprintf

00000000 UND 00000000 free

00000000 UND 00000000 printf

00000000 UND 00000000 puts

00000000 UND 00000000 stdout

00000000 UND 00000000 fflush

00000194 g F .text 000001c0 .hidden debug_buffer

00000000 UND 00000000 stderr

00000000 UND 00000000 fprintf

00000000 UND 00000000 fputs

00000000 UND 00000000 fputc

00000354 g F .text 000000b4 .hidden debug_buffer_to_file

00000000 UND 00000000 fopen

00000000 UND 00000000 fwrite

00000000 UND 00000000 fclose

00000408 g F .text 000000f0 .hidden debug_plist_real

00000000 UND 00000000 plist_to_xml

userpref.o: file format elf32-little

SYMBOL TABLE:

00000000 l df ABS 00000000 userpref.c

00000000 l d .text 00000000 .text

00000000 l d .data 00000000 .data

00000000 l d .bss 00000000 .bss

00000000 l d .mdebug.abi32 00000000 .mdebug.abi32

00000000 l d .rodata.str1.4 00000000 .rodata.str1.4

00000000 l F .text 000000fc X509_add_ext_helper

00000000 l O .rodata 00000014 FUNCTION.13990

00000000 l O .bss 00000004 __config_dir

00000070 l O .rodata 00000018 FUNCTION.13928

00000054 l O .rodata 0000001a FUNCTION.13933

00000038 l O .rodata 0000001a FUNCTION.13953

00000014 l O .rodata 00000024 FUNCTION.14001

00000000 l d .rodata 00000000 .rodata

00000000 l .rodata.str1.4 00000000 LC00000000cl.rodata.str1.400000000LC1

00000038 l .rodata.str1.4 00000000 LC200000044l.rodata.str1.400000000LC3

00000048 l .rodata.str1.4 00000000 LC400000054l.rodata.str1.400000000LC5

00000084 l .rodata.str1.4 00000000 LC700000074l.rodata.str1.400000000LC6

00000090 l .rodata.str1.4 00000000 LC8000000b8l.rodata.str1.400000000LC9

000000c0 l .rodata.str1.4 00000000 LC10000000f4l.rodata.str1.400000000LC11

00000100 l .rodata.str1.4 00000000 LC1200000108l.rodata.str1.400000000LC13

0000012c l .rodata.str1.4 00000000 LC1400000140l.rodata.str1.400000000LC15

00000154 l .rodata.str1.4 00000000 LC1600000180l.rodata.str1.400000000LC17

000001a4 l .rodata.str1.4 00000000 LC18000001acl.rodata.str1.400000000LC19

000001ec l .rodata.str1.4 00000000 LC2000000200l.rodata.str1.400000000LC21

00000210 l .rodata.str1.4 00000000 LC2200000220l.rodata.str1.400000000LC23

00000230 l .rodata.str1.4 00000000 $LC24

00000000 l d .reginfo 00000000 .reginfo

00000000 l d .pdr 00000000 .pdr

00000000 l d .comment 00000000 .comment

00000000 l d .gnu.attributes 00000000 .gnu.attributes

00000000 O UND 00000000 _gp_disp

00000000 UND 00000000 X509V3_set_ctx

00000000 UND 00000000 X509V3_EXT_conf_nid

00000000 UND 00000000 debug_info_real

00000000 UND 00000000 X509_add_ext

00000000 UND 00000000 X509_EXTENSION_free

000000fc g F .text 0000010c .hidden userpref_get_config_dir

00000000 UND 00000000 strdup

00000000 UND 00000000 string_concat

00000000 UND 00000000 free

00000000 UND 00000000 strlen

00000208 g F .text 000000ac .hidden userpref_read_system_buid

00000000 UND 00000000 usbmuxd_read_buid

000002b4 g F .text 000000bc .hidden userpref_has_pair_record

00000000 UND 00000000 stat

00000370 g F .text 0000024c .hidden userpref_get_paired_udids

00000000 UND 00000000 opendir

00000000 UND 00000000 readdir

00000000 UND 00000000 strstr

00000000 UND 00000000 malloc

00000000 UND 00000000 strncpy

00000000 UND 00000000 closedir

000005bc g F .text 00000080 .hidden userpref_save_pair_record

00000000 UND 00000000 plist_to_bin

00000000 UND 00000000 usbmuxd_save_pair_record

0000063c g F .text 000000e4 .hidden userpref_read_pair_record

00000000 UND 00000000 usbmuxd_read_pair_record

00000000 UND 00000000 memcmp

00000000 UND 00000000 plist_from_bin

00000000 UND 00000000 plist_from_xml

00000720 g F .text 0000003c .hidden userpref_delete_pair_record

00000000 UND 00000000 usbmuxd_delete_pair_record

0000075c g F .text 00000080 .hidden pair_record_get_host_id

00000000 UND 00000000 plist_dict_get_item

00000000 UND 00000000 plist_get_node_type

00000000 UND 00000000 plist_get_string_val

000007dc g F .text 0000005c .hidden pair_record_set_host_id

00000000 UND 00000000 plist_new_string

00000000 UND 00000000 plist_dict_set_item

00000838 g F .text 0000012c .hidden pair_record_get_item_as_key_data

00000000 UND 00000000 plist_get_data_val

00000000 UND 00000000 memcpy

00000964 g F .text 00000024 .hidden pair_record_import_key_with_name

00000988 g F .text 00000024 .hidden pair_record_import_crt_with_name

000009ac g F .text 0000007c .hidden pair_record_set_item_from_key_data

00000000 UND 00000000 plist_new_data

00000a28 g F .text 00000c38 .hidden pair_record_generate_keys_and_certs

00000000 UND 00000000 BN_new

00000000 UND 00000000 RSA_new

00000000 UND 00000000 BN_set_word

00000000 UND 00000000 RSA_generate_key_ex

00000000 UND 00000000 BN_free

00000000 UND 00000000 EVP_PKEY_new

00000000 UND 00000000 EVP_PKEY_assign

00000000 UND 00000000 X509_new

00000000 UND 00000000 ASN1_INTEGER_new

00000000 UND 00000000 ASN1_INTEGER_set

00000000 UND 00000000 X509_set_serialNumber

00000000 UND 00000000 ASN1_INTEGER_free

00000000 UND 00000000 X509_set_version

00000000 UND 00000000 ASN1_TIME_new

00000000 UND 00000000 time

00000000 UND 00000000 ASN1_TIME_set

00000000 UND 00000000 X509_set_notBefore

00000000 UND 00000000 X509_set_notAfter

00000000 UND 00000000 ASN1_TIME_free

00000000 UND 00000000 X509_set_pubkey

00000000 UND 00000000 EVP_sha1

00000000 UND 00000000 X509_sign

00000000 UND 00000000 BIO_new_mem_buf

00000000 UND 00000000 BIO_s_mem

00000000 UND 00000000 BIO_new

00000000 UND 00000000 PEM_write_bio_X509

00000000 UND 00000000 BIO_ctrl

00000000 UND 00000000 BIO_free

00000000 UND 00000000 PEM_write_bio_PrivateKey

00000000 UND 00000000 PEM_read_bio_RSAPublicKey

00000000 UND 00000000 EVP_PKEY_free

00000000 UND 00000000 X509V3_EXT_cleanup

00000000 UND 00000000 X509_free

utils.o: file format elf32-little

SYMBOL TABLE:

00000000 l df ABS 00000000 utils.c

00000000 l d .text 00000000 .text

00000000 l d .data 00000000 .data

00000000 l d .bss 00000000 .bss

00000000 l d .mdebug.abi32 00000000 .mdebug.abi32

00000000 l d .rodata.str1.4 00000000 .rodata.str1.4

00000000 l F .text 00000478 plist_node_print_to_stream

00000024 l O .rodata 00000041 base64_str

0000062c l F .text 00000118 plist_array_print_to_stream

00000478 l F .text 000001b4 plist_dict_print_to_stream

00000000 l d .rodata.cst8 00000000 .rodata.cst8

00000000 l d .rodata 00000000 .rodata

00000000 l .rodata.str1.4 00000000 LC000000008l.rodata.str1.400000000LC1

00000010 l .rodata.str1.4 00000000 LC200000014l.rodata.str1.400000000LC3

0000001c l .rodata.str1.4 00000000 LC400000020l.rodata.str1.400000000LC5

00000028 l .rodata.str1.4 00000000 LC60000003cl.rodata.str1.400000000LC7

00000040 l .rodata.str1.4 00000000 LC800000044l.rodata.str1.400000000LC9

0000004c l .rodata.str1.4 00000000 LC1000000050l.rodata.str1.400000000LC11

00000058 l .rodata.str1.4 00000000 LC1200000000l.rodata.cst800000000LC14

0000005c l .rodata.str1.4 00000000 LC1300000008l.rodata.cst800000000LC16

00000068 l .rodata.str1.4 00000000 LC1500000010l.rodata.cst800000000LC18

00000074 l .rodata.str1.4 00000000 LC1700000018l.rodata.cst800000000LC20

00000080 l .rodata.str1.4 00000000 LC190000008cl.rodata.str1.400000000LC21

00000098 l .rodata.str1.4 00000000 LC22000000acl.rodata.str1.400000000LC23

000000b0 l .rodata.str1.4 00000000 LC24000000b4l.rodata.str1.400000000LC25

00000000 l d .reginfo 00000000 .reginfo

00000000 l d .pdr 00000000 .pdr

00000000 l d .comment 00000000 .comment

00000000 l d .gnu.attributes 00000000 .gnu.attributes

00000000 O UND 00000000 _gp_disp

00000000 UND 00000000 plist_get_node_type

00000000 UND 00000000 plist_get_bool_val

00000000 UND 00000000 fprintf

00000000 UND 00000000 plist_get_uint_val

00000000 UND 00000000 plist_get_real_val

00000000 UND 00000000 plist_get_string_val

00000000 UND 00000000 plist_get_key_val

00000000 UND 00000000 plist_get_data_val

00000000 UND 00000000 malloc

00000000 UND 00000000 free

00000000 UND 00000000 fputc

00000000 UND 00000000 plist_get_date_val

00000000 UND 00000000 localtime

00000000 UND 00000000 strftime

00000000 UND 00000000 plist_dict_new_iter

00000000 UND 00000000 plist_dict_next_item

00000000 UND 00000000 fputs

00000000 UND 00000000 plist_array_get_size

00000000 UND 00000000 plist_array_get_item

00000744 g F .text 00000100 .hidden string_concat

00000000 UND 00000000 strlen

00000000 UND 00000000 stpcpy

00000844 g F .text 0000011c .hidden string_build_path

00000000 UND 00000000 strcpy

00000000 UND 00000000 strcat

00000000 O UND 00000000 __floatundidf

00000000 O UND 00000000 __divdf3

00000960 g F .text 000001c8 .hidden string_format_size

00000000 UND 00000000 sprintf

00000000 UND 00000000 strdup

00000b28 g F .text 00000098 .hidden string_toupper

00000000 UND 00000000 __ctype_toupper

00000bc0 g F .text 0000010c .hidden generate_uuid

00000000 UND 00000000 time

00000000 UND 00000000 srand

00000000 UND 00000000 rand

00000ccc g F .text 0000014c .hidden buffer_read_from_filename

00000000 UND 00000000 fopen

00000000 UND 00000000 fseek

00000000 UND 00000000 ftell

00000000 UND 00000000 rewind

00000000 UND 00000000 fclose

00000000 UND 00000000 fread

00000e18 g F .text 0000009c .hidden buffer_write_to_filename

00000000 UND 00000000 fwrite

00000eb4 g F .text 000000e8 .hidden plist_read_from_filename

00000000 UND 00000000 plist_from_xml

00000000 UND 00000000 memcmp

00000000 UND 00000000 plist_from_bin

00000f9c g F .text 000000a8 .hidden plist_write_to_filename

00000000 UND 00000000 plist_to_xml

00000000 UND 00000000 plist_to_bin

00001044 g F .text 000000a4 .hidden plist_print_to_stream

修复此问题, 需要取出编译选项.但是我去掉之后,仍然没有正常工作,在我发现即使可以正常编译也无法满足我的需求的时候,我暂停了尝试, 你如果有需要可以试试.

时间: 2024-08-10 16:57:08

关于undefined referenced xxxx的另一种原因的相关文章

MySQL乱码的几种原因

MySQL之所以会乱码,无非是以下几种原因: 1.存进数据库之前就乱码 2.在存进数据库过程中乱码 3.存进数据库后乱码 想知道在哪里出现乱码很简单,在后台打印一下就知道了. 既然知道问题出在哪里,那解决方法也很简单: 1.jsp设置编码是utf-8,保证传到后台的是utf-8的编码 2.在数据库连接上加这么一段jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8,保证传输过程是utf-8的. 3.设置数

事件加不上的另一种原因

UIImageView *v = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, _msg.contentF.size.width, _msg.contentF.size.height)]; [v setImageWithURL:[NSURL URLWithString:_msg.msg]]; CGImageRef imgRef= [v.image CGImage]; CGFloat w= CGImageGetWidth(imgRef); C

盘点网站百度快照回档或不更新的12种原因

相信很多站长朋友都遇到过网站百度快照回档或停滞不前的情况,那到底是由什么因素引起的呢?下面我总结了十种常见的因素,如果你的网站目前正常出现这种现象,那么可以看一下以下几种原因,且做出相应的修正. 1.网站内容长期不更新 很多网站特别是企业网站长期处于无人管理状态,网站的内容甚至半年都不更新一次,像这种站点,蜘蛛爬行的次数会慢慢减少,甚至是不爬行,导致网站百度快照回档或不更新. 2.网站标题经常改动 特别是一些新手站长,在自身搜索引擎蜘蛛比较缺乏的情况下建起的站点,在学习过程中发现自己的标题并不是

猎头不来找你的5种原因

如今,猎头们确实忙的不可开交.但如果他们没有给你回电话,可不仅仅是因为他们时间紧迫. 凯撒?乌略亚是马萨诸塞州沃尔瑟姆市猎头公司WinterWyman的资深猎头.他听到愤怒的求职者们抱怨最多的是,猎头们似乎对他们的电话视而不见.投递的简历杳无音信,确实令人懊恼,但乌略亚认为,根本原因不外乎以下五点: 1. 简历毫无亮点.乌略亚表示:"简历除了展示求职者的背景.经历和教育外,还可以展示求职者对细节的关注,甚至一个人的智商."他见过许多简历中有拼写错误.打印错误.信息不全,或者简历的格式令

nginx:403 forbidden 二种原因

出现403 forbidden的两种原因:1.是缺少索引文件(index.html/inde.php):2.是权限问题 一.缺少索引文件index.html/inde.php 比如下面的配置: server { listen 80; server_name z.com; location / { root /home/www/zgw/; index index.html; } } 当你在/home/www/zgw/下面没有index.html文件,此时你使用z.com来访问时,它找不到索引文件,

【RS】关于路由器ping不通直连的几种原因(1)

1.不在同一子网R1int e0/0/0ip add 192.168.1.1 255.255.255.248R2int e0/0/0ip add 192.168.1.9 255.255.255.248    由配置知,子网长度为29位,地址块为8,所以192.168.1.1-7为同一子网,9-15为另一子网.192.168.1.0和192.168.1.8是网段,不是地址.而直连必须在同一子网,否则讲无法ping通.    但还有一种情况,包含关系:R1int e0/0/0ip add 192.1

【RS】关于路由器ping不通直连的几种原因(2)

2.Static route 静态路由与最长匹配R1int E0/0/0ip add 192.168.1.1 255.255.255.0R2int E0/0/0ip add 192.168.1.2 24ip route-s 192.168.1.1 255.255.255.0 NULL0  //Null 0为逻辑接口,数据包到达此接口即丢弃. [R2]dis cur | in routeospf 10 router-id 2.2.2.2ip route-static 192.168.1.1 255

分析电脑死机的常见的几种原因,以及对应的解决方法

很多的电脑用户都遇到过各种各样的电脑故障,例如花屏.黑屏.又或者是电脑无法开机.死机等等都是比较常见的故障,为了修好电脑,我们今天就来了解下,当电脑经常死机,我们用什么方法解决呢?下面就跟随小编一起来看下吧.造成电脑死机的因素有哪些呢,小编咨询了一些精通电脑维修技术的大手子,也在网上查询了许多相关的资料,并结合我自己遇到的死机的情况,来给大家谈谈导致电脑死机的四大因素,并在每个因素中讲解了具体的解决办法和注意事项,希望能帮到更多的朋友,让电脑不再受到各种故障的困扰,也不必花大价钱去电脑城维修.

Linux ssh登陆慢的两种原因分析

Linux ssh登陆慢的两种原因分析 如果做运维就一定会遇到ssh登陆Linux服务器慢的问题,问题比较好解决,一般Google之后有很多文章都告诉你解决方法,但是很少有文章分析为什么会慢,这篇文章简单分析下ssh登陆慢的原因. useDNS配置导致登陆慢 如果ssh server的配置文件(通常是 /etc/ssh/sshd_config )中设置 useDNS yes ,可能会导致 ssh 登陆卡住几十秒.按照网上的方法将该配置项设为 no,然后重启 ssh 服务,再次登陆就恢复正常,但至