关于arm-eabi-gcc和交叉编译

发布于 2024-11-05 14:35:21 字数 976 浏览 3 评论 0原文

我有一个复杂的开源库需要移植到 安卓NDK。首先,我需要配置(./configure)。我明白: 我必须与 /home/user/android-ndk/build/prebuilt/ 进行交叉编译 linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc 我觉得对吗?该实用程序将正确配置库吗?如果 是的,那么问题2:

1.我正在尝试编译这样一个库:libao。使用这些命令:


PREBUILT = / home/user/android-ndk/build/prebuilt/linux-x86/arm- 
eabi-4.4.0 
PLATFORM = / home/user/android-ndk/build/platforms/android-3/arch-arm 
INSTALL = / home/user/sox-14.3.2/com 

export CC = "/ home/user/android-ndk/build/prebuilt/linux-x86/arm- 
eabi-4.4.0/bin/arm-eabi-gcc" 
export CFLAGS = "-fPIC-DANDROID" 
export LDFLAGS = "-Wl,-T, $ PREBUILT / arm-eabi / lib / ldscripts / 
armelf.x-Wl,-rpath-link = $ PLATFORM / usr / lib-L $ PLATFORM / usr / 
lib-nostdlib $ PREBUILT / lib/gcc/arm-eabi/4.4.0/crtbegin.o $ PREBUILT/ 
lib/gcc/arm-eabi/4.4.0/crtend.o-lc-lm-ldl " 

. / Configure - host = arm - with-gnu-ld - enable-shared \ 

在装配结束时收到以下命令: 配置:错误:在此平台上找不到 16 位类型!

这意味着什么?如何修复和正确配置库? 也许我可以更轻松地配置库?

I have a complicated open source library that needs to be ported to
Android NDK. First, I need to configure (. / Configure). I understand:
I have to do cross-compile with / home/user/android-ndk/build/prebuilt/
linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc
I think right? This utility will correctly configures a library? If
yes, then question 2:

1.I'm trying to compile such a library: libao. use these commands:


PREBUILT = / home/user/android-ndk/build/prebuilt/linux-x86/arm- 
eabi-4.4.0 
PLATFORM = / home/user/android-ndk/build/platforms/android-3/arch-arm 
INSTALL = / home/user/sox-14.3.2/com 

export CC = "/ home/user/android-ndk/build/prebuilt/linux-x86/arm- 
eabi-4.4.0/bin/arm-eabi-gcc" 
export CFLAGS = "-fPIC-DANDROID" 
export LDFLAGS = "-Wl,-T, $ PREBUILT / arm-eabi / lib / ldscripts / 
armelf.x-Wl,-rpath-link = $ PLATFORM / usr / lib-L $ PLATFORM / usr / 
lib-nostdlib $ PREBUILT / lib/gcc/arm-eabi/4.4.0/crtbegin.o $ PREBUILT/ 
lib/gcc/arm-eabi/4.4.0/crtend.o-lc-lm-ldl " 

. / Configure - host = arm - with-gnu-ld - enable-shared \ 

At the end of the assembly receive the following:
configure: error: No 16 bit type found on this platform!

What could this mean? How to fix and properly configure the library?
Maybe I can somehow easier you can configure the library?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜还是长夜 2024-11-12 14:35:21

我认为使用 ./configure 脚本来构建 Android 库是很困难的(甚至是不可能的)。 Android 有自己的原生代码构建系统 Android.mk我认为这将是最简单的方法。您必须手动准备此类 makefile,然后使用 NDK 附带的 ndk-build 脚本。与 NDK 示例一起安装,您可以在那里检查此类文件的外观。

如果您只想运行configure来生成config.h,请按照此链接http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/
它包含以下 ./configure 参数集可能起作用的信息

./configure –host=arm-eabi CC=arm-eabi-gcc CPPFLAGS=”-I$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/include/” CFLAGS=”-nostdlib” LDFLAGS=”-Wl,-rpath-link=$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/lib/ -L$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/lib/” LIBS=”-lc “

I think it is hard (or even impossible) to use ./configure script to build library for Android. Android has its own building system Android.mk for native code and I think this will be the easiest way to go. You have to prepare such makefile manually and then use ndk-build script that come with NDK. Together with NDK samples are installed and you can check there how such file may look like.

If you want to just run configure to generate config.h please follow this link http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/.
It contains information that following set of parameters for ./configure might work

./configure –host=arm-eabi CC=arm-eabi-gcc CPPFLAGS=”-I$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/include/” CFLAGS=”-nostdlib” LDFLAGS=”-Wl,-rpath-link=$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/lib/ -L$ANDROID_ROOT/build/platforms/android-3/arch-arm/usr/lib/” LIBS=”-lc “
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文