Friday, October 28, 2011

Build FBReader on Solaris

Here are my steps.
Solaris 11 Express x64
Gnome desktop

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/
     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>
     25 #undef _P
     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.