Search code examples
gtk3buildroot

C program does not run on buildroot


I work for buildroot. My purpose work GUI on my buildroot with Gtk3.0 and Gstreamer1.0. I use Olinuxino A13 so I wrote GUI code(Gtk3.0 hello world example) on this with codeblocks. I use Debian wheezy. I want transfer this code from Debian wheezy to buildroot.

I tried this:

  1. I transferred /path_to_proectfile/bin/Debug/my_program.my_program created by codeblocks. I wrote ./my_program on terminal and code work. I transferred this file to my buildroot but ./my_program does not work. It returns No such file or directory error.

  2. I thought the problem might be compiling and tried compiled on terminal. I use gcc -o my_program main.c 'pkg-config --cflags --libs gtk+-3.0' again work on Debian wheezy terminal. After I transferred to buildroot but result does not change. I tried different compile kind like cc,arm-linux-gnueabi-gcc etc. but every time No such file or directory error.

Finally when I don't use gtk library(Just use printf Hello World), I saw Hello world. When I add gtk library returns No such file or directory error. Have you any suggestion?


Solution

  • You need to cross compile your program with the corresponding buildroot toolchain. It looks like you have transferred a binary which was built against a different libc (this gives a "No such file or directory" error).

    The buildroot cross compiler with the correct libc can be used by setting CC to "path_to_buildroot_output/host/bin/arm-linux-*-gcc" (the exact name depends on which toolchain options you have chosen).