【问题标题】:Cannot Cross Compile SDL2_ttf onto arm-linux无法将 SDL2_ttf 交叉编译到 arm-linux 上
【发布时间】:2016-04-17 21:26:14
【问题描述】:

我正在使用 CrossTool NG 和 Buildroot 创建一个 rootfs。我正在尝试将 SDL2_ttf 添加到该 rootfs。

我导出以下环境变量 CC=arm-linux-gcc

CPPFLAGS=-I/home/peter/igep2015/94SDLttf/pmtstaging/usr/include -I/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/staging/usr/include -I/home/彼得/igep2015/94SDLttf/pmtstaging/usr/include/freetype2

CFLAGS=--sysroot=/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/

LDFLAGS=-L/home/peter/igep2015/94SDLttf/pmtstaging/usr/lib/

*************************** 输出 ******************* ************** ld.bfd:搜索-lpthread时跳过不兼容的/usr/lib/i386-linux-gnu/libpthread.so

/usr/local/xtools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/5.1.0/../../../../arm-unknown- linux-gnueabi/bin/ld.bfd:搜索-lpthread时跳过不兼容的/usr/lib/i386-linux-gnu/libpthread.a

/usr/local/xtools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/5.1.0/../../../../arm-unknown- linux-gnueabi/bin/ld.bfd:找不到/lib/libpthread.so.0

/usr/local/xtools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/5.1.0/../../../../arm-unknown- linux-gnueabi/bin/ld.bfd: 找不到 /usr/lib/libpthread_nonshared.a

collect2: 错误:ld 返回 1 个退出状态

当我添加 -L/Buildroot 库或 -L/arm-linux 库以查找 libpthread 时,./configure 失败。复制 libpthread ...pmtstaging/usr/lib 无效。我已经成功地将 libfreetype 和 libpng12 添加到 pmtstaging 中。另外,我将 libSDL2 和 libz 从 Buildroot 复制到 pmtstaging。

有没有人成功地将 SDL2_ttf 交叉编译到 arm-linux 中?可以做到吗?

【问题讨论】:

    标签: sdl-2 buildroot


    【解决方案1】:

    您确实应该向 Buildroot 邮件列表提交补丁,即使它们不能完全正常工作,以便其他人可以帮助您。就任何地方都没有的代码提出问题不会给你很多答案。

    【讨论】:

      【解决方案2】:

      要交叉编译 SDL_ttf,必须更改 Buildroot sysroot 中的 2 个链接器脚本。
      - libc.so
      - libpthread.so

      Can't access Buildroot staging libraries via ./configure when cross compiling. It fails on test compile.
      为什么。

      改变 /home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/lib/libc.so
      来自:

      /* GNU ld script
          Use the shared library, but some functions are only in
         the static library, so try that secondarily.  */
      OUTPUT_FORMAT(elf32-littlearm)
       GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.3 ) )
      

      收件人:

      /* GNU ld script
         Use the shared library, but some functions are only in  
         the static library, so try that secondarily.  */   
      OUTPUT_FORMAT(elf32-littlearm)  
      GROUP ( ../../lib/libc.so.6 libc_nonshared.a  AS_NEEDED ( ../../lib/ld-linux.so.3 ) )
      

      改变
      /home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/lib/libpthread.so
      来自:

      /* GNU ld script
         Use the shared library, but some functions are only in
         the static library, so try that secondarily.  */
      OUTPUT_FORMAT(elf32-littlearm)
      GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )
      

      收件人:

      /* GNU ld script
         Use the shared library, but some functions are only in
         the static library, so try that secondarily.  */
      OUTPUT_FORMAT(elf32-littlearm)
      GROUP ( ../../lib/libpthread.so.0 libpthread_nonshared.a )
      

      现在正常了
      ./配置
      制作
      使 DESTDIR= 安装

      此示例假定 libpng 和 freetype 已安装在 Buildroot 暂存目录之外的 pmtstaging 中 - 尽管它可能仅使用 Buildroot 暂存 sysroot 并删除对 pmtstaging 的引用即可工作。

      export PATH=$PATH:/usr/local/xtools/arm-unknown-linux-gnueabi/bin/ 
      export CC=arm-linux-gcc
      export CFLAGS="-v -Wl,--verbose"        ###optional for debugging
      export CPPFLAGS="-I/home/peter/igep2015/94SDLttf/pmtstaging/usr/include -I/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/include -I/home/peter/igep2015/94SDLttf/pmtstaging/usr/include/freetype2"
      export LDFLAGS="-L/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/lib  -L/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/lib  -L/home/peter/igep2015/94SDLttf/pmtstaging/usr/lib"  
      ./configure --host=arm-linux --prefix=/usr --with-freetype-prefix=/home/peter/igep2015/94SDLttf/pmtstaging/usr  
      make
      make DESTDIR=/home/peter/igep2015/94SDLttf/pmtstaging/  install
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-02-03
        • 1970-01-01
        • 2022-11-04
        • 2011-08-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-10-07
        相关资源
        最近更新 更多