openSSL mac undefined symbol

Discussion in 'Mac Programming' started by yachiro, Jun 22, 2011.

  1. yachiro macrumors newbie

    Jun 22, 2011
    Hello guys,

    I'm a french student in engineering school and i'm working in my company on developing a TLSclient for MAC.

    But for now, I have a little problem for building my project on MACOSX (working very well on linux) and most particulary in using openssl libs.

    Here's my console error I hope you could help me deal with

    gcc -lpthread -o *.o /opt//local/var/macports/software/openssl97/0.9.7m_0/opt/local/lib/openssl97/lib/libssl.a /opt//local/var/macports/software/openssl97/0.9.7m_0/opt/local/lib/openssl97/lib/libcrypto.a -ldl
    Undefined symbols:
    "_SSL_CTX_set_info_callback", referenced from:
    _MTLSServer_Setup in MTLSServer.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [mtls_server] Error 1

    Thanks for your help

    Kind regards

    P.S : I'm french so if you have any problem understanding me feel free to tell me.
  2. jiminaus macrumors 65816


    Dec 16, 2010
    Don't go so deep into the MacPorts directory structure. When a port is installed, the headers are put in /opt/local/include and the library files are put in /opt/local/lib.

    Compile with (for each .c file):
    gcc -I/opt/local/include -c filename.c
    Link with (assuming you do actually want to statically link with libssl, libcrypto and libz):
    gcc -o progname -lpthread -ldl /opt/local/lib/libz.a /opt/local/lib/libssl.a /opt/local/lib/libcrypto.a *.o

Share This Page