Linking GTKMaxGUI program on Ubuntu 12.04 64-bit

Archives Forums/Linux Discussion/Linking GTKMaxGUI program on Ubuntu 12.04 64-bit

JoshK(Posted 2013) [#1]
I'm attempting to build a program that uses Brucey's GTK MaxGUI implementation on Ubuntu 12.04 64-bit LTS. When I build it, I get the errors below. (The program works fine using the FLTK implementation of MaxGUI.)
Building test
Compiling:test.bmx
flat assembler  version 1.68  (32768 kilobytes memory)
3 passes, 4515 bytes.
Linking:test.debug
/usr/bin/ld: cannot find -lglib-2.0
/usr/bin/ld: cannot find -lgtk-x11-2.0
/usr/bin/ld: cannot find -lgdk-x11-2.0
/usr/bin/ld: cannot find -latk-1.0
/usr/bin/ld: cannot find -lpangox-1.0
/usr/bin/ld: cannot find -lpango-1.0
/usr/bin/ld: cannot find -lgobject-2.0
/usr/bin/ld: cannot find -lgmodule-2.0
collect2: ld returned 1 exit status
Build Error: Failed to link /home/josh/Desktop/test.debug
Process complete

Here is the program:
Import bah.gtkmaxgui
'Import maxgui.drivers

Strict 

AppTitle = "CreateWindow() Example"

Global FLAGS:Int

' Comment/uncomment any of the following lines to experiment with the different styles.

FLAGS:| WINDOW_TITLEBAR
FLAGS:| WINDOW_RESIZABLE
FLAGS:| WINDOW_MENU
FLAGS:| WINDOW_STATUS
FLAGS:| WINDOW_CLIENTCOORDS
'FLAGS:| WINDOW_HIDDEN
FLAGS:| WINDOW_ACCEPTFILES
'FLAGS:| WINDOW_TOOL
'FLAGS:| WINDOW_CENTER

Local window:TGadget = CreateWindow( AppTitle, 100, 100, 320, 240, Null, FLAGS )

If (FLAGS & WINDOW_STATUS) Then
	SetStatusText( window, "Left aligned~tCenter aligned~tRight aligned" )
EndIf

Repeat
	WaitEvent()
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE
			End
	End Select
Forever

Can anyone help?


dawlane(Posted 2013) [#2]
Easy been messing around with gtk for the last few hours

sudo ln -s /lib/i386-linux-gnu/libglib-2.0.so.0 /usr/lib32/libglib-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0 /usr/lib32/libgtk-x11-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0 /usr/lib32/libgdk-x11-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libatk-1.0.so.0 /usr/lib32/libatk-1.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libpangox-1.0.so.0 /usr/lib32/libpangox-1.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libpango-1.0.so.0 /usr/lib32/libpango-1.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0 /usr/lib32/libgmodule-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 /usr/lib32/libgobject-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0 /usr/lib32/libgdk_pixbuf-2.0.so


JoshK(Posted 2013) [#3]
Works! Thank you. The MaxGUI examples look super professional on Linux with GTK.

On exiting the above program, I get this strange error:
Building test
Compiling:test.bmx
flat assembler  version 1.68  (32768 kilobytes memory)
3 passes, 4515 bytes.
Linking:test.debug
Executing:test.debug
`menu_proxy_module_load': /home/josh/Desktop/test.debug: undefined symbol: menu_proxy_module_load
(test.debug:3056): Gtk-WARNING **: Failed to load type module: (null)
WindowActivate: data=0, mods=0, x=0, y=0, extra=""
WindowClose: data=0, mods=0, x=0, y=0, extra=""

Process complete


This error occurs with:
-MaxGUI window example (commenting out WINDOW_MENU prevents it.)
-MaxGUI combobox example (does not use WINDOW_MENU, no explanation for this.)


dawlane(Posted 2013) [#4]
see if this fixes it
http://www.absolutelytech.com/2011/04/26/solved-undefined-symbol-menu_proxy_module_load-error-in-gnome-applications/

Got a problem with some of the tests programs. Some work ok in Vbox, but doesn't like real hardware.


JoshK(Posted 2013) [#5]
I get this message from the terminal, and the error still occurs:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
appmenu-gtk is already the newest version.
appmenu-gtk set to manually installed.
The following package was automatically installed and is no longer required:
  thunderbird-globalmenu
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.



dawlane(Posted 2013) [#6]
Try it as
sudo apt-get install appmenu-gtk:i386

One thing that must be remembered is when dealing with BlitzMax is to add :i386 on the end of any library on ubuntu/Linux Mint/Debian as on a 64bit system the default is to use the 64bit version.


JoshK(Posted 2013) [#7]
Thank you, it works perfectly. :)

This kind of thing is why I love BlitzMax.


dawlane(Posted 2013) [#8]
Wait until it's been tested on some else's system before jumping for joy.


JoshK(Posted 2013) [#9]
Too late. Jumped and landed, repeatedly. :D


dawlane(Posted 2013) [#10]
I think I need to pick Brucey's brains as for some reason I'm getting a free(): invalid pointer error with createmenu test when clicking an item on the menu bar. The weird thing is it does sometime work for a few seconds, but every so often.
Debugging for BlitzMax is just too time consuming.

Oh and here are the list of libraries needed to deploy BlitzMax applications for a 64bit version of ubuntu/debian/Mint

Note that the distribution has to have Multi-Arch enabled.
GL
libglu1:i386 < should install libgl1-mesa libraries if you get a missing gl/glu error but shouldn't be needed if using a propriety drive with 32bit enabled.

Core
libstdc++6:i386 libx11-6:i386 libxxf86vm1:i386 libfreetype6:i386 libxpm4:i386

Audio
libpulse0:i386
libasound2:i386
libopenal1:i386

GTK
libglib2.0-0:i386 libgtk2.0-0:i386

You shouldn't need to make any links


Sub_Zero(Posted 2013) [#11]
JoshK: What version of GtkMaxgui are you using? I could only find the old one on his other website, and the module won't build...


dawlane(Posted 2013) [#12]
@Sub_Zero: At a guess he's using the one in Brucey's svn repository at http://code.google.com/p/maxmods/source/checkout.
You will have problems using gtk on a 64bit distribution (don't know about the 32bit versions) of Ubuntu/Linux Mint and Debian and your mileage will vary depending on the distribution.
Current issues range from what looks like a pointer corruption with menus on Linux Mint to getting the necessary 32bit gtk engines and modules to install.


Derron(Posted 2013) [#13]
@dawlane: with deploying you mean: if you give your app to another user of a 64bit version he has to add that libs?
I know staticyally linked libs are not favored by many - but as soon as you give it to casual gamers (moms of linux-fans :D) they should not have to take care of libraries... unrar/unpack and clicking on the binary should be enough. It would be ok to make a .deb, install the libs automatically. But I won't do that for ":i386" - as some of the libs tend to try to uninstall the normal 64bit libs (the whole environment). Not very nice for previously fine running systems :D.

So I hope (not tested it now) you mean something different with "deploying".


@invalid pointer error:
maybe better create a bug thread for this in bruceys subforum (I know he reads the linux section too) - people might be looking there earlier.


bye
Ron


dawlane(Posted 2013) [#14]
@Derron: You shouldn't statically link to any library in Linux without reading the library license first. I had to point this out to someone over on the Monkey forum. After all you wouldn't be wanting the lawers chasing you now would you because you statically linked to a GPL/LGPL library and you wont release your source code/compiled object when some asks for it.

if you give your app to another user of a 64bit version he has to add that libs?
If your program is 32bit you will need to ensure that those libraries are installed on the system. Now if there was a version of BlitzMax that natively compiled code to 64bit then there wouldn't be all that messing around.
I remember when the first 64bit built version of Linux was released and people trying to get BlitzMax to work on it. It didn't occur to people to set up a 32bit chroot environment to get round it.

Ubuntu 12.04+/Debian 7 and Linux Mint 13 all are capable of supporting multiple architectures. Some of these distributions need this to be set up first and the command dpkg --add-arcitecture i386 is all you should need to do. You tend to find the configurations in /var/lib/dpkg/arch or /etc/dpkg/dpkg.cfg.d/multiarch.

I haven't seen any pacakge get removed, a few get upgraded and this I guess is to the multi-arch aware version of that package. The only exception I could think of would be libgl1 with any related driver and packages where the maintainer hasn't allowed for multi-arch awareness. If will have to double check on the libgl issue as I was testing with VM.

If you look in the repositories for Ubuntu 12.04 (13.10 is a different story)/Linux Mint and Debian you will see the multi-arch packages ia32-libs-multiarch/ia32-libs-i386. These replaced ia32-libs.
In the old ia32-libs package. The libraries use to get installed to directories named lib32, but all packages in linux under multi-arch are installed as prefix-linux-gnu. Here prefix can any CPU that linux can run on.

I haven't built a deb package in years and at the time it was faster just to write a simple script than setting up a environment to build a deb package. Though I will have to have a look at what the latest packaging tools have to offer.


Derron(Posted 2013) [#15]
Thanks for the response.

I had some library-uninstall/replace-suggestions from apt-get when trying to satisfy all requirements for making wxwidgets working ... so I thought it will happen with other libraries too.

@Licences: I know that statically linked libs have licences we have to pay attention to (except we also have a compatible licence - albeit nobody can compile because he does not own blitzmax :D).

Also I am having no problems to state in a readme what is needed for making a linux computer capable of running my apps - was more of a general question about possibilities.

@multiple architectures: thought with 12.04 there were still enough problems to do so ... which made especially wxwidgets (->wxmax) not that easy to compile/make working with blitzmax (compiling on 32bit, running on 64bit with "ln -s"-libs). ... maybe that changed during the last months.


bye
Ron


dawlane(Posted 2013) [#16]
thought with 12.04 there were still enough problems to do so ... which made especially wxwidgets (->wxmax) not that easy to compile/make working with blitzmax (compiling on 32bit, running on 64bit with "ln -s"-libs). ... maybe that changed during the last months.
I think there still is issues like that. Haven't messed around with wxwidgets since Ubuntu 11.04. I actually got half of it to work, but some parts like requesters just wouldn't play ball and some parts needed i386 libraries that were just not available without downloading and forcing or manually installing them.

I have started to come to the conclusion that it's just too much of a hassle to use anything GUI related with BlitzMax and Linux on a 64bit system as there are alternatives that compile code to the native 64bit architecture.

Currently I've been messing around with PureBasic and Object Pascal (with the Lazarus IDE) and found out that I can get things done without too much messing around setting thing up and getting them to work.


Sub_Zero(Posted 2013) [#17]
I got the gtk module built on 32 bit kubuntu 13.10

But when trying to compile either of the examples, i get:

/usr/bin/ld: /home/BlitzMax/mod/bah.mod/gtkmaxgui.mod/gtkmaxgui.release.linux.x86.a(gtkgadget.bmx.release.linux.x86.o): undefined reference to symbol 'gdk_pixbuf_rotate_simple'
/usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0: error adding symbols: DSO missing from command line

off topic: I actually had to create a dummy .deb package once, to satisfy apt-get's dependencies on 64bit debian or ubuntu i can't remember, because it just wouldn't install one package(libc6-dev-i386_2.13-38_amd64.deb), even if i tried to force it in. So i forced in the other dependencies manually, and then this dummy package, lol, but it worked.
to build modules in blitzmax.


dawlane(Posted 2013) [#18]
Try adding Import "-lgdk_pixbuf-2.0" to the your source code.
The problems you will have then will be related to gtk-engine stuff.


Sub_Zero(Posted 2013) [#19]
Now it works, thanks alot ;)


dawlane(Posted 2013) [#20]
Just in case any one would like to know. I finally figured out what was causing the random crashes with GTK and the menus.
For some reason it didn't like Faenza-Blue-Dark2 icons which was the icon theme I was using at the time.


JoshK(Posted 2013) [#21]
Any time you customize a Linux distro, in any way, you are branching away from the main/supported/official version and setting yourself up for problems.


dawlane(Posted 2013) [#22]
It's something you will need to take into consideration when you deploy your application. I didn't even think about the icons until I had to do a re-installation and ran the test programs before installing the icons.
Running the test app in Valgrind kept pointing to a memory leak with png's but couldn't pin it down exactly.


Derron(Posted 2013) [#23]
You will have to take a look about missing icons... if you use a special icon set not having all icons present - most of the times you see the "default" icon getting used.

But here with default mint15-"cinnamon" the owncloud-app misses icons (just a black rectangle) ... take care of apps like jdownloader, they use custom implementations for the tray symbols which do not work for all "taskbars" - eg. transparency bugs.

But in "normal situations" the change of icons should not change the behaviour of the installed programmes ... pure visual appeareance modification.

@memleak : if doubt it is in the gtk-sources (there are many eyes observing the development).

bye
Ron


dawlane(Posted 2013) [#24]
There is one thing I know Derron. And that the gtkmax-gui tests had problems with icons on openSUSE 12.3. It was throwing up errors about incompatible library that was libpng related.


Derron(Posted 2013) [#25]
Hmm... and libpng may be the reason here too ... Brucey did replace it for one of his mods... maybe there is a the entry to the bug hole.

bye
Ron


dawlane(Posted 2013) [#26]
At a wild guess and could be completely off the mark. I was thinking that it could have something to do with libpng.mod needed updating or clashing.


Derron(Posted 2013) [#27]
http://www.blitzbasic.com/Community/posts.php?topic=100652

->Brucey's post:
"And this is what happens when you try to mix the same API with different versions…"

(maxide.debug:3072): Gtk-WARNING **: Error loading icon: Failed to load image '/usr/share/icons/oxygen/16x16/actions/application-exit.png': Fatal error in PNG image file: Incompatible libpng version in application and library


How and what he has done should be readable in his freeimage.mod (it uses a newer libpng).


bye
Ron


dawlane(Posted 2013) [#28]
Is it me or is BlitzMax starting to become the programming language version of FORD cars (Fix Or Repair Daily).


Derron(Posted 2013) [#29]
The situation wont get better.

It is just a matter of "author" or "user" produced patches.


I am really sad about the (so it seems) stopped progress of "Bismuth"
http://www.blitzforum.de/worklogs/505/
and docs
http://www.noobody.org/Data/bismuth-manual.html

Which was kind of a blitzmax-variant more (planned) features.

Chances decrease to get a more future proof life with BlitzMax. But i am not trying to start another "BMs future"-discussion.


bye
Ron


dawlane(Posted 2013) [#30]
Ok I got Brucey's freeimage installed and had to rearrange the header file includes in ImfHuf.cpp to get it to build.
#include <string.h>
#include <algorithm>
#include <ImfHuf.h>
#include <ImfInt64.h>
#include <ImfAutoArray.h>
#include "Iex.h"
#include <assert.h>

I've reinstalled the theme icons I was using and it's having problems loading
the common action icons, but at least it's not just randomly crashing with misleading random error messages. Still what message I getting is still cryptic.

Chances decrease to get a more future proof life with BlitzMax.
Which is a pity really. Monkey does have one advantage with all source code included (when you buy the pro version you get access to the the other targets) so you can fix things yourself, but some of the output code doesn't look like it follows the Intel guide lines for 32bit/64bit migrations.

EDIT: It's did not like me installing gtk2-engines-pixbuf:i386

Looks like I will exploring themes.


Derron(Posted 2013) [#31]
What happens if you replace the "corrupt"-png file with a working one?

Just to clarify it is the images binary data ... not something else.


bye
Ron


dawlane(Posted 2013) [#32]
I don't think it's a corrupt file as the other applications should die if it was, but a do get a warning about the application being built with libpng 1.2 but uses libpng 1.6.
I will have to see if this could be a 64bit<>32bit gtk problem, but sofar those themes based on clearlooks work as long as your using the default gnome icons.


JoshK(Posted 2013) [#33]
If you make this modification to bmk so debug symbols don't get stripped, and then debug your app from Code::Blocks, you can actually get more debug info than the BMX debugger gives you. At least it gives you the function name you crashed in:
http://blitzmax.com/Community/posts.php?topic=101510

This allowed me to fix a few little problems I would have otherwise been lost in.


dawlane(Posted 2013) [#34]
OK looks like I finally figured out what was going off with the original random menu crash.
After I removed the FreeImage module and a rebuild. I switch the icons to which I know will crash the application (Faenza-Blue-Dark2). I then ran
sudo update-mime /usr/share/mime/
sudo update-mime-database /usr/share/mime/
sudo gtk-update-icon-cache /home/jason/.icons/Faenza-Blue-Dark2

Logged Out and in
Then tested the menu app again, but this time with success.
I can only conclude that the icon cache doesn't get updated correctly when you install a theme. Or Brucey's GTK module needs looking at.

Using FreeImage.mod on a 64bit while trying to use gtk2-engines-pixbuf:i386 (and maybe others) causes problems. I will have to investigate this at a later date.

Edit: Found out that there is a bug in the Mint-X icons. The names shouldn't have spaces in them.
/usr/share/icons/Mint-X/apps/scalable/cairo-dock -c.svg
/usr/share/icons/Mint-X/apps/scalable/cairo-dock -o.svg