Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an ARM-based nanopi-m1 board. I have installed Armbian(Ubuntu-server 16.04) on it. Also I have installed :
xorg, openbox, xserver-x11-video-fbdev and libgtk-3-dev
on it. and made three .conf files:
Add to file /etc/modules-load.d/fbtft.conf

spi-bcm2835

fbtft_device


Add to file /etc/modprobe.d/fbtft.conf

options fbtft_device custom name=fb_ili9341 gpios=reset:1,dc:201,led:6 speed=16000000 rotate=90 bgr=1


Add to file: /usr/share/X11/xorg.conf.d/99-fbdev.conf

Section "Device" Identifier "myfb" Driver "fbdev" Option "fbdev" "/dev/fb8" EndSection


And
Add to /etc/rc.local 
startx


So I have this screen after boot: [^]

That is openbox window.

Then I tried to show an image in my SPI LCD with .C code as you can see below:

#include <gtk/gtk.h>

void destroy(void) {
  gtk_main_quit();
}

int main (int argc, char** argv) {
  GtkWidget* window;
  GtkWidget* image;

  gtk_init (&argc, &argv);


  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  image  = gtk_image_new_from_file(argv[1]);

  g_signal_connect(G_OBJECT (window), "destroy",
             G_CALLBACK (destroy), NULL);

  gtk_container_add(GTK_CONTAINER (window), image);

  gtk_widget_show_all(window);

  gtk_main();

  return 0;
}


But after compiling my code without error, when I try to run the executable via ssh, it gives me this message:

(process:1909): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.


And my image shown in my laptop instead of my board's LCD!
How can I fix this?
I want my image shown inside my SPI LCD not in my laptop display!

What I have tried:

I searched a lot and asked in some other sites but couldn't find any solution till now!
Posted
Updated 3-Nov-17 2:45am
Comments
Afzaal Ahmad Zeeshan 2-Nov-17 14:32pm    
That is a warning, not an error. You can ignore this warning, unless you want that Locale to be supported. As for the image, what window handles are you using? I am assuming that the code is targeting the desktop itself.
Member 13376650 2-Nov-17 16:26pm    
What is the locale support?
I am not familiar with GTK and found this example on the internet! my problem is that I like to see the image inside my SPI LCD not in my laptop!

1 solution

It looks like you have enabled X11-Forwarding for the SSH client on your laptop. Then the output of the X11 application is send to the SSH client and shown there.

The setlocale[^] function of the C library is used to specify how locale dependant values (dates, times, numeric values, monetary values, sorting) are handled and which character set should be used. The default "C" locale uses US English settings with the ASCII character set.

To fix the locale warning see command line - `Gtk-WARNING **: Locale not supported by C library. ` when starting apps from the commandline - Ask Ubuntu[^].

As far as I know GTK will read the LC_* and LANG* environment variables to set the locale. Use printenv(1) - Linux manual page[^] to show your current settings and check the installed languages with locale(1) - Linux manual page[^] using the -a option.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900