pulsar-client-phpcpp icon indicating copy to clipboard operation
pulsar-client-phpcpp copied to clipboard

macos编译无法通过

Open yjfhfei opened this issue 5 years ago • 2 comments

yjfhfei avatar Oct 16 '20 09:10 yjfhfei

还没用过 mac,可以提供错误信息看看?(虽然大概率我解决不了 :cry:

oraoto avatar Oct 16 '20 10:10 oraoto

我也遇到了,错误信息如下:

g++ -Wall -shared -O2 -o pulsar-phpcpp.so src/Client.o src/Consumer.o src/ConsumerConfiguration.o src/Message.o src/MessageBuilder.o src/MessageId.o src/Producer.o src/Pulsar.o -lphpcpp -lpulsar
Undefined symbols for architecture x86_64:
  "MessageId::latest(Php::Parameters&)", referenced from:
      void Php::ZendCallable::invoke<&(MessageId::latest(Php::Parameters&))>(_zend_execute_data*, _zval_struct*) in MessageId.o
  "MessageId::earliest(Php::Parameters&)", referenced from:
      void Php::ZendCallable::invoke<&(MessageId::earliest(Php::Parameters&))>(_zend_execute_data*, _zval_struct*) in MessageId.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: *** [pulsar-phpcpp.so] Error 1

2021-05-11 18:17:49 update:

已经使用一个笨方法解决了,在 MessageId.cpp 里面新增两个方法

Php::Value MessageId::earliest(Php::Parameters &params) { return ::earliest(); }
Php::Value MessageId::latest(Php::Parameters &params) { return ::latest(); }

cong5 avatar May 10 '21 09:05 cong5