android - 使用cygwin交叉编译到arm-linux

标签 android cygwin

我正在尝试使用 cygwin 将 strace 交叉编译到 Android 模拟器。我用了这个article 作为我的出发点。我按照这些 instructions 安装了交叉编译器.然后我使用

准备了 makefile
./configure -host=arm-linux

现在,当我执行 make 时,出现以下错误:

$ make
make  all-recursive
make[1]: Entering directory `/home/bruce/strace-4.6'
Making all in tests
make[2]: Entering directory `/home/bruce/strace-4.6/tests'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/bruce/strace-4.6/tests'
make[2]: Entering directory `/home/bruce/strace-4.6'
arm-linux-gcc -DHAVE_CONFIG_H -I.  -I./linux/arm -I./linux -I./linux  -Wall -Wwr
ite-strings -g -O2 -MT block.o -MD -MP -MF .deps/block.Tpo -c -o block.o block.c

block.c: In function `block_ioctl':
block.c:198: error: `u64' undeclared (first use in this function)
block.c:198: error: (Each undeclared identifier is reported only once
block.c:198: error: for each function it appears in.)
block.c:271: error: `BLKTRACESTOP' undeclared (first use in this function)
make[2]: *** [block.o] Error 1
make[2]: Leaving directory `/home/bruce/strace-4.6'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/bruce/strace-4.6'
make: *** [all] Error 2

即使我在 Makefile 中的 CFLAGS 变量后附加 -static 也会发生这种情况(为什么我需要这样做?)。请帮忙。

这是第 198-206 行:

case BLKGETSIZE64:
        if (exiting(tcp)) {
            uint64_t val;
            if (syserror(tcp) || umove(tcp, arg, &val) < 0)
                tprintf(", %#lx", arg);
            else
                tprintf(", %" PRIu64, val);
        }
        break;

最佳答案

首先,什么是 BLKGETSIZE64 #defined as? 定义中可能隐藏了一个“u64”标记。

就 arm-linux-gcc 而言,64 位 int 实际上是一个定义明确的对象吗?只是一个想法……但它一定是,对吧?

并且 CFLAGS 中的 -static 使二进制程序静态链接,而不是动态链接。 这意味着它需要运行的所有代码都将内置到可执行文件中。 通常,它会动态链接到共享对象库(.so 文件、Windows 下的 DLL),但您不一定指望您的程序需要包含在嵌入式设备中的特定库。无需在手持设备上安装所有库,您可以(可能)通过将相关位构建到可执行文件中来节省空间。

关于android - 使用cygwin交叉编译到arm-linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5612595/

相关文章:

java - OnClickListener 中出现错误;无法启动 Activity

java - 如何标准化 -π 和 π Java 之间的角度

android - MPAndroidChart LineChart 双击手势控制

android如何检查服务是否正在运行

c - 编译期间出现 fatal error 消息

emacs - 尝试通过Cygwin上的SSH连接时,Emacs挂起

设置 OnClickListener 时,Android ListView 不突出显示

java - Hadoop服务器运行向导未在Eclipse中打开

C90 printf with\n or\r\n 在 cygwin 中不工作;但是 fflush(标准输出);工作正常。为什么?

maven - cygwin 显示错误的括号