我正在用pjsip开源库开发aes加密。用于aes加密的库不是c编程中提供的内置库。所以,我使用外部库(libmcrypt)进行aes加密。
我通过这个网站把libmcrypt库构建到我的机器(mac osx)中。
https://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/
https://gist.github.com/bricef/2436364
在构建这些库时,它在/usr/local/lib/path中创建了一个动态库(libmcrypt.dylib)。当使用lipo-info libmcrypt.dylib命令检查该库的体系结构时,它显示

Non-fat file: libmcrypt.dylib is architecture: x86_64

但我正在使用pjsip为android和ios设备创建这些应用程序。他们的架构是armeabi(android)和armv7(ios)。
在将libmcrypt.dylib(x86_64)链接到pjsip库(armv7)时,显示以下错误。
Undefined symbols for architecture armv7:
  "_mcrypt_enc_get_block_size", referenced from:
      _encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
      _decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
  "_mcrypt_generic", referenced from:
      _encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
  "_mcrypt_generic_deinit", referenced from:
      _encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
      _decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
  "_mcrypt_generic_init", referenced from:
      _encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
      _decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
  "_mcrypt_module_close", referenced from:
      _encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
      _decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
  "_mcrypt_module_open", referenced from:
      _encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
      _decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
  "_mdecrypt_generic", referenced from:
      _decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../bin/pjsip-test-armv7-apple-darwin_ios] Error 1
make[1]: *** [pjsip-test-armv7-apple-darwin_ios] Error 2
make: *** [all] Error 1

我对这些建筑不太了解。是否可以将libmcrypt.dylib(x86_64)转换为libmcrypt.dylib(armv7)。如果是,那么请指导我如何将其转换为ARMV7体系结构,如果不是,那么请为浪费您的时间而道歉。
提前谢谢!

最佳答案

不要用麦克里特。mcrypt库尚未updated since 2007。切换到openssl或另一个维护的加密项目。
PJSIP文档说明了如何在iOS和Android设备上使用OpenSSL:
highly recommended
https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone#OpenSSLSupport

关于c - 如何在armv7架构中建立mcrypt库?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45737699/

10-08 23:54