linux - 为 MIPS 平台交叉编译 libSDL 的问题

标签 linux sdl mips cross-compiling

我正在尝试为我的 mips 平台编译 libSDL-1.2.14。
但是没有成功。

这些是我尝试过的步骤:

  1. 导出 PATH=/opt/mips-4.3/bin:$PATH
  2. 进入 libSDL-1.2.14 源文件夹。
  3. 给出一个“./configure --prefix=/usr/local/SDL_Lib --host=mips-linux-gnu”
  4. 执行了“make”命令

这是收到的错误:

cc1: warning: include location "/usr/include" is unsafe for cross-compilation
./src/audio/dma/SDL_dmaaudio.c: In function 'DMA_WaitAudio': ./src/audio/dma/SDL_dmaaudio.c:167: error: can't find a register in class 'COP3_REGS' while reloading 'asm'
./src/audio/dma/SDL_dmaaudio.c:167: error: 'asm' operand has impossible constraints make: * [build/SDL_dmaaudio.lo] Error 1

但随后我通过给出以下命令重新配置了 make 文件:

  1. 打扫卫生
  2. ./configure --prefix=/usr/local/SDL_Lib --host=mips-linux-gnu CPPFLAGS=-I/opt/mips-4.3/mips-linux-gnu/libc/usr/include/<
  3. 制作

注意:/opt/mips-4.3/mips-linux-gnu/libc/usr/include/- 这是您可以找到 mips 平台的 select.h 文件的路径。 它包含宏 FD_ZERO 和 FD_SET 的定义。

我仍然遇到同样的错误。

cc1: warning: include location "/usr/include" is unsafe for cross-compilation
./src/audio/dma/SDL_dmaaudio.c: In function 'DMA_WaitAudio':
./src/audio/dma/SDL_dmaaudio.c:167: error: can't find a register in class 'COP3_REGS' while reloading 'asm'
./src/audio/dma/SDL_dmaaudio.c:167: error: 'asm' operand has impossible constraints make: * [build/SDL_dmaaudio.lo] Error 1

请帮我提供一些有值(value)的指示。

谢谢,

最佳答案

首先,不要将交叉编译器的路径设置为 PATH 的第一部分,将其设置为最后:

export PATH=$PATH:<path to cross-compiler>

这样比较安全。其次,运行 ./configure --help 获取所有选项。如果它更聪明的话,错误消息会说什么:

  1. 你正在尝试交叉编译,因为你正在设置 --host 标志
  2. 但是您没有更改任何其他选项以查找目标环境的包含和库
  3. 我将默认使用/usr/include
  4. 但那是针对宿主系统的,交叉编译时是不行的

检查您需要设置哪些其他配置选项来告诉配置脚本在哪里可以找到 .h 文件(包括)和您的目标的库。这些通常与您下载的交叉编译器一起提供。此外,在运行 configure 之前,您可能应该将 CROSS_COMPILE 环境变量设置为交叉编译器前缀。假设您使用 GCC 作为交叉编译器,前缀是交叉编译器中 gcc 之前的部分。

关于linux - 为 MIPS 平台交叉编译 libSDL 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4232087/

相关文章:

linux - strace输出问题解决

linux - 如何从 linux 命令行更改 MongoDB dbPath?

适用于 Linux 的 Windows 资源编辑器

assembly - 汇编程序中标签和可读性之间的关系

linux - Wayland 合成器不能像在 X 上那样做窗口装饰吗?

C++析构函数提前调用

c - SDL_GL_Extensions 支持总是返回 SDL_False

c - st_mtimensec 在 struct stat 中不可用

assembly - 直接访问 MIPS 协处理器条件标志

c++ - 使用 scons 在 Mac OSX 10.9 上构建