[4.30 beta 5] WebGadget on Ubuntu 8.10

Linux specific forum
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

[4.30 beta 5] WebGadget on Ubuntu 8.10

Post by Little John »

Hi all,

when running the example program WebBrowser.pb that ships with PB 4.30 beta 5 on Ubuntu 8.10,
I get the following errors:

Code: Select all

Frame3DGadget(6, 0, 30, 0, 2, "", 2)
[WARNING] Gtk (WARNING): gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 17

Code: Select all

If WebGadget(10, 0, 31, 0, 0, "http://www.purebasic.com") = 0
[ERROR] Invalid memory access.
PB opened a window, but it didn't show the web page.

Then I added WebGadgetPath(), so that the code reads

Code: Select all

WebGadgetPath("libgtkembedmoz.so", "/usr/lib/thunderbird")
If WebGadget(10, 0, 31, 0, 0, "http://www.purebasic.com") = 0
With this I got the same warning as before, but now there was the webgadget which displayed the web page.
After quitting the mini browser (using "close" in the system menu), several warnings were generated, and also
an error on the very last line

Code: Select all

EndIf
[ERROR] Invalid memory access.
I'm using Ubuntu 8.10 with all current updates. The following packages are installed, which are important for
PureBasic programming:
- gcc
- libgnomeprintui2.2-0 and libgnomeprintui2.2-dev
- libgtk2.0-dev
- libgtkembedmoz.so
- libiodbc2 and libiodbc2-dev
- libsdl1.2-dev
- libstdc++6-4.2-dev
- libxine1 and libxine-dev
- libxul-dev
Does somebody know what happens here? Is this a bug in PureBasic 4.30 beta 5?

Regards, Little John
StanDan
User
User
Posts: 57
Joined: Sun Feb 26, 2006 3:43 am
Location: Missouri, United States

Think I've got it

Post by StanDan »

Yeah, it's a bit mysterious. This problem is certanly verified. It also breaks my executables which were previously compiled and linked against the library. The problem is that Ubuntu does not correctly make a symlink in /usr/lib. At least this fixed it for me.

Code: Select all

jonathan@laozi:/usr/lib$ ls -l libgtk*
libgtk2.0-0/                   libgtksourceview-1.0.so.0.0.0
libgtkembedmoz.so.0d           libgtksourceview-2.0.so.0
libgtkglext-x11-1.0.so.0       libgtksourceview-2.0.so.0.0.0
libgtkglext-x11-1.0.so.0.0.0   libgtkspell.so.0
libgtkhtml-2.so.0              libgtkspell.so.0.0.0
libgtkhtml-2.so.0.0.0          libgtk-vnc-1.0.so.0
libgtkhtml-3.14.so.19          libgtk-vnc-1.0.so.0.0.1
libgtkhtml-3.14.so.19.1.0      libgtk-x11-2.0.a
libgtkhtml-editor.so.0         libgtk-x11-2.0.la
libgtkhtml-editor.so.0.0.0     libgtk-x11-2.0.so
libgtkmm-2.4.so.1              libgtk-x11-2.0.so.0
libgtkmm-2.4.so.1.0.30         libgtk-x11-2.0.so.0.1400.4
libgtksourceview-1.0.so.0      
jonathan@laozi:/usr/lib$ ls -l libgtkembedmoz.so.0d 
-rw-r--r-- 1 root root 83888 2008-08-25 07:21 libgtkembedmoz.so.0d
jonathan@laozi:/usr/lib$ sudo ln -s libgtkembedmoz.so.0d libgtkembedmoz.so
[sudo] password for jonathan: 
jonathan@laozi:/usr/lib$ ls -l libgtkembedmoz.s*
lrwxrwxrwx 1 root root    20 2009-01-17 16:40 libgtkembedmoz.so -> libgtkembedmoz.so.0d
-rw-r--r-- 1 root root 83888 2008-08-25 07:21 libgtkembedmoz.so.0d
jonathan@laozi:/usr/lib$ libgtkembedmoz.so
After this the WebGadget.pb example compiles without a hitch. I'm using the following code for Linux production code. This way it will work either way.

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Linux

webGadgetLibDir.s = "/usr/lib"
webGadgetLibName.s = "libgtkembedmoz"
webGadgetLib.s  = ""
webGadgetPattern.s = webGadgetLibName+".*"

If ExamineDirectory(0, webGadgetLibDir, webGadgetPattern)
  While NextDirectoryEntry(0)
    If webGadgetLib = ""
      webGadgetLib = DirectoryEntryName(0)
    ElseIf Len(DirectoryEntryName(0)) < Len(webGadgetLib)
      webGadgetLib = DirectoryEntryName(0)
    EndIf      
  Wend
  FinishDirectory(0)
  
  If webGadgetLib = ""
    webGadgetLib = OpenFileRequester("Find libgtkembedmoz.so", "", "", 1)
    If webGadgetLib = ""
      MessageRequester("Error", "Cannot continue without libembedmoz.so!")
      End
    EndIf
    webGadgetLibDir = GetPathPart(webGadgetLib)
    webGadgetLib = GetFilePart(webGadgetLib)
  EndIf 
EndIf

WebGadgetPath(webGadgetLibDir + "/" + webGadgetLib)

CompilerEndIf
Cheers
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Think I've got it

Post by Little John »

Hi,

thanks for your reply.
StanDan wrote:Yeah, it's a bit mysterious. This problem is certanly verified. It also breaks my executables which were previously compiled and linked against the library. The problem is that Ubuntu does not correctly make a symlink in /usr/lib. At least this fixed it for me.

Code: Select all

...
Unfortunately, I've very little experience with Linux. So I don't understand what the code does. :sad:
StanDan wrote:After this the WebGadget.pb example compiles without a hitch. I'm using the following code for Linux production code. This way it will work either way.

Code: Select all

...
I copied that code to the beginning of WebBrowser.pb. I still get an IMA (now using version 4.30 final, of course). :sad:

I have a sharedlib named "libgtkembedmoz.so" in the folder "/usr/lib/thunderbird", and a sharedlib named "libgtkembedmoz.so.0d" in the folder "/usr/lib". There are also two link files named "libgtkembedmoz.so" which both point to the latter lib. One link file is in the folder "/usr/lib", the other one in the folder "/usr/lib/xulrunner". Don't know what all that means.

Regards, Little John
StanDan
User
User
Posts: 57
Joined: Sun Feb 26, 2006 3:43 am
Location: Missouri, United States

Simpler Explanation

Post by StanDan »

The exact solution that worked for me was to type the following into a Terminal.

Code: Select all

sudo su -
cd /usr/lib
ln -s libgtkembedmoz.so.0d libgtkembedmoz.so
After this the WebGadget.pb example worked without modification. I know that you've probably already checked for this, but are you sure your code isn't setting WebGadgetPath again later on? The code I pasted above really should work (and does work on my Ubuntu 8.10.) You might also make sure that you don't use the two argument form of WebGadgetPath(), in my experience that doesn't work.

You might also try and create a new PB document and then cut and paste the example WebGadget code from the Manual into it. This example is the simplest you're going to get. And it should work after you have added a symlink from libgtkembedmoz.so.0d to libgtkembedmoz.so.

I realize these are stupid suggestions, but I can't think of anything else. Good luck! Let us know how it works.
Post Reply