Friday, October 28, 2011

Build FBReader on Solaris

Here are my steps.
Environment: 
Solaris 11 Express x64
Gnome desktop
gcc-3.4.3
PATH=/usr/sfw/bin:/usr/gnu/bin:/usr/bin:/bin

Step 1: Build the dependencies first
$./configure; make; sudo make install
These libraries will be installed in /usr/local/lib

Step 2: Build FBReader-0.12.10
Need some hacks here.
1) makefiles/arch/desktop.mk
     13 CFLAGS = -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W -DLIBICONV_PLUG -DDO_ICONV_CAST
     14 LDFLAGS = -L /usr/local/lib -R /usr/local/lib
2) fbreader/src/formats/fb2/FB2Reader.h
 It seems "_P" had been defined somewhere and cause enum declaration errors.
     23 #include <ZLXMLReader.h>
     24
     25 #undef _P
     26
     27 class FB2Reader : public ZLXMLReader {
3) zlibrary/core/src/unix/library/ZLibrary.cpp
Thanks to Rod Evans' great catch, I added an extra dlerror() to make sure it returns NULL before calling dlsym().
    128         void (*initLibrary)();
    129         dlerror();
    130         *(void**)&initLibrary = dlsym(handle, "initLibrary");
4) make; sudo make install
5) /usr/bin/FBReader &  (or run it from GNOME menu: start -> Office ->E-book reader)
Have fun.