Search code examples
linuxopensslconan

How to build openssl on linux using Conan


This seems to be the best way to build openssl from source on Linux. However, I can not find a way to build it using -fPIC and -shared (since it will be a static file linked).

Version: https://www.conan.io/source/OpenSSL/1.0.2g/lasote/stable

Alternatively, Ive tried to find pre-built binaries but atlas I could not find any.


Solution

  • You can check the latest Conan package recipe here, the prebuilt packages are in the conan-center repository, conan.io repository is no longer active.

    To build the shared flavor of the packages with fPIC:

    1. Add the conan-center repository to the remotes:

      conan remote add conan-center https://api.bintray.com/conan/conan/conan-center

    2. Specify the latest version reference in your requirements (your conanfile.txt for example), specifying the shared option:

    [requires]
    OpenSSL/1.0.2l@conan/stable
    [options]
    OpenSSL:shared=True
    
    1. Install it. If you get an error because you don't find prebuilt binaries you can build from sources with --build missing parameter

    conan install

    You can also build it in Windows with VisualStudio, MinGW, OSX with apple-clang, Linux with gcc... Exactly the same procedure.

    Hope it helps.