我已经成功地使用交叉编译器编译了boost(使用了安装Raspberry Pi交叉编译器的说明),它工作得很好。
我将lib和include移到rootfs中,以便cmake找到它...当我运行cmake时,我得到
gervasio@ubuntu:~/cpp-netlib-0.10.1$ cmake -DCMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
-- Check for working C compiler: /home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
-- Check for working CXX compiler: /home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.55.0
-- Found the following Boost libraries:
-- unit_test_framework
-- system
-- regex
-- date_time
-- thread
-- filesystem
-- program_options
-- chrono
-- Found OpenSSL: /home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libssl.so;/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so (found version "1..1")
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gervasio/cpp-netlib-0.10.1
太棒了...现在,当我运行make时,它以
gervasio@ubuntu:~/cpp-netlib-0.10.1$ make
...
[ 15%] Building CXX object libs/network/test/CMakeFiles/cpp-netlib-message_test.dir/message_test.cpp.o
cd /home/gervasio/cpp-netlib-0.10.1/libs/network/test && /home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -DBOOST_NETWORK_ENABLE_HTTPS -Wall -I/home/gervasio/raspberrypi/rootfs/usr/include -I/home/gervasio/cpp-netlib-0.10.1 -Wall -o CMakeFiles/cpp-netlib-message_test.dir/message_test.cpp.o -c /home/gervasio/cpp-netlib-0.10.1/libs/network/test/message_test.cpp
Linking CXX executable ../../../tests/cpp-netlib-message_test
cd /home/gervasio/cpp-netlib-0.10.1/libs/network/test && /usr/bin/cmake -E cmake_link_script CMakeFiles/cpp-netlib-message_test.dir/link.txt --verbose=1
/home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -Wall CMakeFiles/cpp-netlib-message_test.dir/message_test.cpp.o -o ../../../tests/cpp-netlib-message_test -rdynamic /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_unit_test_framework.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_system.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_regex.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_date_time.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_thread.a -lpthread /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_filesystem.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_program_options.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_chrono.a -lpthread ../src/libcppnetlib-uri.a /home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libssl.so /home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so -lrt -Wl,-rpath,/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf
/home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: warning: libz.so.1, needed by /home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libssl.so, not found (try using -rpath or -rpath-link)
/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so: undefined reference to `deflateInit_'
/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so: undefined reference to `deflate'
/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so: undefined reference to `deflateEnd'
/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so: undefined reference to `inflate'
/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so: undefined reference to `inflateInit_'
/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so: undefined reference to `inflateEnd'
/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so: undefined reference to `zError'
collect2: error: ld returned 1 exit status
make[2]: *** [tests/cpp-netlib-message_test] Error 1
make[2]: Leaving directory `/home/gervasio/cpp-netlib-0.10.1'
make[1]: *** [libs/network/test/CMakeFiles/cpp-netlib-message_test.dir/all] Error 2
make[1]: Leaving directory `/home/gervasio/cpp-netlib-0.10.1'
make: *** [all] Error 2
但是...在~/raspberrypi/rootfs/lib/arm-linux-gnueabihf中有一个libz.so.1
gervasio@ubuntu:~/raspberrypi/rootfs/lib/arm-linux-gnueabihf$ ls -lah libz.so*
lrwxrwxrwx 1 gervasio gervasio 13 Jun 24 2012 libz.so.1 -> libz.so.1.2.7
-rw-r--r-- 1 gervasio gervasio 86K Jun 24 2012 libz.so.1.2.7
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6ec6000)
libcrypto.so.1.0.0 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (0xb6d57000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6d4c000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6d2e000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6bff000)
/lib/ld-linux-armhf.so.3 (0xb6f24000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6bd7000)
/home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -Wall CMakeFiles/cpp-netlib-message_test.dir/message_test.cpp.o -o ../../../tests/cpp-netlib-message_test -rdynamic /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_unit_test_framework.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_system.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_regex.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_date_time.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_thread.a -lpthread /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_filesystem.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_program_options.a /home/gervasio/raspberrypi/rootfs/usr/lib/libboost_chrono.a -lpthread ../src/libcppnetlib-uri.a /home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libssl.so /home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libcrypto.so -lrt -Wl,-rpath,/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf
/home/gervasio/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: warning: libz.so.1, needed by /home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libssl.so, not found (try using -rpath or -rpath-link)
它说-rpath、/home/gervasio/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf
,这似乎不太好,对吗?
多亏了@Ruslo和他发布的链接,我想通了...这是告诉cmake使用rpath的方法
cmake-dcmake_toolchain_file=$home/raspberrypi/pi.cmake-dcmake_skip_build_rpath=false-dcmake_build_with_install_rpath=true-dcmake_build_rpath=/home/gervasio/raspberrypi/rootfs/lib/arm-linux-gnueabihf-dcmake_install_rpath_use_link_path=true。
cpp-netlib项目的目标是:基于最新的c++标准,提供一个易用的网络编程库。该项目使用最新的c++编译器版本及其特性。目前,该项目已经完成了一个HTTP客户端与服务端的实现、一个独立的URI库、一个网络消息框架、部份并发工具。
我在c代码中使用include: 。当我用“gcc”编译器编译它时,我没有任何错误,但当我用交叉编译器“arm-linux-gnueabi-gcc”编译它时,我有以下错误:
当我试图交叉编译raspberry pi的nginx时,我在配置步骤中得到了错误。我的交叉编译配置选项是, *./configure--build=x86_64-linux--host=arm-poky-linux-gnueabi--target=arm-poky-linux-gnueabi--prefix=/usr--exec_prefix=/usr--exec_prefix=/usr--bin
问题内容: 各位 我正在尝试在Ant和终端上玩Javac Cross编译。在本地和集成环境中,我在一个非常基本的问题上遇到了同样的问题。 我在linux终端(以及在Windows和cmd的cygwin上)上运行此命令: 与Main.java一起使用,仅是System.out.println。 我收到错误消息: 我在本地Windows机器上的配置大致相同,结果完全相同。 我的理解是,交叉编译就是使用
我试图交叉编译一个linux系统的简单hello world程序。 我有以下资料: null 我试图运行/lib/libc.so.0来获取版本信息,但出现了一个分段错误。它似乎用-static编译解决了这个问题。所以我想这是libc库的问题。谢谢你的帮助。
问题内容: 我创建了一个交叉编译的arm可执行文件。我想找到可执行文件的库依赖项。我正在使用ubuntu natty并安装了不包含ldd的arm-linux- gnueabi工具链。有没有可用的工具来查看Linux中arm可执行文件库的依赖性。 问题答案: 这有点儿混乱,但这是我能找到的最好的解决方案,对于基本用途它确实很好用-只需使用其他交叉工具将此脚本另存为“ arm-none-linux-g