-2

I am using CrossTool NG and Buildroot to create a rootfs. I am trying to add SDL2_ttf to that rootfs.

I export the following environment variables 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/peter/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/

*************************** output ********************************* ld.bfd: skipping incompatible /usr/lib/i386-linux-gnu/libpthread.so when searching for -lpthread

/usr/local/xtools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/5.1.0/../../../../arm-unknown-linux-gnueabi/bin/ld.bfd: skipping incompatible /usr/lib/i386-linux-gnu/libpthread.a when searching for -lpthread

/usr/local/xtools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/5.1.0/../../../../arm-unknown-linux-gnueabi/bin/ld.bfd: cannot find /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: cannot find /usr/lib/libpthread_nonshared.a

collect2: error: ld returned 1 exit status

When I add -L/Buildroot library or -L/arm-linux library in order to find libpthread, the ./configure fails. Copying libpthread ...pmtstaging/usr/lib has no effect. I have already successfully added libfreetype and libpng12 to pmtstaging. Plus I copied libSDL2 and libz from Buildroot to pmtstaging.

Has anyone successfully cross compiled SDL2_ttf to arm-linux? Can it be done?

2 Answers2

1

You should really submit patches to the Buildroot mailing list, even if they don't work completely, so that other people can help you. Asking questions about code that isn't available anywhere is not going to give you a lot of answers.

Thomas Petazzoni
  • 5,636
  • 17
  • 25
0

To cross compile SDL_ttf, 2 linker scripts in Buildroot sysroot must be changed.
- libc.so
- libpthread.so
See
Can't access Buildroot staging libraries via ./configure when cross compiling. It fails on test compile.
for why.

Change /home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/lib/libc.so
FROM:

/* 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 ) )

TO:

/* 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 ) )

Change
/home/peter/igep2015/09Buildroot/buildroot-2016.02-TRY5/output/host/usr/armeb-buildroot-linux-gnueabi/sysroot/usr/lib/libpthread.so
FROM:

/* 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 )

TO:

/* 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 )

Now it is the normal
./configure
make
make DESTDIR= install

This example assumes that libpng and freetype have been installed in pmtstaging outside the Buildroot staging directory - although it will probably work using just the Buildroot staging sysroot and removing reference to 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
Community
  • 1
  • 1