Results 1 to 2 of 2

Thread: -lssl -ldl -lpthread linker flag is not working in ubuntu

  1. #1
    Join Date
    Sep 2013

    -lssl -ldl -lpthread linker flag is not working in ubuntu

    I have following linker/compiler command,
    LDFLAGS= -lssl -lcrypto -lstdc++ -lpthread -ldl
    CXXFLAGS=-c -O2 -std=gnu++11 -pthread -Werror -Wall

    However I get SSL_* undefined symbols, pthread_create undefined, and dlopen undefined symbols ..

    Same options works fine with Fedora 17. I have all dev files installed in ubuntu.
    What is going on in Ubuntu?
    Any help please?
    Syed Raihan

  2. #2
    Join Date
    Aug 2010
    Lancs, United Kingdom
    Ubuntu Mate 16.04 Xenial Xerus

    Re: -lssl -ldl -lpthread linker flag is not working in ubuntu

    Is this make? I think you are supposed to use LDLIBS for libraries, not LDFLAGS.

    The reason that your link works on Fedora but not Ubuntu is that on (recent) Ubuntu, ld defaults to --as-needed. You could also probably "fix" it by adding --no-as-needed to your LDFLAGS, but I think that using LDLIBS would be better.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts