boostopensslbeast

I can't compile boost beast example "http_server_async_ssl.cpp"


Using linux ec2, I want to compile the boost beast example file:

boost_1_86_0/libs/beast/example/http/server/http_server_async_ssl.cpp (SSL)

What I CAN do is compile http_server.cpp which is a web server (but plain http) by going to that dir and typing:

c++ http_server_async.cpp -I /home/ec2-user/boost_1_86_0 -o server -pthread

But... the difficulty lies with the http_server_async_ssl.cpp file using openssl.

Openssl was actually already installed in the aws ec2. But what I need is the include files for openssl that are referenced in http_server_async_ssl.cpp and generating compile errors or where to find them on the machine (I have tried searching) or on the web (again I have tried searching, and downloading, extracting openssl, but still no luck...)

Please note this is not a duplicate of a question about compiling the plain http server example.


Solution

  • The steps I gave you yesterday work for this as well:

    Unable to find/use bjam in linux ec2

    Assuming a clean ubuntu server docker container:

    docker run --rm -i -t ubuntu
    

    Installing the minimum system

    apt update
    apt-get -yy install build-essential wget libssl-dev
    wget https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.bz2
    tar xf boost_1_86_0.tar.bz2 
    cd boost_1_86_0/
    ./bootstrap.sh 
    

    Linking b2 into the path for convenience:

    mkdir -pv ~/bin
    ln -sfv "$PWD/b2" ~/bin/
    export PATH="$HOME/bin:$PATH"
    

    It builds just fine:

    cd libs/beast/example/http/server/async
    b2
    

    Pudding + Proof:

    No B2/Bjam?

    Then you need the extra options for

    g++ -I /boost_1_86_0/ -I /boost_1_86_0/libs/beast/http_server_async_ssl.cpp -lssl -lcrypto
    

    Proof + Pudding:

    enter image description here