External Libraries on Apalis T30

Hello,

I’ve been following your guide to build a C/C++ program from command line on linux:

This works great as long as I only use standard C libraries but it also messes up my package config paths compiling with external libraries. Specifically I’m trying to compile an SDL2 program to the Apalis T30. When I try to compile my program using the ${CC} variable as my compile command instead of g++ I get two types of errors.

Using the command:
${CC} main.cpp display.cpp button.cpp auxx.cpp texture.cpp history_entry.cpp catheter.cpp intro_display.cpp -std=c++11 pkg-config --cflags sdl2 SDL2_image SDL2_ttf pkg-config --libs sdl2 SDL2_image SDL2_ttf -lstdc++ -o main

I get a number of both “Package sdl2 was not found in the pkg-config search path” and “fatal error: SDL.h no such file or directory”.

In the past I’ve always just compiled natively on a test setup so I’m not very experienced with this sort of cross compiled setup. Do I need to rebuild my SDL libraries for a different target? How exactly do I link new libraries now that I have this preset ${CC} variable that I’m using.

At the end of the day I just need to get my SDL2 program running on an Apalis T30, any assistance towards that would be appreciated!

Hello @Khislop and Welcome to the Toradex Community!

Could you provide the hardware version of your module?

This works great as long as I only use standard C libraries but it also messes up my package config paths compiling with external libraries.

Which external libraries did you use?
How did you integrate this external libraries in the compiling Toolchain?

Do I need to rebuild my SDL libraries for a different target? How exactly do I link new libraries now that I have this preset ${CC} variable that I’m using.

Usually you need to build the libraries for a specific target architecture and integrate them in your SDK.

How exactly do I link new libraries now that I have this preset ${CC} variable that I’m using.

You need to use -l <lib_name> in the compilation command.

Best regards,
Jaski

Could you provide the hardware version of your module?
Apalis T30 2GB V1.1B

Which external libraries did you use?
sdl2, sdl2_image, sdl2_ttl

How did you integrate this external libraries in the compiling Toolchain?
I guess this is really my question. All I did was try to link my existing libraries I use to compile on my host machine.
As I mentioned I followed Toradex’s “build from command line” tutorial. If I’m following correctly the script that it has you run “environment-setup-armv7at2hf-neon-angstom-linux-gnueabi” seems to be what sets everything up for compiling? Is there a guide somewhere for integrating libraries into the the compiling toolchain?

Hi @Khislop

These libs are not included in the standard image and SDK.

You need to compile a custom image and SDK with these libraries integrated.

Please read the following developer article to do this.

Best regards,
Jaski