解决openwrt ipk missing dependencies libpthread librt .

来源:互联网 发布:mysql从入门到精通下载 编辑:程序博客网 时间:2024/05/29 16:22

新版本的trunk有在ipk打包的过程中的bug,他不能自动识别SDK中已经变异的动态链接库,比如libpthread,libboost这些。


解决方案是修改与pakage里同级的makefile的内容:

可以修改如下:

主要是添加DEPENDS与拷贝动态链接库到安装目录。找了很久,很多国外的论坛才,找到的思路。


[html] view plaincopyprint?
  1. ##############################################  
  2. # OpenWrt Makefile for Scada_Em program  
  3. #  
  4. #  
  5. # Most of the variables used here are defined in  
  6. # the include directives below. We just need to  
  7. # specify a basic description of the package,  
  8. # where to build our program, where to find  
  9. # the source files, and where to install the  
  10. # compiled program on the router.  
  11. #  
  12. # Be very careful of spacing in this file.  
  13. # Indents should be tabs, not spaces, and  
  14. # there should be no trailing whitespace in  
  15. # lines that are not commented.  
  16. #  
  17. ##############################################  
  18.   
  19. include $(TOPDIR)/rules.mk  
  20.   
  21. # Name and release number of this package  
  22. PKG_NAME:=Scada_Em  
  23. PKG_RELEASE:=1  
  24.   
  25.   
  26. # This specifies the directory where we're going to build the program.   
  27. # The root build directory, $(BUILD_DIR), is by default the build_mipsel  
  28. # directory in your OpenWrt SDK directory  
  29. PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)  
  30.   
  31.   
  32. include $(INCLUDE_DIR)/package.mk  
  33.   
  34. # Specify package information for this program.  
  35. # The variables defined here should be self explanatory.  
  36. # If you are running Kamikaze, delete the DESCRIPTION  
  37. # variable below and uncomment the Kamikaze define  
  38. # directive for the description below  
  39. define Package/Scada_Em  
  40.     SECTION:=utils  
  41.     CATEGORY:=Utilities  
  42.     TITLE:=Scada_Em -- prints a snarky message  
  43.     DEPENDS:=+libpthread +librt  
  44. endef  
  45.   
  46. # Uncomment portion below for Kamikaze and delete DESCRIPTION variable above  
  47. define Package/Scada_Em/description  
  48.     If you can't figure out what this program does, you're probably  
  49.     brain-dead and need immediate medical attention.  
  50. endef  
  51.   
  52.   
  53.   
  54. # Specify what needs to be done to prepare for building the package.  
  55. # In our case, we need to copy the source files to the build directory.  
  56. # This is NOT the default.  The default uses the PKG_SOURCE_URL and the  
  57. # PKG_SOURCE which is not defined here to download the source from the web.  
  58. # In order to just build a simple program that we have just written, it is  
  59. # much easier to do it this way.  
  60. define Build/Prepare  
  61.     mkdir -p $(PKG_BUILD_DIR)  
  62.     $(CP) ./src/* $(PKG_BUILD_DIR)/  
  63. endef  
  64.   
  65.   
  66. # We do not need to define Build/Configure or Build/Compile directives  
  67. # The defaults are appropriate for compiling a simple program such as this one  
  68.   
  69.   
  70. # Specify where and how to install the program. Since we only have one file,  
  71. # the Scada_Em executable, install it by copying it to the /bin directory on  
  72. # the router. The $(1) variable represents the root directory on the router running  
  73. # OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install  
  74. # directory if it does not already exist.  Likewise $(INSTALL_BIN) contains the  
  75. # command to copy the binary file from its current location (in our case the build  
  76. # directory) to the install directory.  
  77. #define Package/Scada_Em/install  
  78. #   $(INSTALL_DIR) $(1)/bin  
  79. #   $(INSTALL_BIN) $(PKG_BUILD_DIR)/Scada_Em $(1)/bin/  
  80. #  
  81. #   $(INSTALL_DIR) $(1)/usr/lib  
  82. #endef  
  83.   
  84. define Package/Scada_Em/install  
  85.     $(INSTALL_DIR) $(1)/bin  
  86.     $(CP) /home/zchx/3rdLib_mipsel/lib{boost_system,boost_thread,stdc++}.so.* $(1)/bin/  
  87.     $(INSTALL_BIN) $(PKG_BUILD_DIR)/Scada_Em $(1)/bin/  
  88. endef  
  89.   
  90. # This line executes the necessary commands to compile our program.  
  91. # The above define directives specify all the information needed, but this  
  92. # line calls BuildPackage which in turn actually uses this information to  
  93. # build a package.  
  94. $(eval $(call BuildPackage,Scada_Em))  
原创粉丝点击