gpt4 book ai didi

c++ - 使用 libsodium、randombytes 错误为 iOS 构建 zeromq

转载 作者:可可西里 更新时间:2023-11-01 03:00:43 26 4
gpt4 key购买 nike

我正在使用以下方法为 iOS 构建 zeromq 库: https://github.com/drewcrawford/libzmq-ios

除了一些警告出现 3 次之外,构建日志看起来很好:

 CC crypto_scalarmult/curve25519/ref10/libsodium_la-fe_0_curve25519_ref10.lo
randombytes/salsa20/randombytes_salsa20_random.c:278:17: warning: comparison of constant 18446744073709551615 with expression of type
'const size_t' (aka 'const unsigned long') is always true [-Wtautological-constant-out-of-range-compare]
assert(size <= ULONG_LONG_MAX);
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk/usr/include/assert.h:93:25: note:
expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
^
randombytes/sysrandom/randombytes_sysrandom.c:202:17: warning: comparison of constant 18446744073709551615 with expression of type 'const size_t'
(aka 'const unsigned long') is always true [-Wtautological-constant-out-of-range-compare]
assert(size <= ULONG_LONG_MAX);
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk/usr/include/assert.h:93:25: note:
expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)


CXX libzmq_la-null_mechanism.lo
ipc_listener.cpp:127:24: warning: 'tempnam' is deprecated: This function is provided for compatibility reasons only. Due to security concerns
inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead. [-Wdeprecated-declarations]
char *tmpstr = tempnam (NULL, NULL);
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk/usr/include/stdio.h:391:7: note: 'tempnam'
has been explicitly marked deprecated here
char *tempnam(const char *, const char *) __DARWIN_ALIAS(tempnam);
^

当我将构建的库添加到我的 XCode 项目时,它会生成 10 个错误:

Undefined symbols for architecture i386:
"_crypto_box", referenced from:
zmq::curve_client_t::produce_hello(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_client_t::produce_initiate(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_server_t::produce_welcome(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
"_crypto_box_afternm", referenced from:
zmq::curve_client_t::encode(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_server_t::produce_ready(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
zmq::curve_server_t::encode(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
"_crypto_box_beforenm", referenced from:
zmq::curve_client_t::process_welcome(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_server_t::process_initiate(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
"_crypto_box_keypair", referenced from:
_zmq_curve_keypair in libzmq.a(libzmq_la-zmq_utils.o)
zmq::curve_client_t::curve_client_t(zmq::options_t const&) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_server_t::curve_server_t(zmq::session_base_t*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, zmq::options_t const&) in libzmq.a(libzmq_la-curve_server.o)
"_crypto_box_open", referenced from:
zmq::curve_client_t::process_welcome(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_server_t::process_hello(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
zmq::curve_server_t::process_initiate(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
"_crypto_box_open_afternm", referenced from:
zmq::curve_client_t::process_ready(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_client_t::decode(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_server_t::decode(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
"_crypto_secretbox", referenced from:
zmq::curve_server_t::produce_welcome(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
"_crypto_secretbox_open", referenced from:
zmq::curve_server_t::process_initiate(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
"_randombytes", referenced from:
zmq::curve_client_t::produce_initiate(zmq::msg_t*) in libzmq.a(libzmq_la-curve_client.o)
zmq::curve_server_t::produce_welcome(zmq::msg_t*) in libzmq.a(libzmq_la-curve_server.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我认为错误中列出的每个函数都使用警告中列出的随机字节。

当我从 https://github.com/drewcrawford/libzmq-ios/releases 添加库时,也会发生同样的情况

我做错了什么?

最佳答案

看起来您不是唯一遇到此(或类似)问题的人:https://github.com/drewcrawford/libzmq-ios/issues/4

来自链接:“我能够通过将 libc++.dylib 导入我的项目来修复这些错误。”他们的问题是列出 armv7 架构,而不是像您的情况那样列出 i386 架构,但这是值得尝试的事情。

关于c++ - 使用 libsodium、randombytes 错误为 iOS 构建 zeromq,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29556781/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com