Undefined reference to functions in library

457 views Asked by At

I am trying to get Oktopous CCXML running to test the CCXML execution. I have the liboktopous 32 bit library which I downloaded from Oktopous site. The file info for the liboktopous.so

liboktopous.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped

The output of nm -D on liboktopous.so is here. The include file is

#ifndef _OKTOINTERPRETER_H_
#define _OKTOINTERPRETER_H_

#include <OktoDefs.hpp>
#include <string>


typedef std::basic_string<VXIchar> vxistring ;

class OktoLog;
class OktoPlatform;
class OktoInet;
class OutputQueue;
class OktoScript;


/**
 * Interface for interacting with the CCXML interpreter. 
 *
 * \ingroup Platform
 */
class OKTO_API OktoInterpreter 
{
    public:
        /** OktoInterpreter Result */

        enum Result {
            /** Fatal error, terminate call    */
            RESULT_FATAL_ERROR          = -100, 
            /** Out of memory                  */
            RESULT_OUT_OF_MEMORY        =   -6, 
            /** System error, out of service   */
            RESULT_SYSTEM_ERROR         =   -5, 
            /** Property name is not valid     */
            RESULT_INVALID_PROP_NAME    =   -3, 
            /** Property value is not valid    */
            RESULT_INVALID_PROP_VALUE   =   -2, 
            /** Invalid function argument      */
            RESULT_INVALID_ARGUMENT     =   -1, 
            /** Success                        */
            RESULT_SUCCESS              =    0,
            /** Normal failure, nothing logged */
            RESULT_FAILURE              =    1,
            /** Non-fatal non-specific error   */
            RESULT_NON_FATAL_ERROR      =    2, 
            /** Document not found             */
            RESULT_NOT_FOUND            =   50, 
            /** Other document fetch error     */
            RESULT_FETCH_ERROR          =   52,
            /** Not a valid CCXML document     */
            RESULT_INVALID_DOCUMENT     =   53, 
            /** Uncaught fatal VoiceXML event  */
            RESULT_UNCAUGHT_FATAL_EVENT =   55,
            /** ECMAScript syntax error        */
            RESULT_SCRIPT_ERROR         =   56,
            /** Not runnning                   */
            RESULT_NOT_RUNNING          =   57,
            /** Operation is not supported     */
            RESULT_UNSUPPORTED          =  100
        };

        enum EventThreadPolicy {
            POLICY_DEFAULT,
            POLICY_POOLED
        };
        /** 
         * Resources used by the interpreter when run. 
         * \ingroup Platform
         */
        struct Resources {
            /** log interface */
            OktoLog              * log;
            /** ECMAScript interface */
            OktoScript           * jsi;    
            /** Internet interface */
            OktoInet             * inet; 
            /** Platform interface */
            OktoPlatform         * platform; 
        };

    public:
        /**
         * One time initializtion of the interpreter.<p>
         * This function should be called once at platform startup.<p>
         *
         * @param log         Pointer to a log object.  This method does not retain
         *                    this object, rather uses it for the length of the
         *                    method call.
         * @param diagLogBase Base dialog ID.
         * @param output      [OUT] A pointer the to the output queue the platform
         *                    will receives commands from.  The platform should
         *                    create at least one thread to processes commands on.
         *
         * @return true if initialization is successful.
         */
        //static bool Initialize(OktoLog * log, VXIunsigned diagLogBase, OutputQueue **output, EventThreadPolicy policy);
        static bool Initialize(OktoLog * log,OutputQueue **output, EventThreadPolicy policy);

        /**
         * One time shutdown of the interpreter.
         *
         * @param log         Pointer to a log object.  This method does not retain
         *                    this object, rather uses it for the length of the
         *                    method call.
         * @param output      Pointer to the outout queue received from the call
         *                    to Initialize.
         */
        static void Deinitialize(OutputQueue *output );

        /**
         * Creates an instance of an interpreter.
         */
        static OktoInterpreter *CreateInstance();


        /**
         * Destroys an instance of an interpreter.
         */
        static void DestroyInstance( OktoInterpreter *interp );

        /**
         * Starts CCXML interpretation of the specified script.
         *
         * @param initialURI   [IN]  The URI of the starting CCXML doc.
         * @param args         [IN]  Option properties that affect interpreter
         *                           behavior: None now.
         * @param resources    [IN]  Resources supplied by the platform.
         *
         * @return: RESULT_FATAL_ERROR<br>
         *          RESULT_OUT_OF_MEMORY<br>
         *          RESULT_SUCCESS<br>
         *          RESULT_INVALID_ARGUMENT<br>
         *          RESULT_INVALID_DOCUMENT<br>
         */
        virtual Result Run(
                const VXIchar  * initialURI, 
                const VXIchar  * csessionid,
                const VXIchar  * fetchid,
                        const VXIMap    * fetchProperties, //Added this to send fetch props to fetcher
                const VXIMap   * args,
                Resources      * resources ) = 0;

        /**
         * Add an event to the event queue.
         *
         * @param event  [IN] The event to post.  If successful, the 
         *                    interpreter owns the VXIMap, otherwise
         *                    the caller is responsible for destroying
         *                    it.
         * @param delay  [IN] The delay, in milliseconds before the
         *                    event is processed.
         * 
         * @return  RESULT_SUCCESS<br>
         *          RESULT_NOT_RUNNING<br>
         *          RESULT_INVALID_ARGUMENT<br>
         */
        virtual Result PostEvent( VXIMap *event, VXIunsigned delay ) = 0;

        virtual bool CancelEvent(vxistring&  sendid) =0;
        //saurabh 2011 added for fetch testing,remove it if you still have it
        virtual OktoInet* returnInetResource()=0;
};

#endif

Now, when I try to compile

#include "/home/test/ccxml.back/oktopous/include/OktoInterpreter.hpp"

int main()
{
        OutputQueue *outQ;
        OktoInterpreter::Initialize(NULL,&outQ,OktoInterpreter::POLICY_DEFAULT);
        OktoInterpreter::Deinitialize(outQ);
}

using

g++ -m32  -I/home/test/ccxml.back/oktopous/include -L/home/test/ccxml.back/oktopous/lib/liboktopous.so ../wrapper/test.cpp

I get

/tmp/ccsJNUJi.o: In function `main':
test.cpp:(.text+0x21): undefined reference to `OktoInterpreter::Initialize(OktoLog*, OutputQueue**, OktoInterpreter::EventThreadPolicy)'
test.cpp:(.text+0x2d): undefined reference to `OktoInterpreter::Deinitialize(OutputQueue*)'
collect2: ld returned 1 exit status

What wrong am I doing?

1

There are 1 answers

0
Abhishek On BEST ANSWER

I worked this out. I thought that using -m32 flag will let me use 32 bit libraries in 64 bit machine. But it was not the case. I ported my code to a 32 bit machine and it worked out.