我在我的linux口味的NVIDIA Jetson上安装了zmq,如下所示:
sudo apt-get install libzmq3-dev我创建了一个简单的ZMQ服务器,它在C++程序中使用了推拉架构。我能够使用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 1Makefile很简单
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编译时工作。
发布于 2021-11-16 07:28:26
好的,正如@mad科学家所指出的,我错误地将链接器标志-lzmq添加到编译器行,这意味着只包含编译标志,而不是链接器标志。
这就是我所做的改变:
COMMON_LIBS += $(CUDART_LIB)
+COMMON_LIBS += -lzmqhttps://stackoverflow.com/questions/69970824
复制相似问题