Makefile g++ lrt问题。找不到 lrt
Makefile g++ lrt problem. Cannot find lrt
这是我的 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)
我无法 link 图书馆 'lrt'。我大量使用 POSIX 实时,例如 mq_open()、mq_send()、mq_receive() 等...所以我必须 link它。
我试过的一些变化:
1. 剧本
2.轻轨
3. 实时
4. librt-dev
但是我总是得到这个错误:
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 普通内核(没有实时补丁)。需要帮助解决此问题。
您可能想要 link rt
图书馆。这是用 -lrt
完成的。无需为此使用 pkg-config
。
例如:
LIBS := `pkg-config --libs glib-2.0 gio-unix-2.0 bluez protobuf` -lrt
这是我的 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)
我无法 link 图书馆 'lrt'。我大量使用 POSIX 实时,例如 mq_open()、mq_send()、mq_receive() 等...所以我必须 link它。
我试过的一些变化: 1. 剧本 2.轻轨 3. 实时 4. librt-dev
但是我总是得到这个错误:
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 普通内核(没有实时补丁)。需要帮助解决此问题。
您可能想要 link rt
图书馆。这是用 -lrt
完成的。无需为此使用 pkg-config
。
例如:
LIBS := `pkg-config --libs glib-2.0 gio-unix-2.0 bluez protobuf` -lrt