Search code examples
cfreeswitch

Freeswitch ESL "cannot find -lesl"


I have written a simple ESL application in C. while compiling "ld" complains that it cannot find "-lesl":

sudo gcc -o test_app main.c -lpthread -lm -lpq -lesl -L. -Isrc/include
/usr/bin/ld: cannot find -lesl
collect2: error: ld returned 1 exit status

I searched for "libesl.so" and could not find this. I am sure I missed out something while compiling Freeswitch. Can anyone please point out, what am I missing. Thank you.


Solution

  • solved as follows:

    gcc -fPIC -g -c -Wall esl.c
    gcc -fPIC -g -c -Wall esl_buffer.c    
    gcc -fPIC -g -c -Wall esl_config.c
    gcc -fPIC -g -c -Wall esl_event.c
    gcc -fPIC -g -c -Wall esl_json.c
    gcc -fPIC -g -c -Wall esl_threadmutex.c
    
    gcc -shared -Wl,-soname,libesl.so.1 \
    -o libesl.so.1.0.1 esl_buffer.o \
    esl.o esl_config.o esl_event.o \
    esl_json.o esl_threadmutex.o -lm 
    

    [-lm must be at the end of the line]

    cp -p /usr/src/freeswitch/libs/esl/src/libesl.so.1.0.1 /usr/local/lib  
    ln -s /usr/src/freeswitch/libs/esl/src/libesl.so.1.0.1 /usr/local  /lib/libesl.so.1
    ln -s /usr/src/freeswitch/libs/esl/src/libesl.so.1 /usr/local/lib/libesl.so
    
    echco '/usr/local/lib' > /etc/ld.conf.d/libesl.conf
    
    run ldconfig