Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-606

Static library build failure on Mac OS

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.1.5
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      Version: 1.1.0 or latest master
      Host OS: OS X 10.10.2
      Compiler: Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)

      I'm encountering a linker error consuming a libmongoc static library I built through Xcode:
      https://groups.google.com/forum/#!topic/mongodb-user/E7qkt9con3A

      I was able to replicate the exact linker error outside of Xcode, using the library's own build system. The error occurs when I build just the static library, and not the dylib.

      ```
      ./autogen.sh
      ./configure --with-libbson=no --enable-ssl=no --enable-sasl=no --disable-shared --enable-static && make
      ```

      The static library seems to be missing the non-extern declarations for the counter types, and the linker errors arise when building the tests:

      ```
      CC tests/test_secondary-test-secondary.o
      CC tests/test_secondary-mongoc-tests.o
      CCLD test-secondary
      clang: warning: argument unused during compilation: '-pthread'
      Undefined symbols for architecture x86_64:
      "___mongoc_counter_auth_failure", referenced from:
      __mongoc_cluster_auth_node in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_auth_success", referenced from:
      __mongoc_cluster_auth_node in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_clients_active", referenced from:
      _mongoc_client_new in libmongoc-priv.a(libmongoc_priv_la-mongoc-client.o)
      _mongoc_client_destroy in libmongoc-priv.a(libmongoc_priv_la-mongoc-client.o)
      "___mongoc_counter_clients_disposed", referenced from:
      _mongoc_client_destroy in libmongoc-priv.a(libmongoc_priv_la-mongoc-client.o)
      "___mongoc_counter_cursors_active", referenced from:
      __mongoc_cursor_new in libmongoc-priv.a(libmongoc_priv_la-mongoc-cursor.o)
      __mongoc_cursor_destroy in libmongoc-priv.a(libmongoc_priv_la-mongoc-cursor.o)
      __mongoc_cursor_clone in libmongoc-priv.a(libmongoc_priv_la-mongoc-cursor.o)
      "___mongoc_counter_cursors_disposed", referenced from:
      __mongoc_cursor_destroy in libmongoc-priv.a(libmongoc_priv_la-mongoc-cursor.o)
      "___mongoc_counter_dns_failure", referenced from:
      _mongoc_client_default_stream_initiator in libmongoc-priv.a(libmongoc_priv_la-mongoc-client.o)
      "___mongoc_counter_dns_success", referenced from:
      _mongoc_client_default_stream_initiator in libmongoc-priv.a(libmongoc_priv_la-mongoc-client.o)
      "___mongoc_counter_op_egress_delete", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_getmore", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_insert", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_killcursors", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_msg", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_query", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_reply", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_total", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_egress_update", referenced from:
      __mongoc_cluster_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      __mongoc_cluster_try_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_delete", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_getmore", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_insert", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_killcursors", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_msg", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_query", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_reply", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_total", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_op_ingress_update", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_protocol_ingress_error", referenced from:
      __mongoc_cluster_try_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-cluster.o)
      "___mongoc_counter_streams_active", referenced from:
      _mongoc_stream_buffered_new in libmongoc-priv.a(libmongoc_priv_la-mongoc-stream-buffered.o)
      _mongoc_stream_buffered_destroy in libmongoc-priv.a(libmongoc_priv_la-mongoc-stream-buffered.o)
      "___mongoc_counter_streams_disposed", referenced from:
      _mongoc_stream_buffered_destroy in libmongoc-priv.a(libmongoc_priv_la-mongoc-stream-buffered.o)
      "___mongoc_counter_streams_egress", referenced from:
      _mongoc_socket_sendv in libmongoc-priv.a(libmongoc_priv_la-mongoc-socket.o)
      "___mongoc_counter_streams_ingress", referenced from:
      _mongoc_socket_recv in libmongoc-priv.a(libmongoc_priv_la-mongoc-socket.o)
      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      ```

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            paulmelnikow Paul Melnikow
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: