Failed to connect to Mir: Failed to connect to server socket: No such file or directory

12,712

I attached a keyboard to my board and opened it's terminal(by right-click inside it's openbox window) and executed my program successfully and it showed my picture in the SPI LCD!

Share:
12,712

Related videos on Youtube

WDR
Author by

WDR

Updated on September 18, 2022

Comments

  • WDR
    WDR almost 2 years

    I have installed libgtk-3-dev and wrote and compiled this code successfully(without errors I mean):

    #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 trying to run the executable it says:

    (process:5771): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.
    Failed to connect to Mir: Failed to connect to server socket: No such file or directory
    Unable to init server: Could not connect: Connection refused
    
    (img:5771): Gtk-WARNING **: cannot open display: 
    

    I should say I use Ubuntu-server 16/04 and installed xorg, xserver-xorg-video-fbdev, openbox packages too. I have a gray blank screen with a black mouse and right-click menu after boot.

    EDIT: I used this command to connect to my board: ssh [email protected] -X Then program worked and it opened the image by ./img 1.png but in my laptop that I used for ssh! I liked to open the image in my board's LCD, not in my laptop!

    Also it gives me this message in terminal:

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

    SOLUTION:I attached a keyboard to my board and opened it's terminal(by right-click inside it's openbox window) and executed my program successfully and it showed my picture in the SPI LCD!

    • karel
      karel over 6 years
      ./test 1.png works perfectly on my computer so your code works OK, there must be some problem with the operating system, probably related to the gray blank screen with a black mouse and right-click menu after boot. If the code is OK and there is an OS problem then this question is on topic. For example the Failed to connect to Mir: Failed to connect to server socket: No such file or directory error may be because you executed a command as root that didn't need to be executed as root.
    • WDR
      WDR over 6 years
      @karel: here I said how did I run my display! I think the problem is here: unix.stackexchange.com/questions/401884/…
    • WDR
      WDR over 6 years
      I used startx command inside /etc/rc.local