jzmq
jzmq copied to clipboard
Build error: ‘zmq_event_t’ was not declared in this scope
Checking out v 3.1.0, running configure:
$ git checkout v3.1.0
HEAD is now at fbc3521... [maven-release-plugin] prepare release v3.1.0
$ ./autogen.sh
...
$ ./configure
...
Ok so far, now trying make
$ make
Making all in src/main/c++
make[1]: Entering directory '/home/etsvigun/devenv/upwork/sageaxcess/jzmq/src/main/c++'
make all-am
make[2]: Entering directory '/home/etsvigun/devenv/upwork/sageaxcess/jzmq/src/main/c++'
/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/lib/jvm/java-7-openjdk/include -I/usr/lib/jvm/java-7-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Event.lo -MD -MP -MF .deps/libjzmq_la-Event.Tpo -c -o libjzmq_la-Event.lo `test -f 'Event.cpp' || echo './'`Event.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -D_REENTRANT -D_THREAD_SAFE -I/usr/lib/jvm/java-7-openjdk/include -I/usr/lib/jvm/java-7-openjdk/include/linux -Wall -g -O2 -MT libjzmq_la-Event.lo -MD -MP -MF .deps/libjzmq_la-Event.Tpo -c Event.cpp -fPIC -DPIC -o .libs/libjzmq_la-Event.o
Event.cpp: In function ‘_jobject* Java_org_zeromq_ZMQ_00024Event_recv(JNIEnv*, jclass, jlong, jint)’:
Event.cpp:60:5: error: ‘zmq_event_t’ was not declared in this scope
zmq_event_t event;
^
Event.cpp:72:13: error: ‘event’ was not declared in this scope
memcpy(&event.event, data, sizeof(event.event));
^
Makefile:578: recipe for target 'libjzmq_la-Event.lo' failed
make[2]: *** [libjzmq_la-Event.lo] Error 1
make[2]: Leaving directory '/home/etsvigun/devenv/upwork/sageaxcess/jzmq/src/main/c++'
Makefile:428: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/etsvigun/devenv/upwork/sageaxcess/jzmq/src/main/c++'
Makefile:400: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
My system details and zeromq package version:
$ uname -a
Linux Jotunheim 3.18.25-1-MANJARO #1 SMP PREEMPT Wed Dec 16 09:02:10 UTC 2015 x86_64 GNU/Linux
$ pacman -Qs zeromq
local/zeromq 4.1.3-4
Fast messaging system built on sockets. C and C++ bindings. aka 0MQ, ZMQ.
Hm, v3.1.0 is two years old, does this problem exist on master too?
FWIW, I'm also getting this error in the v3.1.0 tag but I solved it by cloning from this commit instead.
I also ran into this issue with v3.1.0 (wanted to build a known stable version of jzmq). Pulled master(jzmq) and compilation proceeded normally.
##编辑Event.cpp ,参考代码对比 https://github.com/zeromq/jzmq/commit/eb40d6db43ce3545e623dad6cc6721a90885b5ba 替换不然make install报错
#Event.cpp:60:5: error: 'zmq_event_t' was not declared in this scope
:<<!
Event.cpp: In function '_jobject* Java_org_zeromq_ZMQ_00024Event_recv(JNIEnv*, jclass, jlong, jint)':
Event.cpp:60:5: error: 'zmq_event_t' was not declared in this scope
zmq_event_t event;
^
Event.cpp:60:17: error: expected ';' before 'event'
zmq_event_t event;
^
Event.cpp:72:13: error: 'event' was not declared in this scope
memcpy(&event.event, data, sizeof(event.event));
^
Event.cpp:148:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[2]: *** [libjzmq_la-Event.lo] Error 1
make[2]: Leaving directory /root/jzmq/src/main/c++' make[1]: *** [install] Error 2 make[1]: Leaving directory /root/jzmq/src/main/c++'
make: *** [install-recursive] Error 1
!
#raw格式查看https://raw.githubusercontent.com/zeromq/jzmq/eb40d6db43ce3545e623dad6cc6721a90885b5ba/src/main/c%2B%2B/Event.cpp 复制 编辑到 src/main/c++/Event.cpp
vim src/main/c++/Event.cpp
./autogen.sh ./configure make -j4 && sudo make install
#编译后文件位置 #so文件 #/usr/local/lib #jar #/usr/local/share/java/zmq.jar