github.com/pebbe/zmq4是对zeromq 4.x的go语言封装,在go中使用了cgo混合编译。
我安装完zeromq4.1.3后,编译时控制台输出如下,麻烦大神看看是什么问题。
[ `go build` | done: 478.984962ms ]
# github.com/pebbe/zmq4
gcc did not produce error at completed:1
on input:
#line 3 "/Users/besthaos/work/study/go/workspace/src/github.com/pebbe/zmq4/zmq4.go"
#include <zmq.h>
#include <zmq_utils.h>
#include <stdlib.h>
#include <string.h>
#include "zmq4.h"
int
zmq4_major = ZMQ_VERSION_MAJOR,
zmq4_minor = ZMQ_VERSION_MINOR,
zmq4_patch = ZMQ_VERSION_PATCH;
#if ZMQ_VERSION_MINOR > 0
// Version >= 4.1.x
typedef struct {
uint16_t event; // id of the event as bitfield
int32_t value; // value is either error code, fd or reconnect interval
} zmq_event_t;
#else
// Version == 4.0.x
const char *zmq_msg_gets (zmq_msg_t *msg, const char *property) {
return NULL;
}
int zmq_has (const char *capability) {
return 0;
}
#if ZMQ_VERSION_PATCH < 5
// Version < 4.0.5
int zmq_proxy_steerable (const void *frontend, const void *backend, const void *capture, const void *control) {
return -1;
}
#endif
#endif
void zmq4_get_event40(zmq_msg_t *msg, int *ev, int *val) {
zmq_event_t event;
const char* data = (char*)zmq_msg_data(msg);
memcpy(&(event.event), data, sizeof(event.event));
memcpy(&(event.value), data+sizeof(event.event), sizeof(event.value));
*ev = (int)(event.event);
*val = (int)(event.value);
}
void zmq4_get_event41(zmq_msg_t *msg, int *ev, int *val) {
uint8_t *data = (uint8_t *) zmq_msg_data (msg);
uint16_t event = *(uint16_t *) (data);
*ev = (int)event;
*val = (int)(*(uint32_t *) (data + 2));
}
void *zmq4_memcpy(void *dest, const void *src, size_t n) {
return memcpy(dest, src, n);
}
#include <sys/types.h> /* for size_t below */
/* Define intgo when compiling with GCC. */
#ifdef __PTRDIFF_TYPE__
typedef __PTRDIFF_TYPE__ intgo;
#elif defined(_LP64)
typedef long long intgo;
#else
typedef int intgo;
#endif
typedef struct { char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
void *_CMalloc(size_t);
#line 1 "not-declared"
void __cgo_f_1_1(void) { __typeof__(zmq_version) *__cgo_undefined__; }
#line 1 "not-type"
void __cgo_f_1_2(void) { zmq_version *__cgo_undefined__; }
#line 1 "not-const"
void __cgo_f_1_3(void) { enum { __cgo__undefined__ = (zmq_version)*1 }; }
#line 2 "not-declared"
void __cgo_f_2_1(void) { __typeof__(zmq_unbind) *__cgo_undefined__; }
#line 2 "not-type"
void __cgo_f_2_2(void) { zmq_unbind *__cgo_undefined__; }
#line 2 "not-const"
void __cgo_f_2_3(void) { enum { __cgo__undefined__ = (zmq_unbind)*1 }; }
#line 3 "not-declared"
void __cgo_f_3_1(void) { __typeof__(zmq_socket_monitor) *__cgo_undefined__; }
#line 3 "not-type"
void __cgo_f_3_2(void) { zmq_socket_monitor *__cgo_undefined__; }
#line 3 "not-const"
void __cgo_f_3_3(void) { enum { __cgo__undefined__ = (zmq_socket_monitor)*1 }; }
#line 4 "not-declared"
void __cgo_f_4_1(void) { __typeof__(zmq_msg_gets) *__cgo_undefined__; }
#line 4 "not-type"
void __cgo_f_4_2(void) { zmq_msg_gets *__cgo_undefined__; }
#line 4 "not-const"
void __cgo_f_4_3(void) { enum { __cgo__undefined__ = (zmq_msg_gets)*1 }; }
#line 5 "not-declared"
void __cgo_f_5_1(void) { __typeof__(free) *__cgo_undefined__; }
#line 5 "not-type"
void __cgo_f_5_2(void) { free *__cgo_undefined__; }
#line 5 "not-const"
void __cgo_f_5_3(void) { enum { __cgo__undefined__ = (free)*1 }; }
#line 6 "not-declared"
void __cgo_f_6_1(void) { __typeof__(zmq_disconnect) *__cgo_undefined__; }
#line 6 "not-type"
void __cgo_f_6_2(void) { zmq_disconnect *__cgo_undefined__; }
#line 6 "not-const"
void __cgo_f_6_3(void) { enum { __cgo__undefined__ = (zmq_disconnect)*1 }; }
#line 7 "not-declared"
void __cgo_f_7_1(void) { __typeof__(zmq_proxy_steerable) *__cgo_undefined__; }
#line 7 "not-type"
void __cgo_f_7_2(void) { zmq_proxy_steerable *__cgo_undefined__; }
#line 7 "not-const"
void __cgo_f_7_3(void) { enum { __cgo__undefined__ = (zmq_proxy_steerable)*1 }; }
#line 8 "not-declared"
void __cgo_f_8_1(void) { __typeof__(zmq_strerror) *__cgo_undefined__; }
#line 8 "not-type"
void __cgo_f_8_2(void) { zmq_strerror *__cgo_undefined__; }
#line 8 "not-const"
void __cgo_f_8_3(void) { enum { __cgo__undefined__ = (zmq_strerror)*1 }; }
#line 9 "not-declared"
void __cgo_f_9_1(void) { __typeof__(ZMQ_EVENT_LISTENING) *__cgo_undefined__; }
#line 9 "not-type"
void __cgo_f_9_2(void) { ZMQ_EVENT_LISTENING *__cgo_undefined__; }
#line 9 "not-const"
void __cgo_f_9_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_LISTENING)*1 }; }
#line 10 "not-declared"
void __cgo_f_10_1(void) { __typeof__(ZMQ_EVENT_DISCONNECTED) *__cgo_undefined__; }
#line 10 "not-type"
void __cgo_f_10_2(void) { ZMQ_EVENT_DISCONNECTED *__cgo_undefined__; }
#line 10 "not-const"
void __cgo_f_10_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_DISCONNECTED)*1 }; }
#line 11 "not-declared"
void __cgo_f_11_1(void) { __typeof__(ZMQ_EVENT_MONITOR_STOPPED) *__cgo_undefined__; }
#line 11 "not-type"
void __cgo_f_11_2(void) { ZMQ_EVENT_MONITOR_STOPPED *__cgo_undefined__; }
#line 11 "not-const"
void __cgo_f_11_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_MONITOR_STOPPED)*1 }; }
#line 12 "not-declared"
void __cgo_f_12_1(void) { __typeof__(size_t) *__cgo_undefined__; }
#line 12 "not-type"
void __cgo_f_12_2(void) { size_t *__cgo_undefined__; }
#line 12 "not-const"
void __cgo_f_12_3(void) { enum { __cgo__undefined__ = (size_t)*1 }; }
#line 13 "not-declared"
void __cgo_f_13_1(void) { __typeof__(zmq_has) *__cgo_undefined__; }
#line 13 "not-type"
void __cgo_f_13_2(void) { zmq_has *__cgo_undefined__; }
#line 13 "not-const"
void __cgo_f_13_3(void) { enum { __cgo__undefined__ = (zmq_has)*1 }; }
#line 14 "not-declared"
void __cgo_f_14_1(void) { __typeof__(zmq_ctx_term) *__cgo_undefined__; }
#line 14 "not-type"
void __cgo_f_14_2(void) { zmq_ctx_term *__cgo_undefined__; }
#line 14 "not-const"
void __cgo_f_14_3(void) { enum { __cgo__undefined__ = (zmq_ctx_term)*1 }; }
#line 15 "not-declared"
void __cgo_f_15_1(void) { __typeof__(zmq_socket) *__cgo_undefined__; }
#line 15 "not-type"
void __cgo_f_15_2(void) { zmq_socket *__cgo_undefined__; }
#line 15 "not-const"
void __cgo_f_15_3(void) { enum { __cgo__undefined__ = (zmq_socket)*1 }; }
#line 16 "not-declared"
void __cgo_f_16_1(void) { __typeof__(zmq_msg_init) *__cgo_undefined__; }
#line 16 "not-type"
void __cgo_f_16_2(void) { zmq_msg_init *__cgo_undefined__; }
#line 16 "not-const"
void __cgo_f_16_3(void) { enum { __cgo__undefined__ = (zmq_msg_init)*1 }; }
#line 17 "not-declared"
void __cgo_f_17_1(void) { __typeof__(zmq4_memcpy) *__cgo_undefined__; }
#line 17 "not-type"
void __cgo_f_17_2(void) { zmq4_memcpy *__cgo_undefined__; }
#line 17 "not-const"
void __cgo_f_17_3(void) { enum { __cgo__undefined__ = (zmq4_memcpy)*1 }; }
#line 18 "not-declared"
void __cgo_f_18_1(void) { __typeof__(zmq_msg_recv) *__cgo_undefined__; }
#line 18 "not-type"
void __cgo_f_18_2(void) { zmq_msg_recv *__cgo_undefined__; }
#line 18 "not-const"
void __cgo_f_18_3(void) { enum { __cgo__undefined__ = (zmq_msg_recv)*1 }; }
#line 19 "not-declared"
void __cgo_f_19_1(void) { __typeof__(zmq4_get_event40) *__cgo_undefined__; }
#line 19 "not-type"
void __cgo_f_19_2(void) { zmq4_get_event40 *__cgo_undefined__; }
#line 19 "not-const"
void __cgo_f_19_3(void) { enum { __cgo__undefined__ = (zmq4_get_event40)*1 }; }
#line 20 "not-declared"
void __cgo_f_20_1(void) { __typeof__(zmq4_major) *__cgo_undefined__; }
#line 20 "not-type"
void __cgo_f_20_2(void) { zmq4_major *__cgo_undefined__; }
#line 20 "not-const"
void __cgo_f_20_3(void) { enum { __cgo__undefined__ = (zmq4_major)*1 }; }
#line 21 "not-declared"
void __cgo_f_21_1(void) { __typeof__(zmq_ctx_set) *__cgo_undefined__; }
#line 21 "not-type"
void __cgo_f_21_2(void) { zmq_ctx_set *__cgo_undefined__; }
#line 21 "not-const"
void __cgo_f_21_3(void) { enum { __cgo__undefined__ = (zmq_ctx_set)*1 }; }
#line 22 "not-declared"
void __cgo_f_22_1(void) { __typeof__(char) *__cgo_undefined__; }
#line 22 "not-type"
void __cgo_f_22_2(void) { char *__cgo_undefined__; }
#line 22 "not-const"
void __cgo_f_22_3(void) { enum { __cgo__undefined__ = (char)*1 }; }
#line 23 "not-declared"
void __cgo_f_23_1(void) { __typeof__(zmq4_patch) *__cgo_undefined__; }
#line 23 "not-type"
void __cgo_f_23_2(void) { zmq4_patch *__cgo_undefined__; }
#line 23 "not-const"
void __cgo_f_23_3(void) { enum { __cgo__undefined__ = (zmq4_patch)*1 }; }
#line 24 "not-declared"
void __cgo_f_24_1(void) { __typeof__(int) *__cgo_undefined__; }
#line 24 "not-type"
void __cgo_f_24_2(void) { int *__cgo_undefined__; }
#line 24 "not-const"
void __cgo_f_24_3(void) { enum { __cgo__undefined__ = (int)*1 }; }
#line 25 "not-declared"
void __cgo_f_25_1(void) { __typeof__(zmq_ctx_get) *__cgo_undefined__; }
#line 25 "not-type"
void __cgo_f_25_2(void) { zmq_ctx_get *__cgo_undefined__; }
#line 25 "not-const"
void __cgo_f_25_3(void) { enum { __cgo__undefined__ = (zmq_ctx_get)*1 }; }
#line 26 "not-declared"
void __cgo_f_26_1(void) { __typeof__(zmq_close) *__cgo_undefined__; }
#line 26 "not-type"
void __cgo_f_26_2(void) { zmq_close *__cgo_undefined__; }
#line 26 "not-const"
void __cgo_f_26_3(void) { enum { __cgo__undefined__ = (zmq_close)*1 }; }
#line 27 "not-declared"
void __cgo_f_27_1(void) { __typeof__(zmq_ctx_new) *__cgo_undefined__; }
#line 27 "not-type"
void __cgo_f_27_2(void) { zmq_ctx_new *__cgo_undefined__; }
#line 27 "not-const"
void __cgo_f_27_3(void) { enum { __cgo__undefined__ = (zmq_ctx_new)*1 }; }
#line 28 "not-declared"
void __cgo_f_28_1(void) { __typeof__(zmq4_minor) *__cgo_undefined__; }
#line 28 "not-type"
void __cgo_f_28_2(void) { zmq4_minor *__cgo_undefined__; }
#line 28 "not-const"
void __cgo_f_28_3(void) { enum { __cgo__undefined__ = (zmq4_minor)*1 }; }
#line 29 "not-declared"
void __cgo_f_29_1(void) { __typeof__(zmq_msg_t) *__cgo_undefined__; }
#line 29 "not-type"
void __cgo_f_29_2(void) { zmq_msg_t *__cgo_undefined__; }
#line 29 "not-const"
void __cgo_f_29_3(void) { enum { __cgo__undefined__ = (zmq_msg_t)*1 }; }
#line 30 "not-declared"
void __cgo_f_30_1(void) { __typeof__(zmq4_get_event41) *__cgo_undefined__; }
#line 30 "not-type"
void __cgo_f_30_2(void) { zmq4_get_event41 *__cgo_undefined__; }
#line 30 "not-const"
void __cgo_f_30_3(void) { enum { __cgo__undefined__ = (zmq4_get_event41)*1 }; }
#line 31 "not-declared"
void __cgo_f_31_1(void) { __typeof__(zmq_z85_encode) *__cgo_undefined__; }
#line 31 "not-type"
void __cgo_f_31_2(void) { zmq_z85_encode *__cgo_undefined__; }
#line 31 "not-const"
void __cgo_f_31_3(void) { enum { __cgo__undefined__ = (zmq_z85_encode)*1 }; }
#line 32 "not-declared"
void __cgo_f_32_1(void) { __typeof__(ZMQ_EVENT_ALL) *__cgo_undefined__; }
#line 32 "not-type"
void __cgo_f_32_2(void) { ZMQ_EVENT_ALL *__cgo_undefined__; }
#line 32 "not-const"
void __cgo_f_32_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_ALL)*1 }; }
#line 33 "not-declared"
void __cgo_f_33_1(void) { __typeof__(ZMQ_EVENT_CONNECTED) *__cgo_undefined__; }
#line 33 "not-type"
void __cgo_f_33_2(void) { ZMQ_EVENT_CONNECTED *__cgo_undefined__; }
#line 33 "not-const"
void __cgo_f_33_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_CONNECTED)*1 }; }
#line 34 "not-declared"
void __cgo_f_34_1(void) { __typeof__(CString) *__cgo_undefined__; }
#line 34 "not-type"
void __cgo_f_34_2(void) { CString *__cgo_undefined__; }
#line 34 "not-const"
void __cgo_f_34_3(void) { enum { __cgo__undefined__ = (CString)*1 }; }
#line 35 "not-declared"
void __cgo_f_35_1(void) { __typeof__(zmq_bind) *__cgo_undefined__; }
#line 35 "not-type"
void __cgo_f_35_2(void) { zmq_bind *__cgo_undefined__; }
#line 35 "not-const"
void __cgo_f_35_3(void) { enum { __cgo__undefined__ = (zmq_bind)*1 }; }
#line 36 "not-declared"
void __cgo_f_36_1(void) { __typeof__(zmq_connect) *__cgo_undefined__; }
#line 36 "not-type"
void __cgo_f_36_2(void) { zmq_connect *__cgo_undefined__; }
#line 36 "not-const"
void __cgo_f_36_3(void) { enum { __cgo__undefined__ = (zmq_connect)*1 }; }
#line 37 "not-declared"
void __cgo_f_37_1(void) { __typeof__(zmq_z85_decode) *__cgo_undefined__; }
#line 37 "not-type"
void __cgo_f_37_2(void) { zmq_z85_decode *__cgo_undefined__; }
#line 37 "not-const"
void __cgo_f_37_3(void) { enum { __cgo__undefined__ = (zmq_z85_decode)*1 }; }
#line 38 "not-declared"
void __cgo_f_38_1(void) { __typeof__(GoString) *__cgo_undefined__; }
#line 38 "not-type"
void __cgo_f_38_2(void) { GoString *__cgo_undefined__; }
#line 38 "not-const"
void __cgo_f_38_3(void) { enum { __cgo__undefined__ = (GoString)*1 }; }
#line 39 "not-declared"
void __cgo_f_39_1(void) { __typeof__(ZMQ_EVENT_BIND_FAILED) *__cgo_undefined__; }
#line 39 "not-type"
void __cgo_f_39_2(void) { ZMQ_EVENT_BIND_FAILED *__cgo_undefined__; }
#line 39 "not-const"
void __cgo_f_39_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_BIND_FAILED)*1 }; }
#line 40 "not-declared"
void __cgo_f_40_1(void) { __typeof__(zmq_proxy) *__cgo_undefined__; }
#line 40 "not-type"
void __cgo_f_40_2(void) { zmq_proxy *__cgo_undefined__; }
#line 40 "not-const"
void __cgo_f_40_3(void) { enum { __cgo__undefined__ = (zmq_proxy)*1 }; }
#line 41 "not-declared"
void __cgo_f_41_1(void) { __typeof__(ZMQ_EVENT_ACCEPT_FAILED) *__cgo_undefined__; }
#line 41 "not-type"
void __cgo_f_41_2(void) { ZMQ_EVENT_ACCEPT_FAILED *__cgo_undefined__; }
#line 41 "not-const"
void __cgo_f_41_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_ACCEPT_FAILED)*1 }; }
#line 42 "not-declared"
void __cgo_f_42_1(void) { __typeof__(ZMQ_EVENT_CLOSED) *__cgo_undefined__; }
#line 42 "not-type"
void __cgo_f_42_2(void) { ZMQ_EVENT_CLOSED *__cgo_undefined__; }
#line 42 "not-const"
void __cgo_f_42_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_CLOSED)*1 }; }
#line 43 "not-declared"
void __cgo_f_43_1(void) { __typeof__(zmq_msg_data) *__cgo_undefined__; }
#line 43 "not-type"
void __cgo_f_43_2(void) { zmq_msg_data *__cgo_undefined__; }
#line 43 "not-const"
void __cgo_f_43_3(void) { enum { __cgo__undefined__ = (zmq_msg_data)*1 }; }
#line 44 "not-declared"
void __cgo_f_44_1(void) { __typeof__(zmq_msg_close) *__cgo_undefined__; }
#line 44 "not-type"
void __cgo_f_44_2(void) { zmq_msg_close *__cgo_undefined__; }
#line 44 "not-const"
void __cgo_f_44_3(void) { enum { __cgo__undefined__ = (zmq_msg_close)*1 }; }
#line 45 "not-declared"
void __cgo_f_45_1(void) { __typeof__(uint8_t) *__cgo_undefined__; }
#line 45 "not-type"
void __cgo_f_45_2(void) { uint8_t *__cgo_undefined__; }
#line 45 "not-const"
void __cgo_f_45_3(void) { enum { __cgo__undefined__ = (uint8_t)*1 }; }
#line 46 "not-declared"
void __cgo_f_46_1(void) { __typeof__(ZMQ_EVENT_CONNECT_RETRIED) *__cgo_undefined__; }
#line 46 "not-type"
void __cgo_f_46_2(void) { ZMQ_EVENT_CONNECT_RETRIED *__cgo_undefined__; }
#line 46 "not-const"
void __cgo_f_46_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_CONNECT_RETRIED)*1 }; }
#line 47 "not-declared"
void __cgo_f_47_1(void) { __typeof__(ZMQ_EVENT_CLOSE_FAILED) *__cgo_undefined__; }
#line 47 "not-type"
void __cgo_f_47_2(void) { ZMQ_EVENT_CLOSE_FAILED *__cgo_undefined__; }
#line 47 "not-const"
void __cgo_f_47_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_CLOSE_FAILED)*1 }; }
#line 48 "not-declared"
void __cgo_f_48_1(void) { __typeof__(zmq_send) *__cgo_undefined__; }
#line 48 "not-type"
void __cgo_f_48_2(void) { zmq_send *__cgo_undefined__; }
#line 48 "not-const"
void __cgo_f_48_3(void) { enum { __cgo__undefined__ = (zmq_send)*1 }; }
#line 49 "not-declared"
void __cgo_f_49_1(void) { __typeof__(ZMQ_EVENT_CONNECT_DELAYED) *__cgo_undefined__; }
#line 49 "not-type"
void __cgo_f_49_2(void) { ZMQ_EVENT_CONNECT_DELAYED *__cgo_undefined__; }
#line 49 "not-const"
void __cgo_f_49_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_CONNECT_DELAYED)*1 }; }
#line 50 "not-declared"
void __cgo_f_50_1(void) { __typeof__(ZMQ_EVENT_ACCEPTED) *__cgo_undefined__; }
#line 50 "not-type"
void __cgo_f_50_2(void) { ZMQ_EVENT_ACCEPTED *__cgo_undefined__; }
#line 50 "not-const"
void __cgo_f_50_3(void) { enum { __cgo__undefined__ = (ZMQ_EVENT_ACCEPTED)*1 }; }
#line 51 "not-declared"
void __cgo_f_51_1(void) { __typeof__(zmq_curve_keypair) *__cgo_undefined__; }
#line 51 "not-type"
void __cgo_f_51_2(void) { zmq_curve_keypair *__cgo_undefined__; }
#line 51 "not-const"
void __cgo_f_51_3(void) { enum { __cgo__undefined__ = (zmq_curve_keypair)*1 }; }
#line 1 "completed"
int __cgo__1 = __cgo__2;
exit status 2