BenV's notes

Google Gears on Slackware 64 and firefox

by on Dec.14, 2009, under Software

Don’t ask me why, but for some greasemonkey script that I wanted to run in Firefox I needed Google Gears.
So I went to the gears site with Firefox, and it told me that it needed to install some plugin. Yeah, whatever.
I hit the big Install Gears button, completely ignoring the tiny and almost invisible for my eyes 32-bit OS (64-bit not supported) notice below it.
Needless to say it went on to download a 3.5Mb package, started some popups and other junk after which it notified me of my grave mistake.
Aha. So for some reason Google is too incompetent to work with 64 bits software…. even microsoft can deal with that these days guys, geesh.

So not wanting to give up immediately I decided to google for it a bit, and noticed that the Pokemon OS guys do have a gears version for their 64 bit Karmic and Lucid releases. Well, that must mean it’s possible! I took a quick look at their .deb file and didn’t see anything shocking, so I decided to try and build gears from svn.

benv@janeman:~$ cd /usr/src
benv@janeman:/usr/src$ svn checkout http://gears.googlecode.com/svn/trunk/ google-gears-svn
# A bunch of files get leeched here... Note that this was revision 3414.
benv@janeman:/usr/src$ cd google-gears-svn/gears
benv@janeman:/usr/src/google-gears-svn/gears$ make
# blabalbla until we hit:
../third_party/gecko_1.9/linux/gecko_sdk/bin/xpidl -I ../third_party/gecko_1.9/linux/gecko_sdk/idl -I ../third_party/gecko_1.9 -m header -o bin-dbg/linux-x86_64/ff3/genfiles/interfaces base/firefox/interfaces.idl
make[1]: ../third_party/gecko_1.9/linux/gecko_sdk/bin/xpidl: Command not found
make[1]: *** [bin-dbg/linux-x86_64/ff3/genfiles/interfaces.h] Error 127
make: *** [default] Error 2

Command not found? huh?

benv@janeman:~$ ls -la /usr/src/google-gears-svn/third_party/gecko_1.9/linux/gecko_sdk/bin/xpidl
-rwxr-xr-x 1 benv users 80542 2009-12-14 17:26 /usr/src/google-gears-svn/third_party/gecko_1.9/linux/gecko_sdk/bin/xpidl*

It’s right there…. ohhh, probably a 32 bit issue.

benv@janeman:~$ file /usr/src/google-gears-svn/third_party/gecko_1.9/linux/gecko_sdk/bin/xpidl
/usr/src/google-gears-svn/third_party/gecko_1.9/linux/gecko_sdk/bin/xpidl: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

So maybe THAT’s why they’re incompetent (read: lazy). Let’s see if we can get xipdl in a way that doesn’t need ancient 32 bit rubbish 😉
Mozilla has some stuff about that tool here. However, actually finding the download link for the source of that tool is challenging.
I’ll save you the trouble, you can get it here: ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/source/. Be aware, it’s a whopping 45MB download. That’s right, in the firefox sources.
Let’s see if it compiles:

benv@janeman:/us/src$ tar jxvf firefox-3.5.5.source.tar.bz2
# loads of mozilla
benv@janeman:/us/src$ cd mozilla-1.9.1 # What the heck, either rename your tarball or your dir... oh well
benv@janeman:/us/src/mozilla-1.9.1$ ./configure --prefix=/usr --enable-application=xpcom
# heaps of output
benv@janeman:/us/src/mozilla-1.9.1$ make -C config
# junk junk
benv@janeman:/us/src/mozilla-1.9.1$ make -C nsprpub
# even more landfill
benv@janeman:/us/src/mozilla-1.9.1$ make -C xpcom/typelib
# finally something useful

After this we finally have a working xpidl executable that is actually 64 bits.

benv@janeman:/us/src/mozilla-1.9.1$ file xpcom/typelib/xpidl/xpidl
xpcom/typelib/xpidl/xpidl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

