編譯的是同一個.C檔案,鏈接的庫都是存在的,只是使用mipsel-openwrt-linux-gcc-4.8的是可以編譯出來執行檔案的,使用新版的mipsel-openwrt-linux-gcc-7.4.0永遠卡在鏈接報錯,且此交叉編譯工具直接從openwrt中編譯出來的,目前測驗了openssl,sqlite3,pthread都是可以正常運行的,只是編譯鏈接curl存在問題,請問如何解決?
目前試過:
1、從openwrt原始碼包里復制動態庫檔案到編譯的檔案夾,修改makefile 鏈接選項到本地----不行!
2、復制mipsel-openwrt-linux-gcc-4.8編譯的庫檔案到編譯檔案夾,修改makefile 鏈接選項到本地----不行!
3、從官網下載openssl和curl原始碼到本地,交叉編譯生成動態庫,其中使用mipsel-openwrt-linux-gcc-7.4.0編譯openssl是可以成功生成,編譯curl------不行!同樣是鏈接報錯!

報錯如下:

報錯的鏈接是直接鏈接openwrt原始碼包路徑的:


使用mipsel-openwrt-linux-gcc-7.4.0 編譯MD5加密鏈接libssl.so是可以通過的:

全部報錯資訊:
aron566@ubuntu:~/temp/OPENWRT_HTTP$ make
mipsel-openwrt-linux-gcc-7.4.0 -I./ -I./openssl -I/home/aron566/openwrt-master/staging_dir/target-mipsel_24kc_musl/usr/include -L./ -L/home/aron566/openwrt-master/staging_dir/target-mipsel_24kc_musl/usr/lib -c http.c -lssl -lcrypto -lcurl -ldl -std=gnu99
mipsel-openwrt-linux-gcc-7.4.0 -I./ -I./openssl -I/home/aron566/openwrt-master/staging_dir/target-mipsel_24kc_musl/usr/include -L./ -L/home/aron566/openwrt-master/staging_dir/target-mipsel_24kc_musl/usr/lib -o "HTTP" http.o -lssl -lcrypto -lcurl -ldl -std=gnu99
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: warning: libmbedtls.so.12, needed by .//libcurl.so, not found (try using -rpath or -rpath-link)
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: warning: libmbedx509.so.0, needed by .//libcurl.so, not found (try using -rpath or -rpath-link)
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: warning: libmbedcrypto.so.3, needed by .//libcurl.so, not found (try using -rpath or -rpath-link)
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_x509_crt_parse_der'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_ctr_drbg_seed'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_x509_crt_init'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_x509_crt_free'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_ctr_drbg_random'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_x509_crl_free'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_pk_init'
。。。。。
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_ssl_get_bytes_avail'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_ssl_config_defaults'
/home/aron566/NEW_TOOLCHAIN/openwrt-toolchain-ramips-mt76x8_gcc-7.4.0_musl.Linux-x86_64/toolchain-mipsel_24kc_gcc-7.4.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.4.0/../../../../mipsel-openwrt-linux-musl/bin/ld: .//libcurl.so: undefined reference to `mbedtls_ssl_conf_rng'
collect2: error: ld returned 1 exit status
Makefile:10: recipe for target 'HTTP' failed
make: *** [HTTP] Error 1
uj5u.com熱心網友回復:
從錯誤資訊來看,嵌入平臺上 curl 用的不是openssl, 而是 mbedtls,試試安裝 mbedtlsuj5u.com熱心網友回復:
我試過將鏈接路徑增加libmbedtls的動態庫路徑和頭檔案路徑,并且去掉了程式里面的加密段--沒有用uj5u.com熱心網友回復:
編譯curl的時候把mbedtls禁用?轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/76161.html
標籤:應用程序開發區
上一篇:救命啊,kali
