我在我的 linux-ubuntu 风格的 NVIDIA Jetson Xavier 上安装了 zmq,如下所示:
sudo apt-get install libzmq3-dev
我创建了一个简单的 ZMQ 服务器,它在 C++ 程序中使用 PUSH/PULL 架构。我可以使用 CLI 编译它,如下所示:
$ gcc -Wall -g server.cpp -lstdc++ -lzmq -o out
然后我将此代码集成到具有更多库和依赖项的更大应用程序中。这是使用 makefile ( makefile.config
) 编译的。要编译更新的应用程序,我需要将-lzmq
标志添加到原始 makefile。这就是我所做的:
-COMMON_FLAGS += -Wall -Wno-deprecated-declarations -std=c++11 $(INCPATHS)
+COMMON_FLAGS += -Wall -g -lstdc++ -lzmq -Wno-deprecated-declarations -std=c++11 $(INCPATHS)
但是在跑步sudo make clean && sudo make
时,我得到
Linking: ../../bin/sample_uff_mask_rcnn_debug
../../bin/dchobj/sampleUffMaskRCNN.o: In function `main':
/home/virus/Desktop/optimisation/custom-inference-mrcnn/maskRCNN/sampleUffMaskRCNN.cpp:717: undefined reference to `zmq_ctx_new'
/home/virus/Desktop/optimisation/custom-inference-mrcnn/maskRCNN/sampleUffMaskRCNN.cpp:718: undefined reference to `zmq_socket'
/home/virus/Desktop/optimisation/custom-inference-mrcnn/maskRCNN/sampleUffMaskRCNN.cpp:724: undefined reference to `zmq_ctx_new'
/home/virus/Desktop/optimisation/custom-inference-mrcnn/maskRCNN/sampleUffMaskRCNN.cpp:725: undefined reference to `zmq_socket'
/home/virus/Desktop/optimisation/custom-inference-mrcnn/maskRCNN/sampleUffMaskRCNN.cpp:726: undefined reference to `zmq_connect'
/home/virus/Desktop/optimisation/custom-inference-mrcnn/maskRCNN/sampleUffMaskRCNN.cpp:737: undefined reference to `zmq_recv'
collect2: error: ld returned 1 exit status
../Makefile.config:301: recipe for target '../../bin/sample_uff_mask_rcnn_debug' failed
make: *** [../../bin/sample_uff_mask_rcnn_debug] Error 1
Makefile 很简单
OUTNAME_RELEASE = sample_uff_mask_rcnn
OUTNAME_DEBUG = sample_uff_mask_rcnn_debug
EXTRA_DIRECTORIES = ../common
.NOTPARALLEL:
MAKEFILE ?= ../Makefile.config
include $(MAKEFILE)
原文makefile.config
可以在这里找到
我觉得我搞砸了 makefile,因为 zmq 在使用gcc
.