Back to GEARS! The easiest way I could determine to get it to work was replacing their xipdl with our new version. I’m sure there’s an easier way through setting an environment variable or something, but I got tired of their Makefile includes and third party libraries before I could work that out. The easy way:

benv@janeman:~$ cd /usr/src/google-gears-svn/gears
benv@janeman:/us/src/google-gears-svn/gears$ ln -sf /usr/src/mozilla-1.9.1/xpcom/typelib/xpidl/xpidl /usr/src/google-gears-svn/third_party/gecko_1.9.1/linux/gecko_sdk/bin/xpidl
benv@janeman:/us/src/google-gears-svn/gears$ ln -sf /usr/src/mozilla-1.9.1/xpcom/typelib/xpt/tools/xpt_link /usr/src/google-gears-svn/third_party/gecko_1.9.1/linux/gecko_sdk/bin/xpt_link
benv@janeman:/us/src/google-gears-svn/gears$ ln -sf /usr/src/mozilla-1.9.1/xpcom/typelib/xpt/tools/xpt_dump /usr/src/google-gears-svn/third_party/gecko_1.9.1/linux/gecko_sdk/bin/xpt_dump
benv@janeman:/us/src/google-gears-svn/gears$ make BROWSER=FF31
# Make now passes the xipdl test. Next error:
g++ -I.. -Ibin-dbg/linux-x86_64/ff31 -Ibin-dbg/linux-x86_64/common -I../third_party/npapi -I../third_party -I../third_party/googleurl -I../third_party/icu38/public/common -DPNG_USER_CONFIG -DCHROME_PNG_WRITE_SUPPORT -DGEARS_PNG_BUILD -I../third_party/zlib -I../third_party/skia/include/core -I../third_party/skia/include/images -I../third_party/skia/include/utils -DNO_GZIP -DNO_GZCOMPRESS -DLINUX -I../third_party/gtk/include/gtk-2.0 -I../third_party/gtk/include/atk-1.0 -I../third_party/gtk/include/glib-2.0 -I../third_party/gtk/include/pango-1.0 -I../third_party/gtk/include/cairo -I../third_party/gtk/lib/gtk-2.0/include -I../third_party/gtk/lib/glib-2.0/include -DDEBUG=1 -DUSING_CCTESTS=1 -I../third_party/gtest/include -I../third_party/gtest -c -o bin-dbg/linux-x86_64/common/third_party/url_parse.o -fPIC -fmessage-length=0 -Wall -Werror -g -O0 -fshort-wchar -fno-exceptions -fno-rtti -Wno-non-virtual-dtor -Wno-ctor-dtor-privacy -funsigned-char -Wno-char-subscripts ../third_party/googleurl/src/url_parse.cc
../third_party/googleurl/src/url_parse.cc: In function 'int url_parse::::DoParsePort(const CHAR*, const url_parse::Component&)':
../third_party/googleurl/src/url_parse.cc:479: error: there are no arguments to 'atoi' that depend on a template parameter, so a declaration of 'atoi' must be available
../third_party/googleurl/src/url_parse.cc:479: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../third_party/googleurl/src/url_parse.cc: In function 'int url_parse::::DoParsePort(const CHAR*, const url_parse::Component&) [with CHAR = char]':
../third_party/googleurl/src/url_parse.cc:674: instantiated from here
../third_party/googleurl/src/url_parse.cc:479: error: 'atoi' was not declared in this scope
../third_party/googleurl/src/url_parse.cc: In function 'int url_parse::::DoParsePort(const CHAR*, const url_parse::Component&) [with CHAR = url_parse::UTF16Char]':
../third_party/googleurl/src/url_parse.cc:678: instantiated from here
../third_party/googleurl/src/url_parse.cc:479: error: 'atoi' was not declared in this scope
make[1]: *** [bin-dbg/linux-x86_64/common/third_party/url_parse.o] Error 1
make: *** [default] Error 2

