C ++:ar -x丢失符号

时间:2019-05-24 06:32:09

标签: c++ static-libraries ar

我不确定是否对ar -x命令有误解,这是重复出现此问题的方法:

步骤1。确保其中有符号:

$ nm librocksdb.a | c++filt | grep -s 'rocksdb::Footer::Footer'

                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
0000000000000740 T rocksdb::Footer::Footer(unsigned long, unsigned int)
0000000000000740 T rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)

步骤2。从librocksdb.a中提取成员并尝试查找符号:

$ ar -x librocksdb.a

$ nm *.o | c++filt | grep -s 'rocksdb::Footer::Footer'
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)
                 U rocksdb::Footer::Footer(unsigned long, unsigned int)

我们可以注意到,所有符号现在都已 U 未定义。

任何人都可以帮助解释为什么或以错误的方式使用它吗?

(背景:我打算做的是从多个静态库中提取所有对象,然后将它们重新打包到一个静态库中)

0 个答案:

没有答案