Compiling the viewer libraries LLMozLib (Linux)

From Second Life Wiki
Jump to: navigation, search
These instructions describe building LLMozLib for Linux. They are currently incomplete so if you have further information please fill in the gaps.

Note these are NOT Linden Labs instructions but are written my Michelle2 Zenovka based on what she found out attempting to do this

So far it is possible to build LLMozLib and link a homebrew viewer against it with out errors or crashing but this has not yet resulted in the HTML rendering on the login screen or the web profile tab, if you know why please fix this and let me know!

Download LLMozLib

Get LLMozLib at this stage as you require a patch from the tar ball.

Get the snapshot of llmozlib from

Download mozilla

According to other wiki pages ( Compiling_the_viewer_libraries_(MSVS_2003)#LLMozLib ) we are using the FIREFOX_1_5_0_9_RELEASE branch of mozilla. So get that branch :-

cvs login (the password is 'anonymous')
cvs checkout -r FIREFOX_1_5_0_9_RELEASE mozilla/
cd mozilla
make -f checkout MOZ_CO_PROJECT=xulrunner

Patch mozilla

Apply a patch which enables certain features that are required for the Second Life client.

The patch can be found in the llmozlib build_mozilla directory.
Copy the patch into the directory where you are building Mozilla and apply the patch:

patch -p0 < linden_updates.patch

Build mozilla

Assuming you are working in a directory where you have just downloaded mozilla (from above) which generated a mozilla folder and you have also downloaded and unpacked the llMozLib tarball and greated a llmozlib directory :-

To make a release build :-

cp llmozlib/build_mozilla/.mozconfig.optimized mozilla/.mozconfig
cd mozilla
make -f build

To make a debug build :-

cp llmozlib/build_mozilla/.mozconfig.debug mozilla/.mozconfig
cd mozilla
make -f build

  • Fix the build configuration file

Edit the mozilla/.mozconfig and add the following

ac_add_options --enable-default-toolkit=gtk2

ac_add_options --enable-xft

Also it seems necessary to remove

ac_add_options --enable-svg

  • 64 Bit (x86_64)

[cj] Trying to build with gcc 4.1.2 produced an "relocation R_X86_64_PC32 against ... can not be used" error at some point. I had to use gcc 3.4 to fix this. Michelle2's script sets these as default anyway so you should not see them using that.

Build LLMozLib

These are the required build flags :-

CPPFLAGS=-I$MOZDIR/include/content -I$MOZDIR/include/docshell -I$MOZDIR/include/dom \
-I$MOZDIR/include/gfx -I$MOZDIR/include/layout -I$MOZDIR/include/locale \ 
-I${MOZDIR}/include/necko -I$MOZDIR/include/nkcache -I$MOZDIR/include/pref \    
-I$MOZDIR/include/profdirserviceprovider \
-I$MOZDIR/include/string -I$MOZDIR/include/uriloader -I$MOZDIR/include/view \
-I$MOZDIR/include/webbrwsr -I$MOZDIR/include/widget -I$MOZDIR/include/xpcom \
-I$MOZDIR/include/xulapp -I$MOZDIR/sdk/include


CPPFLAGS += -Werror -fno-rtti -fno-exceptions

CPPFLAGS += -fPIC -shared

LINKFLAGS += -lnspr4 -lplc4 -lxpcom -lxul -lstdc++


Where MOZDIR is (for release build of mozilla) :-


and debug build of mozilla


The actual gcc commands are as follows :-

        g++ -c $CPPFLAGS llmozlib/llembeddedbrowser.cpp
        g++ -c $CPPFLAGS llmozlib/llembeddedbrowserwindow.cpp
        g++ -c $CPPFLAGS llmozlib/llmozlib.cpp
        g++  $CPPFLAGS $LINKFLAGS -o llembeddedbrowser.o \
llembeddedbrowserwindow.o llmozlib.o

That should produce a dynamic library

The following libraries should now be copied to your secondlife viewer app_settings/mozilla-runtime-linux-i686. In fact these files need to be present in the viewer source tree to enable building the client with MOZLIB=yes

       cp $MOZDIR/bin/ $VIEWERDIR/app_settings/mozilla-runtime-linux-i686
       cp $MOZDIR/bin/ $VIEWERDIR/app_settings/mozilla-runtime-linux-i686
       cp $MOZDIR/bin/ $VIEWERDIR/app_settings/mozilla-runtime-linux-i686 
       cp $MOZDIR/bin/ $VIEWERDIR/app_settings/mozilla-runtime-linux-i686
       cp $MOZDIR/bin/ $VIEWERDIR/app_settings/mozilla-runtime-linux-i686
       cp $MOZDIR/lib/libprofdirserviceprovider_s.a $VIEWERDIR/app_settings/mozilla-runtime-linux-i686
       cp $VIEWERDIR/app_settings/mozilla-runtime-linux-i686

Warning if you copy these to your system /usr/lib/ folder you may overwrite critical mozilla files with an older version that could stop thunderbird/firefox/icedove/iceweasel from working.


Below is a make file that does the above work, to use it download it to an empty folder and type make allwork, then (as root) make install. Other targets are included for just rebuilding llmozlib etc. The file can probably be improved *a lot* but its a starting point





CPPFLAGS=-I${MOZDIR}/include/content -I${MOZDIR}/include/docshell -I${MOZDIR}/include/dom \
-I${MOZDIR}/include/gfx -I${MOZDIR}/include/layout -I${MOZDIR}/include/locale \
-I${MOZDIR}/include/necko -I${MOZDIR}/include/nkcache -I${MOZDIR}/include/pref \ 
-I${MOZDIR}/include/profdirserviceprovider -I${MOZDIR}/include/string \ 
-I${MOZDIR}/include/uriloader  -I${MOZDIR}/include/view -I${MOZDIR}/include/webbrwsr \ 
-I${MOZDIR}/include/widget -I${MOZDIR}/include/xpcom -I${MOZDIR}/include/xulapp \ 


CPPFLAGS += -Werror -fno-rtti -fno-exceptions


LINKFLAGS += -lnspr4 -lplc4 -lxpcom -lxul -lstdc++


CPPFLAGS += -fPIC -shared

        wget ${CURMOZLIBSRC}
        tar -xvzf llmozlib*.tgz
        mv llmozlib-2007-02-23 llmozlib

         g++ -c ${CPPFLAGS} llmozlib/llembeddedbrowser.cpp
         g++ -c ${CPPFLAGS} llmozlib/llembeddedbrowserwindow.cpp
         g++ -c ${CPPFLAGS} llmozlib/llmozlib.cpp
         g++  ${CPPFLAGS} ${LINKFLAGS} -o llembeddedbrowser.o \
llembeddedbrowserwindow.o llmozlib.o

        cd llmozlib && rm -f *.o && rm -f *.so
        rm -f *.o
        rm -f *.so

        install -d ${DESTDIR}/usr/lib/
        install -m 0755 ${DESTDIR}/usr/lib/

        echo "Downloading mozilla"
        echo "Press ENTER at password prompt"
        cvs -d ${CVSROOT} login
        cvs -d ${CVSROOT} checkout -r ${FIREFOX_BRANCH} mozilla/
        make -f mozilla/ checkout MOZ_CO_PROJECT=xulrunner CC=${CC}

        cd mozilla && patch -p0 < ../llmozlib/build_mozilla/linden_updates.patch

        cp llmozlib/build_mozilla/.mozconfig.optimized mozilla/.mozconfig
        dos2unix mozilla/.mozconfig
        echo "ac_add_options --enable-default-toolkit=gtk2" >> mozilla/.mozconfig
        echo "ac_add_options --enable-xft" >> mozilla/.mozconfig
        cat mozilla/.mozconfig | sed 's/ac_add_options --enable-svg//g' > mozilla/.mozconfig
        make -f mozilla/ build CC=${CC}

all_mozilla: download_mozilla patch_mozilla compile_mozilla

       echo "todo fix install"

        echo "Umm don't know how to clean mozilla tree yet"

install: install_mozilla install_mozlib

all: compile_mozilla compile_mozlib

allwork: all_mozilla download_mozlib compile_mozlib

clean: clean_mozilla clean_mozlib

Build the client

It should be possible now to build the client with MOZLIB=YES on the scons line

  • Runtime files

The mozilla runtime files are all located in $MOZDIR/bin/ and you need to copy the following folders to your secondlife viewer folder. They should live in the app_settings/mozilla_runtime-linux-i686/ folder

  • chrome
  • components
  • greprefs
  • res
  • plugins

End of the line

This is far as i have got so far. I believe the LLMozLib code is starting up and it is finding the files in the above folders as without them you get error messages but there is currently no html rendering of the login screen or the web profiles etc.