Ghoooh, idiots. Maybe they should invest in a configure script or something. After messing with environment variables for a while, I decided that their Makefiles are about as kanker as their effort of giving us a 64 bit package in the first place. I would expect to be able to set CXXFLAGS="-include /usr/include/stdlib.h", but that was completely ignored. CPPFLAGS did seem to work however. Since another file missed another include, I added that as well.

benv@janeman:/us/src/google-gears-svn/gears$ CPPFLAGS="-include /usr/include/stdlib.h -include /usr/include/string.h -include /usr/include/limits.h" make BROWSER=FF31
# Onto the next error
g++ -include /usr/include/stdlib.h -include /usr/include/string.h -include /usr/include/limits.h -I.. -I -Ibin-dbg/linux-x86_64/common -I../third_party/npapi -I../third_party -I../third_party/googleurl -I../third_party/icu38/public/common -DPNG_USER_CONFIG -DCHROME_PNG_WRITE_SUPPORT -DGEARS_PNG_BUILD -I../third_party/zlib -I../third_party/skia/include/core -I../third_party/skia/include/images -I../third_party/skia/include/utils -DNO_GZIP -DNO_GZCOMPRESS -DLINUX -I../third_party/gtk/include/gtk-2.0 -I../third_party/gtk/include/atk-1.0 -I../third_party/gtk/include/glib-2.0 -I../third_party/gtk/include/pango-1.0 -I../third_party/gtk/include/cairo -I../third_party/gtk/lib/gtk-2.0/include -I../third_party/gtk/lib/glib-2.0/include -DDEBUG=1 -DUSING_CCTESTS=1 -I../third_party/gtest/include -I../third_party/gtest -I.. -Ibin-dbg/linux-x86_64/ff3 -Ibin-dbg/linux-x86_64/common -I../third_party/npapi -I../third_party -I../third_party/googleurl -I../third_party/icu38/public/common -DPNG_USER_CONFIG -DCHROME_PNG_WRITE_SUPPORT -DGEARS_PNG_BUILD -I../third_party/zlib -I../third_party/skia/include/core -I../third_party/skia/include/images -I../third_party/skia/include/utils -DNO_GZIP -DNO_GZCOMPRESS -DLINUX -I../third_party/gtk/include/gtk-2.0 -I../third_party/gtk/include/atk-1.0 -I../third_party/gtk/include/glib-2.0 -I../third_party/gtk/include/pango-1.0 -I../third_party/gtk/include/cairo -I../third_party/gtk/lib/gtk-2.0/include -I../third_party/gtk/lib/glib-2.0/include -DDEBUG=1 -DUSING_CCTESTS=1 -I../third_party/gtest/include -I../third_party/gtest -c -o bin-dbg/linux-x86_64/ff3/module.o -fPIC -fmessage-length=0 -Wall -Werror -g -O0 -fshort-wchar -fno-exceptions -fno-rtti -Wno-non-virtual-dtor -Wno-ctor-dtor-privacy -funsigned-char -Wno-char-subscripts -DBROWSER_FF3=1 -DJS_THREADSAFE -DBROWSER_FF=1 -I../third_party/gecko_1.9 -I../third_party/gecko_1.9/linux -I../third_party/gecko_1.9/linux/gecko_sdk/include -DMOZILLA_STRICT_API base/firefox/module.cc
In file included from ../gears/factory/factory_ff.h:29,
from base/firefox/module.cc:46:
bin-dbg/linux-x86_64/ff31/genfiles/interfaces.h:33: error: expected ',' or '...' before 'NS_OUTPARAM'
bin-dbg/linux-x86_64/ff31/genfiles/interfaces.h:106: error: expected ',' or '...' before 'NS_OUTPARAM'
bin-dbg/linux-x86_64/ff31/genfiles/interfaces.h:109: error: expected ',' or '...' before 'NS_OUTPARAM'
bin-dbg/linux-x86_64/ff31/genfiles/interfaces.h:112: error: expected ',' or '...' before 'NS_OUTPARAM'
make[1]: *** [bin-dbg/linux-x86_64/ff31/module.o] Error 1
make: *** [default] Error 2

