10

I'm building zeromq library for iOS using this method: https://github.com/drewcrawford/libzmq-ios

The build log looks fine except of some warnings that appear 3 times:

 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);
         ^

When I add builded library to my XCode project, it generate 10 errors:

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)

I think that every function, which was listed in errors, uses randombytes, which was listed in warning.

The same happens when I add library from https://github.com/drewcrawford/libzmq-ios/releases

What I'm doing wrong?

Wez Sie Tato
  • 1,186
  • 12
  • 33
  • These are link errors. Checkout the lib file which contains these symbols provided. e.g. libsodium.a – douyw Apr 17 '15 at 02:00

1 Answers1

0

Looks like you aren't he only one with this (or a similar) issue: https://github.com/drewcrawford/libzmq-ios/issues/4

From the link: "I was able to fix these errors by importing the libc++.dylib into my project." Their issue was listing the armv7 architecture rather than, as in your case, the i386 architecture, but it's something to try.

Jason
  • 13,606
  • 2
  • 29
  • 40