问题描述
我尝试使用制作,但无法使用,也。它发生的错误如下:
MYCLASSAAA和MYCLASSBBB都是使用cryptopp lib的类。
它使用cryptlib.h,modes.h,filters.h,aes.h,base64.h,md5.h,hex.h。
I甚至试图自己构建lib,但我同样的错误发生。我该怎么办?
我希望你的帮助。感谢。
添加xcode cmd
和vtable for CRYPTOPP ::〜.o。通知:
架构arm64的未定义符号:CryptoPP :: BufferedTransformation :: ChannelFlush(标准::字符串常量和放大器;,BOOL,INT,BOOL),引用自:
在MYCLASSBBB.o
虚函数表的CryptoPP ::无缓冲<虚函数表的CryptoPP :: SimpleProxyFilter; CryptoPP :: Filter>在MYCLASSBBB.o
我认为 em>使用 libc ++
,这是LLVM的C ++标准库。我认为,因为我没有看到 -stdlib = libc ++
(但我不记得是否传递到 ld
直接)。
符号定义在(这是我的github,btw)。
首先,从fat库中提取arm64库:
$ xcrun -sdk iphoneos lipo libcryptopp.a -thin arm64 -output libcryptopp-arm64.a
$ ls
libcryptopp-arm64.a libcryptopp.a
接下来,使用 nm
转储全局符号,并使用 c ++ filt
to demangle:
$ nm -g libcryptopp-arm64.a | c ++ filt | grep BufferedTransformation :: ChannelFlush | grepT
0000000000002110 T CryptoPP :: BufferedTransformation :: ChannelFlush(std :: __ 1 :: basic_string< char,std :: __ 1 :: char_traits< char>,std :: __ 1 :: allocator< char> ; const& bool,int,bool)
国会 code>表示您要搜索定义和导出的符号。下
t
表示其定义的,但未导出 - 即为私有。 Capitol U
表示其未定义。
__ 1
libc ++
(LLVM)用于区分 libstdc ++
(GNU)。 std :: __ 1 :: basic_string< char,std :: __ 1 :: char_traits< char>,std :: __ 1 :: allocator< char> >
是字符串
,因此可以重写为:
CryptoPP :: BufferedTransformation :: ChannelFlush(std :: __ 1 :: string const& bool,int,bool)
如果此库是根据 libstdc ++
(GNU)构建的,则库中的符号将是:
CryptoPP :: BufferedTransformation :: ChannelFlush(std ::: string const& bool,int,bool)
我们可以为第二个问题子节点重复,它遵循相同的模式( libc ++
,而不是
libstdc ++
):
$ nm -g libcryptopp-arm64.a | c ++ filt | grep CryptoPP :: Filter :: CopyRangeTo2 | grepT
00000000000001c4 T CryptoPP :: Filter :: CopyRangeTo2(CryptoPP :: BufferedTransformation& unsigned long long& unsigned long long,std :: __ 1 :: basic_string< char,std :: __ 1 :: char_traits< ; char>,std :: __ 1 :: allocator< char>> const& bool} const
这可以重写为:
CryptoPP :: Filter :: CopyRangeTo2(CryptoPP :: BufferedTransformation& unsigned long long& unsigned long long,std :: __ 1 :: string const& bool)const
-
如果您需要GNU的 libstdc ++
,那么您可以自行构建。以下是步骤:
- 从网站下载和解压缩Crypto ++
- 下载并解压缩。将其打包到Crypto ++源文件的顶部
- 打开新的
GNUmakefile
,通过搜索以IS_IOS
- 在
IS_IOS
区块中更改此行:CXXFLAGS + = -stdlib = libc ++
。将其更改为CXXFLAGS + = -stdlib = ++的libstdc
- 请交叉编译...
-----
我下载的Cocos2D-X和想看看它的配置(我不是一个Cmake的家伙,所以我可能错了以下)。它在 CmakeList.txt
中有以下内容:
if
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099)
,否则()
集(CMAKE_C_FLAGS_DEBUG-g -Wall -DCOCOS2D_DEBUG = 1)
组(CMAKE_CXX_FLAGS_DEBUG $ {} CMAKE_C_FLAGS_DEBUG)
组(CMAKE_C_FLAGS$ {} CMAKE_C_FLAGS -fno-例外-std = C99)
组(CMAKE_CXX_FLAGS$ {} CMAKE_CXX_FLAGS -fno-例外-std = C ++ 11 -Wno弃用-声明-Wno-重新排序)
如果(CLANG)
组(CMAKE_CXX_FLAGS$ {CMAKE_CXX_FLAGS} -stdlib = libc ++)
endif()
endif(MSVC)
如果 Cmake正在做我怀疑的事情,那么它使用LLVM的 libc ++
。但它也使用 -std = c ++ 11
,并且GitHub项目没有使用它。但我不知道 -std = C ++ 11
使得这里有差别。
刚自行车脱落,但这是一个不好的迹象: _SCL_SECURE_NO_WARNINGS
。如果他们公然这样做,那么他们可能有不同程度的不良和破碎的。 (只是我与审计软件的经验)。
如果有兴趣,在 __ 1
是用于版本控制的内联命名空间。请参见和。
I tried to build with github's prebuilt cryptopp but it doesn't work, too. it occur errors like below:
the MYCLASSAAA and MYCLASSBBB are all of classes what using cryptopp lib.it using cryptlib.h, modes.h, filters.h, aes.h, base64.h, md5.h, hex.h.
I even tried to build the lib myself, but I it same errors happen. what should I do?
I hope your help. thanks.
add the xcode cmd
and "vtable for CRYPTOPP::~.o" always happen. with a notice :
Undefined symbols for architecture arm64: "CryptoPP::BufferedTransformation::ChannelFlush(std::string const&, bool, int, bool)", referenced from:
vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o
vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o
I think you are not using libc++
, which is LLVM's C++ standard library. I think that because I don't see a -stdlib=libc++
(but I don't recall if that's passed to ld
directly).
The symbol is defined in the github's prebuilt cryptopp (that's my github, btw). Here's how to verify.
First, extract the arm64 library from the fat library:
$ xcrun -sdk iphoneos lipo libcryptopp.a -thin arm64 -output libcryptopp-arm64.a
$ ls
libcryptopp-arm64.a libcryptopp.a
Next, use nm
to dump global symbols, and use c++filt
to demangle:
$ nm -g libcryptopp-arm64.a | c++filt | grep BufferedTransformation::ChannelFlush | grep " T "
0000000000002110 T CryptoPP::BufferedTransformation::ChannelFlush(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, int, bool)
The capitol T
means you are searching for symbols that are defined and exported. Lower t
means its defined but not exported - i.e., private. Capitol U
means its undefined.
The __1
is what libc++
(LLVM) uses to differentiate from libstdc++
(GNU). std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >
is a string
, so that could be rewritten as:
CryptoPP::BufferedTransformation::ChannelFlush(std::__1::string const&, bool, int, bool)
If this library was built against libstdc++
(GNU), then the symbol from the library would be:
CryptoPP::BufferedTransformation::ChannelFlush(std:::string const&, bool, int, bool)
We can repeat for the second problem child, and it follows the same pattern (libc++
, and not libstdc++
):
$ nm -g libcryptopp-arm64.a | c++filt | grep CryptoPP::Filter::CopyRangeTo2 | grep " T "
00000000000001c4 T CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long long&, unsigned long long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) const
This can be rewritten as:
CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long long&, unsigned long long, std::__1::string const&, bool) const
-----
IF you need GNU's libstdc++
, then you can build it yourself. Here are the steps:
- Download and unpack Crypto++ from the website
- Download and unpack
cryptopp-mobile.zip
. Unpack it right over top the Crypto++ source files - Open the new
GNUmakefile
, find the iOS rule by searching for the block that begins withIS_IOS
- Change this line in the
IS_IOS
block:CXXFLAGS += -stdlib=libc++
. Change it toCXXFLAGS += -stdlib=libstdc++
- Do the cross compile...
-----
I downloaded Cocos2D-x and tried to look at its configuration (I'm not a Cmake guy, so I could be wrong with what follows). It has the following in CmakeList.txt
:
if(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099)
else()
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -std=c++11 -Wno-deprecated-declarations -Wno-reorder")
if(CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif(MSVC)
If Cmake is doing what I suspect, then its using LLVM's libc++
. But its also using -std=c++11
, and the GitHub project is not using it. But I'm not sure -std=c++11
makes a difference here.
Just bike shedding, but this is a bad sign: _SCL_SECURE_NO_WARNINGS
. If they are blatantly doing that, then they probably have various degrees of of badness and brokenness. (Just my experience with auditing software).
If interested, the __1
is an inline namespace used for versioning. See What are inline namespaces for? and Where does the __1 symbol come from when using LLVM's libc++?.
这篇关于Crypto ++ / iOS 64位项目中的未定义符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!