问题描述
我正在尝试使用 OpenWRT SDK 编译自定义包。 当我编译代码时,我收到此消息
致命错误:MQTTClient.h:没有这样的文件或目录#include "MQTTClient.h"
我确定错误出在 makefile 和未包含的库中
include $(TOPDIR)/rules.mk
# Name,version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=test_app
PKG_VERSION:=1.0
PKG_RELEASE:=1
# Source settings (i.e. where to find the source codes)
# This is a custom variable,used below
SOURCE_DIR:=/home/biagioscarciello/Scrivania/RUT9XX_R_GPL_00.06.07.3/test_app
include $(INCLUDE_DIR)/package.mk
# Package deFinition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/test_app
SECTION:=custom
CATEGORY:=Custom Applications
DEPENDS:=+libpaho-mqtt3c
TITLE:=test_app Application
endef
# Package description; a more verbose description on what our package does
define Package/test_app/description
test_app device -application.
endef
define Build/Configure
$(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef
# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef
# Package build instructions; invoke the target-specific compiler to first compile the source file,and then to link the file into the final executable
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/device_mqtt.o -c $(PKG_BUILD_DIR)/device_mqtt.c -libpaho-mqtt3c
$(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/test_app.o -c $(PKG_BUILD_DIR)/test_app.c
$(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/device_mqtt.o
$(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1
$(PKG_BUILD_DIR)/test_app.o
$(PKG_BUILD_DIR)/device_mqtt.o
结束
define Package/librdkafka/prepare
mkdir -p $(PKG_BUILD_DIR)
$(INSTALL_DIR) $(PKG_BUILD_DIR)/usr/include
$(INSTALL_DIR) $(PKG_BUILD_DIR)/usr/lib
endef
define Package/librdkafka/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
endef
# Package install instructions; create a directory inside the package to hold our executable,and then copy the executable we built prevIoUsly into the folder
define Package/test_app/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/test_app $(1)/usr/bin
endef
# This command is always the last,it uses the deFinitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,test_app))
src-git 自定义 https://github.com/ngohaibac/openwrt-extra-packages
这是 paho 的预编译版本。
我不是在练习 Makefile 和 SDK 世界。
非常感谢您的帮助
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)