nnicandro / emacs-zmq

Emacs bindings to ØMQ
GNU General Public License v2.0
49 stars 18 forks source link

Fail to build on MacOS #6

Closed vv111y closed 5 years ago

vv111y commented 5 years ago

Hi, I'm trying to get this working on a mac and the build fails.

ld: warning: ignoring file ./src/.libs/libzmq.a, file was built for archive which is not the architecture being linked (x86_64): ./src/.libs/libzmq.a
Undefined symbols for architecture x86_64:
  "zmq::radix_tree::add(unsigned char const*, unsigned long)", referenced from:
      _main in benchmark_radix_tree-benchmark_radix_tree.o
  "zmq::radix_tree::check(unsigned char const*, unsigned long)", referenced from:
      void benchmark_lookup<zmq::radix_tree>(zmq::radix_tree&, std::__1::vector<unsigned char*, std::__1::allocator<unsigned char*> >&, std::__1::vector<unsigned char*, std::__1::allocator<unsigned char*> >&) in benchmark_radix_tree-benchmark_radix_tree.o
  "zmq::radix_tree::radix_tree()", referenced from:
      _main in benchmark_radix_tree-benchmark_radix_tree.o
  "zmq::radix_tree::~radix_tree()", referenced from:
      _main in benchmark_radix_tree-benchmark_radix_tree.o
  "zmq::trie_t::add(unsigned char*, unsigned long)", referenced from:
      _main in benchmark_radix_tree-benchmark_radix_tree.o
  "zmq::trie_t::check(unsigned char*, unsigned long)", referenced from:
      void benchmark_lookup<zmq::trie_t>(zmq::trie_t&, std::__1::vector<unsigned char*, std::__1::allocator<unsigned char*> >&, std::__1::vector<unsigned char*, std::__1::allocator<unsigned char*> >&) in benchmark_radix_tree-benchmark_radix_tree.o
  "zmq::trie_t::trie_t()", referenced from:
      _main in benchmark_radix_tree-benchmark_radix_tree.o
  "zmq::trie_t::~trie_t()", referenced from:
      _main in benchmark_radix_tree-benchmark_radix_tree.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [perf/benchmark_radix_tree] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [/Users/Will/.emacs.d/private/emacs-zmq/libzmq/build/v4.3.1/lib/pkgconfig/libzmq.pc] Error 2

For emacs-plus via homebrew make test results in Modules not supported.

I tried the current release from emacsfromacosx, which did seem to have modules support -- ZMQ module not found. Build it? (y or n) came up. However same error as above occurred.

nnicandro commented 5 years ago

OK, it looks like emacs-plus has module support by default. To test if your Emacs has module support could you tell me the value of the variable module-file-suffix?

Also could you replace the line

                --enable-drafts=yes --enable-libunwind=no && \

with

        --enable-drafts=yes --enable-libunwind=no --enable-static=no && \

in the Makefile at the top level of the emacs-zmq directory. It is the second to last line in the file. And then run make and see if it goes through.

vv111y commented 5 years ago

Problem solved. fwiw prefix is .so
So I know for the future, what was the issue?

Thanks for the fix, can't wait to get going with this package.

nnicandro commented 5 years ago

It looks like libzmq tries to build both a static library (libzmq.a) and dynamic library (libzmq.so) by default, but emacs-zmq links to the dynamic library so there is no need to also build the static one, hence the --enable-static=no. Setting --enable-static=no just side steps the real problem. I'm not actually sure what the error is, it may have to do with the version of the clang compiler you are using.