How to cross compile the PPP to arm-xscale

本文介绍如何解决交叉编译libpcap-1.0.0及pppd-2.4.4过程中遇到的问题,包括配置选项、依赖缺失及Makefile调整等关键步骤。

1.

如果需要让pppd支持packet filtering 功能的话就需要编译libpcap.

cross compile libpcap-1.0.0


./configure --host=arm-xscale-linux-gnu --prefix=/usr/arm-xscale-linux-gnu/

直接出错了

configure: error: pcap type not determined when cross-compiling; use --with-pcap=...

 

比较了非交叉编译的log,发现需要加上--with-pcap=linux

./configure --host=arm-xscale-linux-gnu --prefix=/usr/arm-xscale-linux-gnu/ --with-pcap=linux

checking Linux kernel version... unknown
configure: error: cannot determine linux version when cross-compiling

 

查configure文件if test $ac_cv_linux_vers = unknown ; then
                { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5
echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}
   { (exit 1); exit 1; }; }

 

原来是交叉编译器无法通过uname获得arm linux 的版本.只能通过cache文件设置了.


echo ac_cv_linux_vers=linux-2.6.15.6-xyz4>arm-linux.cache
./configure --cache-file=arm-linux.cache --host=arm-xscale-linux-gnu --prefix=/usr/arm-xscale-linux-gnu/ --with-pcap=linux
make
make install

这下过了libpcap-1.0.0被安装到了/usr/arm-xscale-linux-gnu/ 目录下

 

2.

cross compile ppp-2.4.4
./configure --prefix=/usr/arm-xscale-linux-gnu   <--  ppp-2.4.4 只支持--prefix/--sysconf参数,其他都不支持

 

make CC=/opt/gcc-4.1.2-glibc-2.4/arm-xscale-linux-gnu/bin/arm-xscale-linux-gnu-gcc

options.c:59:18: error: pcap.h: No such file or directory
options.c: In function 'process_option':
options.c:781: warning: dereferencing type-punned pointer will break strict-aliasing rules
options.c: In function 'setpassfilter':
options.c:1458: error: 'pcap_t' undeclared (first use in this function)
options.c:1458: error: (Each undeclared identifier is reported only once
options.c:1458: error: for each function it appears in.)
options.c:1458: error: 'pc' undeclared (first use in this function)

 

个人觉得,ppp的Makefile 有问题,没有在configure的时候把 --prefix 所指向的路径作为默认路径.

我的做法有两种
第一种在  pppd/Makefile 文件中

line86 行 CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="/usr/arm-xscale-linux-gnu"'
后添加
CFLAGS += -I$(DESTDIR)/include

LDFLAGS = -L$(DESTDIR)/lib


或者
第二种也是在 pppd/Makefile 文件中

直接disable PPP packet filtering,这样的话libpcap-1.0.0甚至都不用编译

# Uncomment the next line to include support for PPP packet filtering.
# This requires that the libpcap library and headers be installed
# and that the kernel driver support PPP packet filtering.
#FILTER=y

 

两种任一种改完,再运行
make CC=/opt/gcc-4.1.2-glibc-2.4/arm-xscale-linux-gnu/bin/arm-xscale-linux-gnu-gcc
make install

ppp的包就被安装在pc的/usr/arm-xscale-linux-gnu/, 把该目录原封不动拷贝到板子的相同路径下,就可以在板子上运行pppd了.

 

OK.

Cross-compiling Parsec benchmark for ARM architecture involves setting up a build environment on your host machine (likely x86 or x64) that can generate code for ARM targets. Here's a general outline of the steps: 1. **Install required tools**: Ensure you have installed a compiler and toolchain that supports ARM, like `gcc-arm-none-eabi` or `clang-arm`. 2. **Set up target environment**: You'll need to configure the toolchain with the correct paths and settings for the ARM target. This may involve creating a separate configuration file or specifying flags when invoking the compiler. ```sh export CC=arm-none-eabi-gcc export CXX=arm-none-eabi-g++ ``` 3. **Download Parsec**: Download the latest version of Parsec, which is a benchmarking suite, and extract it to a suitable location. 4. **Configure Makefile**: If Parsec has a Makefile, modify it to specify the target architecture. Look for lines similar to `CC`, `CFLAGS`, or `LDFLAGS`. Add or update them as needed, using the ARM-specific versions. 5. **Build for ARM**: Run `make clean && make` in the Parsec directory, replacing `make` with the appropriate command for your build system (e.g., `ninja` if you're using Ninja). ```sh make TARGET=arm-linux-gnueabihf ``` 6. **Test on ARM device or emulator**: Copy the generated `.elf` (executable) file to an ARM device or use an emulator to run it. **Related questions:** 1. What specific version of the ARM toolchain do I need? 2. How can I deal with dependencies if they don't have ARM builds available? 3. Are there any libraries or patches I need to include for compatibility with Parsec on ARM?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值