IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

 C Discussion :

Crosscompilation Windows d'une source GTK pour Raspberry


Sujet :

C

Vue hybride

andrebernard Crosscompilation Windows... 28/11/2019, 11h42
LittleWhite Bonjour, Ah la cross... 30/11/2019, 10h45
andrebernard Bonjour LittleWhite, Avant... 30/11/2019, 19h47
andrebernard Bon, j'ai refait un essai en... 04/12/2019, 15h16
LittleWhite Sans certitude, essayez en... 04/12/2019, 20h25
Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    309
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 309
    Par défaut Crosscompilation Windows d'une source GTK pour Raspberry
    Bonjour à tous,

    Je suis débutant et pour créer un exécutable WINDOWS d'un code GTK
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    #include <stdio.h>
    #include <stdlib.h>
    #include <gtk/gtk.h>
     
    int main(int argc, char *argv[])
    {
        printf("La premiere fenêtre à RICO\n");
     
        /* Init GTK */
        gtk_init(&argc, &argv);
     
        /* Create main window */
        GtkWidget *main_window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title(GTK_WINDOW(main_window),"La premiere fenetre a RICO");
     
        /* Connect exit signal */
        g_signal_connect(main_window,"delete-event",gtk_main_quit,NULL);
     
        /* Display window */
        gtk_widget_show_all(main_window);
     
        /* Run main loop */
        gtk_main();
     
        /* The following will be executed after the main loop ends */
        printf("Main loop exited\n");
     
        return 0;
    }
    je fait comme ceci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    C:\MinGW\bin\gcc -mwindows C:\Fenetre2_GTK_WIN.c -o C:\Fenetre2_GTK_WIN.exe -mms-bitfields -IC:/GTK+/include/gtk-2.0 -IC:/GTK+/lib/gtk-2.0/include -IC:/GTK+/include/atk-1.0 -IC:/GTK+/include/cairo -IC:/GTK+/include/gdk-pixbuf-2.0 -IC:/GTK+/include/pango-1.0 -IC:/GTK+/include/glib-2.0 -IC:/GTK+/lib/glib-2.0/include -IC:/GTK+/include -IC:/GTK+/include/freetype2 -IC:/GTK+/include/libpng14  -LC:/GTK+/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
    Pour obtenir les paramétres à passer dans la ligne de commande, je fait comme ceci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    C:\MinGW\bin\pkg-config --cflags --libs gtk+-2.0
    Et mon executable Windows est bien créé

    Maintenant je voudrais compiler le même code source pour RASPBERRY
    Pour ceci j'utilise un crosscompilateur "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32"
    J'ai déposé un "pkg-config.exe" dans le répertoire binaire de "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32" et l'ai lancé pour faire la même méthode qu'au dessus, j'obtiens donc
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    C:\arm-linux-gnueabihf-gcc.exe "C:\Fenetre1_GTK.c" -o "C:\Fenetre_GTK_NUX.nux" -IC:/gtk+-3.5.4-1-bundle/include/gtk-3.0 -IC:/gtk+-3.5.4-1-bundle/include/atk-1.0 -IC:/gtk+-3.5.4-1-bundle/include/cairo -IC:/gtk+-3.5.4-1-bundle/include/gdk-pixbuf-2.0 -IC:/gtk+-3.5.4-1-bundle/include/pango-1.0 -IC:/gtk+-3.5.4-1-bundle/include/glib-2.0 -IC:/gtk+-3.5.4-1-bundle/lib/glib-2.0/include -IC:/gtk+-3.5.4-1-bundle/include -IC:/gtk+-3.5.4-1-bundle/include/pixman-1 -IC:/gtk+-3.5.4-1-bundle/include/freetype2 -IC:/gtk+-3.5.4-1-bundle/include/libpng15  -Wl,-luuid -LC:/gtk+-3.5.4-1-bundle/lib -lgtk-3 -lgdk-3 -limm32 -lshell32 -lole32 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpangoft2-1.0 -lpangowin32-1.0 -lgdi32 -lfreetype -lfontconfig -lpango-1.0 -lm -lcairo -lgobject-2.0 -lglib-2.0 -lintl
    Mais lorsque je lance ce code j'obtiens des pages d'erreurs
    In file included from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gal
    loca.h:34,
    from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib.h:3
    2,
    from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdkco
    nfig.h:13,
    from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdk.h
    :30,
    from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gtk/gtk.h
    :30,
    from C:\Fenetre1_GTK.c:3:

    C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gtypes.h:476:33: warning:
    return type defaults to 'int' [-Wimplicit-int]
    # define GLIB_VAR extern __declspec(dllimport)
    ^~~~~~~~~~
    C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gmem.h:276:1: note: in ex
    pansion of macro 'GLIB_VAR'
    GLIB_VAR gboolean g_mem_gc_friendly;
    ^~~~~~~~
    In file included from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gli
    st.h:34,
    from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gha
    sh.h:35,
    from C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib.h:5
    2,
    from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdkco
    nfig.h:13,
    from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gdk/gdk.h
    :30,
    from C:/gtk+-3.5.4-1-bundle/include/gtk-3.0/gtk/gtk.h
    :30,
    from C:\Fenetre1_GTK.c:3:

    C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gmem.h: In function '__de
    clspec':
    C:/gtk+-3.5.4-1-bundle/include/glib-2.0/glib/gmem.h:280:10: error: exp
    ected '=', ',', ';', 'asm' or '__attribute__' before 'GMemVTable'
    GLIB_VAR GMemVTable *glib_mem_profiler_table;
    ^~~~~~~~~~
    .........................
    ........................
    etc ...thousands pages
    Je suppose donc que ce n'est pas du tout comme ceci qu'il faut s'y prendre
    Mais j'ai cherché pendant plusieurs jours et pas trouvé d'exemples complets pour faire ce genre de manipulations

    Si quelqu'un a déjà fait ce genre de manipulation, je ne serais pas contre un petit peu d'aide pour comprendre le principe le plus simple de la crosscompilation Windows/Raspbian
    Je vous remercie par avance et vous souhaite dors et déjà une bonne journée

  2. #2
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    27 090
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 27 090
    Billets dans le blog
    145
    Par défaut
    Bonjour,

    Ah la cross compilation, toujours une partie de plaisir !

    Déjà, dans le premier cas (fonctionnel ?) vous pointez sur gtk2 et sur le second cas (rpi) vous utilisez gtk3.
    Ensuite, êtes vous sur que vous pointez sur du gtk3 pour ARM ?
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    309
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 309
    Par défaut
    Bonjour LittleWhite,

    Avant toutes choses....merci mille fois de votre réponse, car je me sent vraiment tout seul et perdu dans ce monde du C qui m'a toujours passionné, mais dont je ne connais presque rien

    Si je pointe sur différents GTK c'est surement dû au fait que j'ai tellement essayé de trucs avant de vous déranger, que j'ai surement tout mélangé
    Mais la première chose que j'aimerais savoir afin de me rassurer, c'est est ce que c'est possible de crosscompiler comme je m'y prend ?

    C'est à dire utiliser "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32" sur un PC windows, pour créer un exécutable RASP utilisant la librairie GTK, que je n'aurais plus qu'à transférer et lancer sur RASPBIAN ?

  4. #4
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    309
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 309
    Par défaut
    Bon, j'ai refait un essai en faisant bien attention aux chemins
    J'ouvre une console et tape ces 4 lignes

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    SET PATH=C:\GCC\gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32\bin;%PATH%;
    SET PATH=C:\GCC\gtk+\bin;%PATH%
    SET PKG_CONFIG_PATH=C:\GCC\gtk+\lib\pkgconfig
     
    C:\GCC\gtk+\bin\pkg-config.exe --cflags --libs gtk+-2.0
    J'obtiens cette réponse

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    -mms-bitfields -IC:/GCC/gtk+/include/gtk-2.0 -IC:/GCC/gtk+/lib/gtk-2.0/include -
    IC:/GCC/gtk+/include/atk-1.0 -IC:/GCC/gtk+/include/cairo -IC:/GCC/gtk+/include/g
    dk-pixbuf-2.0 -IC:/GCC/gtk+/include/pango-1.0 -IC:/GCC/gtk+/include/glib-2.0 -IC
    :/GCC/gtk+/lib/glib-2.0/include -IC:/GCC/gtk+/include -IC:/GCC/gtk+/include/free
    type2 -IC:/GCC/gtk+/include/libpng14  -LC:/GCC/gtk+/lib -lgtk-win32-2.0 -lgdk-wi
    n32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixb
    uf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0
    -lintl
    Je rajoute à ma ligne de compilation
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    C:\GCC\gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32\bin\arm-linux-gnueabihf-gcc.exe C:\GCC\Fenetre1_GTK.c -o C:\GCC\Fenetre_GTK_NUX.nux
    les parametres du dessus remontés par "C:\GCC\gtk+\bin\pkg-config.exe"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    C:\GCC\gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32\bin\arm-linux-gnueabihf-gcc.exe C:\GCC\Fenetre1_GTK.c -o C:\GCC\Fenetre_GTK_NUX.nux -mms-bitfields -IC:/GCC/gtk+/include/gtk-2.0 -IC:/GCC/gtk+/lib/gtk-2.0/include -IC:/GCC/gtk+/include/atk-1.0 -IC:/GCC/gtk+/include/cairo -IC:/GCC/gtk+/include/gdk-pixbuf-2.0 -IC:/GCC/gtk+/include/pango-1.0 -IC:/GCC/gtk+/include/glib-2.0 -IC
    :/GCC/gtk+/lib/glib-2.0/include -IC:/GCC/gtk+/include -IC:/GCC/gtk+/include/freetype2 -IC:/GCC/gtk+/include/libpng14  -LC:/GCC/gtk+/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl
    Et j'obtiens cette réponse

    arm-linux-gnueabihf-gcc.exe: erreur: unrecognized command line option '-mms-bitfields'
    Et quand je supprime le parametre '-mms-bitfields' en question
    J'obtiens des centaines d'erreurs

    In file included from C:/GCC/gtk+/include/glib-2.0/glib/gthread.h:35:0,
    from C:/GCC/gtk+/include/glib-2.0/glib/gasyncqueue.h:34,
    from C:/GCC/gtk+/include/glib-2.0/glib.h:34,
    from C:/GCC/gtk+/include/glib-2.0/gobject/gbinding.h:30,
    from C:/GCC/gtk+/include/glib-2.0/glib-object.h:25,
    from C:/GCC/gtk+/include/glib-2.0/gio/gioenums.h:30,
    from C:/GCC/gtk+/include/glib-2.0/gio/giotypes.h:30,
    from C:/GCC/gtk+/include/glib-2.0/gio/gio.h:28,
    from C:/GCC/gtk+/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
    from C:/GCC/gtk+/include/gtk-2.0/gdk/gdk.h:32,
    from C:/GCC/gtk+/include/gtk-2.0/gtk/gtk.h:32,
    from C:\GCC\Fenetre1_GTK.c:3:
    C:/GCC/gtk+/include/glib-2.0/glib/gutils.h: In function '__declspec':
    C:/GCC/gtk+/include/glib-2.0/glib/gutils.h:433:10: error: expected '=', ',', ';'
    , 'asm' or '__attribute__' before 'const'
    GLIB_VAR const guint glib_minor_version;
    ^
    C:/GCC/gtk+/include/glib-2.0/glib/gutils.h:434:10: error: expected '=', ',', ';'
    , 'asm' or '__attribute__' before 'const'
    GLIB_VAR const guint glib_micro_version;
    ^
    C:/GCC/gtk+/include/glib-2.0/glib/gutils.h:435:10: error: expected '=', ',', ';'
    , 'asm' or '__attribute__' before 'const'
    GLIB_VAR const guint glib_interface_age;
    ^
    C:/GCC/gtk+/include/glib-2.0/glib/gutils.h:436:10: error: expected '=', ',', ';'
    , 'asm' or '__attribute__' before 'const'
    GLIB_VAR const guint glib_binary_age;
    ^
    In file included from C:/GCC/gtk+/include/glib-2.0/glib/gasyncqueue.h:34:0,
    from C:/GCC/gtk+/include/glib-2.0/glib.h:34,
    from C:/GCC/gtk+/include/glib-2.0/gobject/gbinding.h:30,
    from C:/GCC/gtk+/include/glib-2.0/glib-object.h:25,
    from C:/GCC/gtk+/include/glib-2.0/gio/gioenums.h:30,
    from C:/GCC/gtk+/include/glib-2.0/gio/giotypes.h:30,
    from C:/GCC/gtk+/include/glib-2.0/gio/gio.h:28,
    from C:/GCC/gtk+/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
    from C:/GCC/gtk+/include/gtk-2.0/gdk/gdk.h:32,
    from C:/GCC/gtk+/include/gtk-2.0/gtk/gtk.h:32,
    from C:\GCC\Fenetre1_GTK.c:3:
    C:/GCC/gtk+/include/glib-2.0/glib/gthread.h:43:15: error: storage class specifie
    d for parameter 'g_thread_error_quark'
    extern GQuark g_thread_error_quark (void);
    Quelqu'un comprend il ce qui se passe ?

  5. #5
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    27 090
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 27 090
    Billets dans le blog
    145
    Par défaut
    Sans certitude, essayez en enlevant les :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    #include <stdio.h>
    #include <stdlib.h>
    Sinon,
    Mais la première chose que j'aimerais savoir afin de me rassurer, c'est est ce que c'est possible de crosscompiler comme je m'y prend ?
    Possible, mais pas facile. En effet, il faut avoir le bon compilateur (il semble que ce soit bon pour vous), les bonnes bibliothèques (au bon format, prévu pour la plateforme cible) et quand on dit les bonnes bibliothèques, on parle aussi des bibliothèques de base comme la bibliothèque C.

    C'est à dire utiliser "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32" sur un PC windows, pour créer un exécutable RASP utilisant la librairie GTK, que je n'aurais plus qu'à transférer et lancer sur RASPBIAN ?
    Oui, dans la théorie.
    Dans la pratique, il faudra que les bibliothèques telles que GTK soient installées sur le Raspberry Pi (ou quelle soit dans l'exécutable en statique, ou alors, elles aussi copier avec l'exécutable).
    Dans un cas comme le votre, où le Raspberry Pi a assez de puissance pour compiler, on conseillera de directement compiler sur le Raspberry Pi (et même de code directement dessus).

    Ou encore, je considère (à titre personnel) que cela serait plus facile, en étant sous Linux (mais là, peut être je me fais une fausse idée).
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  6. #6
    Membre éclairé
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    309
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 309
    Par défaut
    Bon bah merci de votre explication.
    Je vais essayer de me rabattre plutôt sur la remote compilation que la crosscompilation
    Bonne journée

Discussions similaires

  1. Modifier une source C++ pour projet Robotique
    Par cutprod dans le forum Robotique
    Réponses: 0
    Dernier message: 22/01/2011, 20h56
  2. Utiliser une source distante pour un DeepZoom
    Par padodanle51 dans le forum Silverlight
    Réponses: 4
    Dernier message: 08/06/2010, 09h30
  3. JPA extraire une source jdbc pour creer un statement
    Par seddik_saber dans le forum JPA
    Réponses: 0
    Dernier message: 12/11/2008, 18h48
  4. besoin d'une source JS pour mon menu déroulant SVP
    Par spudstyle dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 24/10/2008, 09h14
  5. Comment créer une source DSN pour un fichier text
    Par ahouba dans le forum Access
    Réponses: 3
    Dernier message: 08/01/2007, 11h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo