flat assembler
Message board for the users of flat assembler.

Index > Linux > GTK examples in FASM obsolete?

Author
Thread Post new topic Reply to topic
keantoken



Joined: 19 Mar 2008
Posts: 69
keantoken 07 Dec 2010, 01:42
Hello all.

The GTK examples work after installing the now more hard to find GTK/Glib 1.2. Even so, I get this error:

Code:
$ ./button

Gtk-WARNING **: Failed to load module "libcanberra-gtk-module.so": libcanberra-gtk-module.so: cannot open shared object file: No such file or directory
Button was clicked...

Button was clicked...

closing application...
$
    


A fix for this is to do:

Code:
$ unset GTK_MODULES    


However anyone who uses the program may have to do this, until the next Linux update breaks it completely.

What changes are needed to make them current? I want to use these templates in my first programs.

- keantoken
Post 07 Dec 2010, 01:42
View user's profile Send private message Reply with quote
ProphetOfDoom



Joined: 08 Aug 2008
Posts: 120
Location: UK
ProphetOfDoom 08 Dec 2010, 21:35
Hi,

I assume you're using the gtk-button example. I got it working by doing the following.

1) Install libgtk2.0-dev (at least that's what it's called on Ubuntu)
2) Install the program pkg-config if you haven't already got it.
3) Change the second line of "makefile" to read:

Code:
gcc -Wall -s -O3  button.o -o button `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
    


4) open "button.asm" and change this:

Code:
extrn gtk_signal_connect
    


to this:

Code:
extrn g_signal_connect_data
    


Now change the two calls to gtk_signal_connect so they read:

Code:
    ccall g_signal_connect_data, [hWindow], szDeleteEvent, DeleteEvent, dword 0, dword 0

    ccall g_signal_connect_data, [hButton], szClicked, ButtonClick, dword 0, dword 0
    
Post 08 Dec 2010, 21:35
View user's profile Send private message Reply with quote
keantoken



Joined: 19 Mar 2008
Posts: 69
keantoken 08 Dec 2010, 22:58
Thanks!

- keantoken
Post 08 Dec 2010, 22:58
View user's profile Send private message Reply with quote
bazik



Joined: 28 Jul 2003
Posts: 34
Location: .de
bazik 12 Dec 2010, 23:17
I should really update those examples to GTK2+ Smile
Post 12 Dec 2010, 23:17
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 13 Dec 2010, 00:50
bazik! It is so amazing to see you here again. How are you?
Post 13 Dec 2010, 00:50
View user's profile Send private message Visit poster's website Reply with quote
bazik



Joined: 28 Jul 2003
Posts: 34
Location: .de
bazik 13 Dec 2010, 12:19
I'm fine, I posted a thread in the Heap, about emerging back from exile Wink
Post 13 Dec 2010, 12:19
View user's profile Send private message Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 129
catafest 15 Sep 2020, 19:54
I don't know why it doesn't work in Fedora 32, any ideas?
Code:
[mythcat@desk fasm]$ ./fasm.x64 button.asm button.o
...
[mythcat@desk fasm]$ ./fasm button.asm button.o
...
[mythcat@desk fasm]$ gcc button.o $(pkg-config --cflags --libs gtk+-3.0) -o button
/bin/ld: i386 architecture of input file `button.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
[mythcat@desk fasm]$ gcc --version 
gcc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[mythcat@desk fasm]$ file button.o
button.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

[mythcat@desk fasm]$ pkg-config --cflags gtk+-3.0
-I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include 
-I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr
/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr
/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr
/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread 

[mythcat@desk fasm]$ ls /usr/include/gtk*
gdk  gtk  unix-print

[mythcat@desk fasm]$ file /bin/gcc
/bin/gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter
 /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=...
, for GNU/Linux 3.2.0, stripped    
Post 15 Sep 2020, 19:54
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 15 Sep 2020, 22:27
I suspect you need to tell GCC to output a 32-bit file. Or you might need to link it to a 32-bit library. Or both.
Post 15 Sep 2020, 22:27
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 16 Sep 2020, 17:35
Use -m32 when invoking gcc.
Post 16 Sep 2020, 17:35
View user's profile Send private message Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 129
catafest 05 Oct 2020, 20:14
The c source code with GTK simple button works ... and the run of the result ...
Code:
[mythcat@desk fasm]$ gcc -Wall -g  `pkg-config --cflags gtk+-3.0` test.c -o test `pkg-config --libs gtk+-3.0`
    

Why not this ?
Code:
[mythcat@desk fasm]$ gcc -Wall -g  `pkg-config --cflags gtk+-2.0` button.o -m32 -o button `pkg-config --libs gtk+-2.0`
/bin/ld: cannot find -lpangocairo-1.0
/bin/ld: cannot find -latk-1.0
/bin/ld: cannot find -lcairo
/bin/ld: cannot find -lpangoft2-1.0
/bin/ld: cannot find -lpango-1.0
/bin/ld: cannot find -lharfbuzz
/bin/ld: cannot find -lfontconfig
/bin/ld: cannot find -lfreetype
collect2: error: ld returned 1 exit status
[mythcat@desk fasm]$ gcc -Wall -g  `pkg-config --cflags gtk+-3.0` button.o -m32 -o button `pkg-config --libs gtk+-3.0`
/bin/ld: cannot find -lgtk-3
/bin/ld: cannot find -lgdk-3
/bin/ld: cannot find -lpangocairo-1.0
/bin/ld: cannot find -lpango-1.0
/bin/ld: cannot find -lharfbuzz
/bin/ld: cannot find -latk-1.0
/bin/ld: cannot find -lcairo-gobject
/bin/ld: cannot find -lcairo
collect2: error: ld returned 1 exit status
    
[/code]
Post 05 Oct 2020, 20:14
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.