It is currently Fri Jul 10, 2020 10:55 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Crosscompilation Windows of GTK source for Raspberry
PostPosted: Wed Nov 27, 2019 1:41 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4692
Location: Lyon - France
Hello at all

If by miracle, someone have already try to compil on windows a source code with GTK call for raspberry ?
I use for that "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32" without succes :oops:

Code:
#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;
}


Have a good day

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: Crosscompilation Windows of GTK source for Raspberry
PostPosted: Thu Nov 28, 2019 9:37 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Oct 16, 2009 10:12 am
Posts: 658
Location: BE
Hi Kwai chang caine,

I'm noob on this, but a Raspberry user, so...
What does your code do ?
What is it ment for ?

Thanks.

_________________
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.


Top
 Profile  
Reply with quote  
 Post subject: Re: Crosscompilation Windows of GTK source for Raspberry
PostPosted: Thu Nov 28, 2019 10:27 am 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4692
Location: Lyon - France
Hello JORIS 8)

I'm happy to see i'm not alone in this new adventure :D

Image

This is all the history :wink:
I love C since numerous years i know PB, but never dare to try to learn it, and like PB do all nearly like C for the little project, in fact i not see the real interest except the "pleasure" to begin this adventure :oops:

But in my job, my boss forced me to use RASPBERRY with PYTHON at the beginning :shock:
Like i have nerver see LINUX and PYTHON...for me it's the end of the world :lol:
Little bit by little bit, i begin to understand a little part of LINUX (Very little) :mrgreen:
I have try PYTHON and hate it :evil:

Then i have ask to my boss if i can use my love of C (Yes.... i know...i love something without know it) :oops:

But when you love a woman,

Image

you not know it too ....right :wink:
So between me and the C...it's the same thing ..

Image

It's "The unknown love" :mrgreen:

Then now ...for little KCC...

- It's the moment to know a little bit the linux world
- I have a good reason to learn my love of C
- I have a machine (raspberry) also big than my knowledge in programming :mrgreen:

But i have see, RASPBERRY is not really powerfull for programming on it :|
Better to use a real machine for compil, and after send the executable to RASP

Then i have read it's possible to crosscompil on windows a RASPBIAN executable :shock:
And it's really simple, because even KCC have understand, it's the real proof :mrgreen:

I want do that with the windows console, like this i can use the amazing code of the great INFRATEC for compil C source with my love PB :D
viewtopic.php?p=482009#p482009

For have all the parameters, i use for example
Code:
C:\MinGW\bin\pkg-config --cflags --libs gtk+-2.0


On windows for compil a GTK application it's necessary to include all the GTK library in the std parameters
Then this is the "little" console command
Code:
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

And after......
"Roll my hen" (French expression "Roule ma poule" :wink:)

Image

I run this code and the miracle come, i have a nice Linux GTK window in WINDOWS :shock:

The problem his for crosscompil a RASPBIAN window on WINDOWS (Surely bad jealousy :mrgreen:)
I use for that "gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32" a crosscompiler
For compil a simple C code, without external library all are done, just write this in WINDOWS console
Code:
C:\gcc-linaro-arm-linux-gnueabihf-4.8-2013.11_win32\bin\arm-linux-gnueabihf-gcc.exe C:\HelloWord.c -o C:\HelloWord_RASP

That generate a real LINUX executable and that works very simply and well 8)

But the problem is for include an external big libray like GTK on my C code
when i do the same method of above, just replace the CGG compiler to the "arm-linux-gnueabihf-gcc.exe" compiler
Code:
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

That write thousand of error lines :shock:
WINDOWS console wrote:
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

And i not understand all of this text :oops:

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: Crosscompilation Windows of GTK source for Raspberry
PostPosted: Thu Nov 28, 2019 12:28 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Oct 16, 2009 10:12 am
Posts: 658
Location: BE
Kwai chang caine wrote:
Hello JORIS 8)
And i not understand all of this text :oops:
Just like me ;-).
You made a big job answering like this, but ... yeah.
I'm not into C and probably never will.
Python maybe, if I can't do my thing with that basic language available for RiscOs (also raspberry).

Thanks.

_________________
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.


Top
 Profile  
Reply with quote  
 Post subject: Re: Crosscompilation Windows of GTK source for Raspberry
PostPosted: Thu Nov 28, 2019 1:31 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Feb 25, 2013 5:51 pm
Posts: 580
Location: US or Estonia
Assuming whichever pre-build ARM gcc cross compiler you choose to use is setup right, then it should be as simple as building GTK and it's dependencies with it and using pkgconfig.

I won't lie I'm lazy and just ssh in to Gentoo on my banana pi m3 for arm gcc tasks.. Yesterday I started working on your problem under Debian on the x86-64 Windows 10 subsystem but ran out of time...

Code:
dism /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux


reboot and install Debian from aka.ms/wslstore(78MB)
in cmd:
Code:
bash
sudo apt update
sudo apt upgrade
sudo apt install gcc-arm-none-eabi
sudo apt autoremove
arm-none-eabi-gcc gtktest.c -o gtktest.arm


I didn't have time to build the entire gtk dependency tree for arm and didn't find it already done on the net. I did build your code with all of the gtk removed and it worked, though.. I'm pretty sure someone has already done it...

_________________
The truth hurts.


Last edited by tj1010 on Thu Nov 28, 2019 2:22 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Crosscompilation Windows of GTK source for Raspberry
PostPosted: Thu Nov 28, 2019 2:16 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4692
Location: Lyon - France
@Nevermind JORIS :wink:

TJ1010 wrote:
Yesterday I started working on your problem
That's very kind, thank you 8)
Because LINUX + C + GTK + ENGLISH it's really too much for my little head :oops:

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: THCM and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye