Including srilm *.a inside a .so

Jordi Adell jadell at gps.tsc.upc.edu
Fri Nov 9 02:12:16 PST 2007


Dear Andreas,

    I'm recently using SRILM toolkit, which I think is a very useful 
tool and very well done. Congratulations.

    Just a previous note: in the documentation of the LM library there 
is no explanation that the order has to be specified in the constructor 
or by using the setorder() function. En therefore, when you read a LM 
file using the LM::read() function if one do not take this into account 
the maximum order is always three.

    OK, now my question. I'm using SRILM inside a shared object, 
therefore I included it like this:

    g++ -shared 
-Wl,-z,muldefs,-whole-archive,-lflm,-llattice,-lmisc,-ldstruct,-loolm,-no-whole-archive 
-o lib.so

    This means that ALL symbols are included in the lib.so whether 
needed or not.

    In particular I have a problem with the Tcl_AppInit. If you compile 
the libraries with TCL option on, then tclmain.cc is included inside 
library libmisc.a

    $> nm libmisc.a | grep tclmain
       tclmain.o:

    And this object has two undefined symbols;
    tclmain.o:
         U Tcl_AppInit
         U Tcl_Main

    This symbols had to be defined in tcl library, however I'm using 
tcl8.4 and the Tcl_AppInit symbol is not defined there. In the tcl.h 
says this:
    /*
     * Convenience declaration of Tcl_AppInit for backwards compatibility.
     * This function is not *implemented* by the tcl library, so the storage
     * class is neither DLLEXPORT nor DLLIMPORT
     */
    #undef TCL_STORAGE_CLASS
    #define TCL_STORAGE_CLASS

    EXTERN int              Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));

    Therefore, if I try to use libmisc compiled with TCL inside the 
previously mention shared object lib.so, this error is given:
    ldd -d lib.so
    undefined symbol: Tcl_AppInit   (/home/lib.so)

    I noticed that if I compile the libraries wit TCL OFF then this 
problem disappears because tclmain.o is not included in the library.
   

    I wonder whether this is how it should work or if it is a bug that 
could be arranged for next SRILM version.

    I hope this is useful for somebody it took my a while to understand 
why I couldn't include the libraries inside my .so. They key point to do 
so with tcl8.4 is to compile SRILM without TCL option. This means to set 
NO_TCL = X in the appropriate makefile in srilm/common/


    Best Regards.
    Good job!
   

-- 
_______________________________________________________________________
Jordi Adell Mercado

TALP Research Center
Signal and Communication Theory Dpt.
Universitat Politècnica de Catalunya (UPC)


c/Jordi Girona 1-3	e-mail: jadell at gps.tsc.upc.es	
Campus Nord D5-120 	web: http://gps-tsc.upc.es/veu/personal/jadell
08034 - Barcelona	phone: 93-401.16.27
________________________________________________________________________


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3257 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.speech.sri.com/pipermail/srilm-user/attachments/20071109/7e84ac6d/attachment.bin>


More information about the SRILM-User mailing list