1
我想知道在與Sourcery工具鏈進行交叉編譯時,是否可以將我的應用程序鏈接到libssh。我的主機系統爲Ubuntu的x86_64的在鏈接到libssh時進行交叉編譯 - libssh.so:文件未被識別
:~/c/ssh$ arm-none-linux-gnueabi-gcc ssh.c -o arm `pkg-config --cflags --libs libssh`
cc1: warning: include location "/usr/local/include" is unsafe for cross-compilation [-Wpoison-system-directories]
/home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.6.1/../../../../arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/local/lib" is unsafe for cross-compilation
/usr/local/lib/libssh.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
使用此命令我的應用程序編譯用gcc罰款:
gcc ssh.c -o ssh -lssh
添加相同-lssh標誌,而交叉編譯導致以下錯誤:
:~/c/ssh$ arm-none-linux-gnueabi-gcc ssh.c -o arm -lssh
ssh.c:2:49: fatal error: libssh/libssh.h: No such file or directory
compilation terminated.
感謝您的明確答覆。我將嘗試爲ARM構建libssh。 – 01BTC10
看看嵌入式Linux發行版等[Buildroot裏面](http://buildroot.uclibc.org/),[OpenEmbedded的](http://www.openembedded.org/wiki/Main_Page)或[嵌入式Debian計劃]( http://www.emdebian.org/)。當交叉編譯具有很多依賴關係的包時,它們可以節省大量時間和麻煩。 – yegorich