首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Makefile g++ lrt问题。找不到lrt

Makefile g++ lrt问题。找不到lrt
EN

Stack Overflow用户
提问于 2019-07-18 20:13:58
回答 1查看 310关注 0票数 0

这是我的makefile。

代码语言:javascript
复制
# 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()等。所以我必须把它链接起来。

我尝试过的一些变体: 1. librt 2. lrt 3. rt 4. librt dev

然而,我总是得到这样的错误:

代码语言:javascript
复制
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也没有找到它。

我假设这个库预装了Ubuntu普通内核(没有实时补丁)。需要解决此问题的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-18 21:24:10

您可能想要链接rt库。这是通过-lrt完成的。不需要使用pkg-config

例如:

代码语言:javascript
复制
LIBS := `pkg-config --libs glib-2.0 gio-unix-2.0 bluez protobuf` -lrt
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57094210

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档