RAAAH, this keeps getting better and better. This fix was simple enough, simply edit that header file and remove all occurances of ‘NS_OUTPARAM’, whatever the heck that might be:

benv@janeman:/us/src/google-gears-svn/gears$ sed -ie 's/NS_OUTPARAM//g' bin-dbg/linux-x86_64/ff3/genfiles/interfaces.h
benv@janeman:/us/src/google-gears-svn/gears$ CPPFLAGS="-include /usr/include/stdlib.h -include /usr/include/string.h -include /usr/include/limits.h" make BROWSER=FF31
# And it goes on
cc1plus: warnings being treated as errors
desktop/desktop.cc: In member function 'bool Desktop::ValidateShortcutInfo(Desktop::ShortcutInfo*, bool)':
desktop/desktop.cc:222: error: suggest parentheses around && within ||
desktop/desktop.cc:224: error: suggest parentheses around && within ||
desktop/desktop.cc:226: error: suggest parentheses around && within ||
make[1]: *** [bin-dbg/linux-x86_64/ff31/desktop.o] Error 1

Aha, they request warnings to be error by default. Seems like running it with MODE=opt fixes this issue.

benv@janeman:/us/src/google-gears-svn/gears$ CPPFLAGS="-include /usr/include/stdlib.h -include /usr/include/string.h -include /usr/include/limits.h" make MODE=opt BROWSER=FF31
# Ha, but even this fails
cc1: warnings being treated as errors
../third_party/sqlite_google/src/mutex_unix.c: In function 'pthreadMutexAlloc':
../third_party/sqlite_google/src/mutex_unix.c:142: error: implicit declaration of function 'pthread_mutexattr_settype'
../third_party/sqlite_google/src/mutex_unix.c:142: error: 'PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)
../third_party/sqlite_google/src/mutex_unix.c:142: error: (Each undeclared identifier is reported only once
../third_party/sqlite_google/src/mutex_unix.c:142: error: for each function it appears in.)
make[1]: *** [bin-opt/linux-x86_64/common/sqlite/mutex_unix.o] Error 1
make: *** [default] Error 2

GODQ@#($*@#*^%^& STUPID … *tries to contain the daemon within* … *RAAAGE*. Another missing include…. *sigh*

benv@janeman:/us/src/google-gears-svn/gears$ sed -ie 's/-Wall//g' tools/config.mk
benv@janeman:/us/src/google-gears-svn/gears$ CPPFLAGS="-include /usr/include/stdlib.h -include /usr/include/string.h -include /usr/include/limits.h -include /usr/include/pthread.h -D_XOPEN_SOURCE=600" make MODE=opt BROWSER=FF31

Needless to say building an optimized version goes to another directory, so now you need to do the above NS_OUTPARAM thing again on the interfaces.h file in the bin-opt dir.
Anyway, finally it compiled after messing with it for hours. Hopefully this log contains some useful info for you 🙂

Last but not least, we still need to make an installer for it:

benv@janeman:/us/src/google-gears-svn/gears$ make MODE=opt BROWSER=FF31
# some output here, nothing weird

Finally we end up with a bin-opt/installers/gears-linux-x86_64-opt-0.5.34.0.xpi that we can install in firefox. Phew.

Now what was I doing that needed gears anyway? … can’t remember. Feh.

Gears and Firefox 3.5.5 on Slackware 64

Gears and Firefox 3.5.5 on Slackware 64




:, , ,

1 Trackback or Pingback for this entry

Leave a Reply

You must be logged in to post a comment.

Archives

  • 2018 (1)
  • 2016 (1)
  • 2015 (7)
  • 2014 (4)
  • 2013 (11)
  • 2012 (27)
  • 2011 (26)
  • 2010 (25)
  • 2009 (68)