gcc 4.6.2: fltk, gtk fail to compile

BlitzMax Forums/BlitzMax Beginners Area/gcc 4.6.2: fltk, gtk fail to compile

explosive(Posted 2012) [#1]
Hello altogether,

I am using opensuse 12.1 and have an issue regarding the version 4.6.2 of gcc.

When trying to compile a GUI (eg maxgui or bah.gtkmaxgui) I get this error:
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: /home/entwickler/bin/blitzmax/mod/maxgui.mod/fltkmaxgui.mod/fltkmaxgui.debug.linux.x86.a(fl_set_fonts.cxx.debug.linux.x86.o): undefined reference to symbol 'FcInit'
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: note: 'FcInit' is defined in DSO /usr/lib/libfontconfig.so.1 so try adding it to the linker command line
/usr/lib/libfontconfig.so.1: could not read symbols: Invalid operation

for FLTK respectively
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: /home/entwickler/bin/blitzmax/mod/bah.mod/gtkmaxgui.mod/gtkmaxgui.debug.linux.x86.a(gtkgadget.bmx.debug.linux.x86.o): undefined reference to symbol 'gdk_pixbuf_rotate_simple'
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: note: 'gdk_pixbuf_rotate_simple' is defined in DSO /usr/lib/libgdk_pixbuf-2.0.so.0 so try adding it to the linker command line
/usr/lib/libgdk_pixbuf-2.0.so.0: could not read symbols: Invalid operation

for GTK.
All devel files are installed.
The system is a clean install, additional packages are installed using this guide: http://www.blitzbasic.com/Community/posts.php?topic=86370 , http://www.blitzbasic.com/Community/posts.php?topic=94467 and my blitz knowledge I developed over ages.
I just moved from Ubuntu 11.10 and everything worked flawlessly.
So what's the matter?

Many thanks for your help!
Simon


explosive(Posted 2012) [#2]
Hello,

I just got the compiler to work correctly. Here's what I did:

1) Installed gcc3.3 from the packages and relinked "gcc" to "gcc-3.3" to avoid the silly "--eh-frame-hdr" error.
2) I added "Import "-lgdk_pixbuf-2.0"" to "gtkcommon.bmx"
3) recompiled the mod

Now I get an executable which does everything the way I want (text ouptput etc) but there's no window. What's the issue?

[EDIT]
Just tested:
- compiler works also with gcc-4.6 as well
- FLTK compiles now as well
- running executable with FLTK causes the programme to crash with "Unhandled Exception:Attempt to access field or method of Null object" when calling "CreateWindow":
Framework brl.standardio
'Import bah.gtkmaxgui
Import brl.maxgui

win=CreateWindow("TEST",0,0,400,300)


[EDIT April 13, 7h45pm CET]
Ok now: bah.gtkmaxgui now opens a window after about 10 seconds delay. The event responses are also awfully slow. When printing some text, the first real delay starts at "WaitEvent()". Createing the gadgets is very quickly just delay to appear.
FLTK still doesn't work at all.

[EDIT April 13, 9h30pm CET]
PollEvent()/PeekEvent() work flawlessly as expected. WaitEvent() seems to be the only function causing trouble...

Thank you
Simon

Last edited 2012

Last edited 2012

Last edited 2012


explosive(Posted 2012) [#3]
Hello again,

I digged deep into the source code of bmax. It seems that I found a solution for the problem. Here's my suggestion:

1) add
Import "-lgdk_pixbuf-2.0"

to "bah.mod/gtkmaxgui.mod/gtkcommon.bmx"

2) Disable the maximum delay limit in "brl.mod/system.mod/system.linux.c" (in line 270 on my machine) by replacing "tv.tv_sec=10;" to "tv.tv_sec=0;":
void bbSystemWait(){
	fd_set in_fds;
	struct timeval tv;
	
	if( !x_display ) return;
	
	FD_ZERO( &in_fds );
	FD_SET( x_fd,&in_fds );
	FD_SET( async_pipe[0],&in_fds );
	
  	tv.tv_sec=0;		//10
    tv.tv_usec=0;

	select( (x_fd>async_pipe[0] ? x_fd : async_pipe[0]) + 1,&in_fds,0,0,&tv );
	
	bbSystemPoll();
}


3) recompile your modules brl.system and bah.gtkmaxgui.

For me the power-consumption hasn't changed at all. The application falls asleep when inactive.

Maybe this should be tested with other distros and then published in the next update.

Regards, Simon


explosive(Posted 2012) [#4]
FLTK now works as well.
Add this
Import "-lfontconfig"

to "maxgui.mod/fltkmaxgui.mod/fltkimports.bmx" somewhere in the ?Linux-block (for me line 22).
Recompile and you should be fine.