根據項目要求需要用到openssl這個庫,看了看編譯環境幸好本身就集成了該庫。但在編譯openssl的功能時,碰到缺少類庫的錯誤。
Package test is missing dependencies for the following libraries:
libcrypto.so.1.0.0
看了看 編譯器路徑
/home/sonny/Desktop/bitmain1/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib
這個目錄下是存在 libcrypto.so.1.0.0的。
百度谷歌查詢了很多方法,為了保險我吧所有要修改的地方都列出來。若有類似問題應該能解決了
首先要在make memuconfig 時選上openssl有關的內容,應該還有其他的就不多說了。
下面開始添加庫的操作。首先聲明我使用Openwrt 沒有幾天,對其具體細節不甚了解。可能有說的不對的地方。
第一步:
確保/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib目錄下存在 libcrypto.so
其中staging_dir是我的配置的Openwrt的編譯環境。
第二步:
在你寫的代碼文件夾下(我寫的是個test)下的Makefile里
增加:DEPENDS:=+libcrypto
就是在
define Package/test
SECTION:=utils
CATEGORY:=Utilities
TITLE:=test-- prints a snarky message
DEPENDS:=+libcrypto
endef
這個define下面。
第三步:也是在Makefile里增加:
define Package/test/install
$(INSTALL_DIR) $(1)/bin
$(CP) /lib/i386-linux-gnu/libc.so.6 $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef
這里多了一行$(CP)的代碼。
最后一步:
在openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo下的libcrypto.provides文件里增加兩行:
/openwrt/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib
libcrypto.so.1.0.0 最后這一步對成敗應該是很關鍵的。
