问题描述
这是我的makefile.
Here is my makefile.
# The intuitive "all" target will be our default.
.DEFAULT_GOAL := all
# Component dir's to search and invoke make.
# (Try preserving the order of directories)
COM := src_dir1 src_dir2 src_dir3
PROJ_DIR = $(shell pwd)
EXEC := anonymousforconfidentiality
CC := g++
CFLAGS := -g3
LIBS = `pkg-config --cflags --libs glib-2.0 gio-unix-2.0 bluez protobuf lrt`
.PHONY : clean compile link all
all: | clean compile link
link:
$(eval $@_ALLOBJECTS := $(shell find . -name '*.o'))
$(CC) $(CFLAGS) -o $(EXEC) $($@_ALLOBJECTS) $(LIBS)
compile:
for COMDIR in $(COM) ; do \
$(MAKE) INCLUDE_PATH=$(PROJ_DIR) -C $$COMDIR ; \
done
clean:
for COMDIR in $(COM) ; do \
rm -f $$COMDIR/bin/*.o ; \
done
rm -f $(EXEC)
我无法链接库'lrt'.我大量使用了POSIX实时功能,例如mq_open(),mq_send(),mq_receive()等...因此,必须将其链接.
I am not able to link the library 'lrt'. I make extensive use of POSIX real time such as mq_open(), mq_send(), mq_receive() etc... So it is imperative I link it.
我尝试过的一些变化:1.诽谤2. LRT3. rt4. librt-dev
Some of the variations I tried:1. librt2. lrt3. rt4. librt-dev
但是我总是会收到此错误:
However I always get this error:
Package lrt was not found in the pkg-config search path.
Perhaps you should add the directory containing `lrt.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lrt' found
我什至尝试手动安装"librt",但找不到该软件包. apt-get也找不到它.
I even tried to manually install "librt" but was unsuccessful in locating the package. Nor did apt-get find it.
我以为这个库已经预装了Ubuntu普通内核(没有实时补丁).需要解决此问题的帮助.
I was assuming this lib comes prepackaged with Ubuntu normal kernel (no real time patch). Need help with resolution of this issue.
推荐答案
您可能想要链接rt
库.这是通过-lrt
完成的.无需使用pkg-config
.
You probably want to link rt
library. This is done with -lrt
. No need to use pkg-config
for it.
例如:
LIBS := `pkg-config --libs glib-2.0 gio-unix-2.0 bluez protobuf` -lrt
这篇关于Makefile G ++ LRT问题.找不到LRT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!