Including srilm *.a inside a .so

Jordi Adell jadell at
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 

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

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

    $> nm libmisc.a | grep tclmain

    And this object has two undefined symbols;
         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

    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, this error is given:
    ldd -d
    undefined symbol: Tcl_AppInit   (/home/

    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	
Campus Nord D5-120 	web:
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: <>

More information about the SRILM-User mailing list