I cant run/find bjam after boost install.
I have correctly installed boost and able to compile some examples from there using gcc, however I want to compile the example ssl boost server program. It seems to require extra includes from openssl. AWS ec2 already has openssl. I even tried to install openssl source as well.
Ideally I would like to be able to run the Jamfiles for the examples using bjam. I've tried so many things after googling get bjam working. After building boost isnt bjam supposed to work or be there somewhere?
Any help appreciated...
Downloaded/installed boost. Able to compile SOME programs with g++ -I /home/ec2-user. Tried downloading bjam files. Not sure how to install after extract
If you extract the archive, say to folder ./boost/ running
./bootstrap.sh
in that folder will give you ./boost/b2
This will work to build the examples. E.g.:
docker run --rm -i -t ubuntu
apt update
set -o vi
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
cd libs/asio/example/cpp11/ssl/
../../../../../b2
This successfully builds the cpp11/ssl examples from scratch on a fresh ubuntu server installation.
Amazon Linux 2 seems to be EOL, and yum doesn't work in a amazonlinux:2
container. Just using the latest version (AL2023) instead:
docker run --rm -it amazonlinux
Then the following minimal steps successfully build the relevant examples:
yum install -y make g++ wget tar bzip2 openssl openssl-devel
# download and extract boost
wget https://archives.boost.io/release/1.86.0/source/boost_1_86_0.tar.bz2
tar xf boost_1_86_0.tar.bz2
# build b2
cd boost_1_86_0/
./bootstrap.sh
# link into path
mkdir -pv ~/bin
ln -sfv "$PWD/b2" ~/bin/
export PATH="$HOME/bin:$PATH"
# build asio/beast ssl examples
(cd libs/beast/example/http/server/async-ssl/ && b2)
(cd libs/asio/example/cpp11/ssl/ && b2)
Test them with
bin.v2/libs/asio/example/cpp11/ssl/gcc-11/debug/x86_64/threading-multi/visibility-hidden/server
bin.v2/libs/beast/example/http/server/async-ssl/gcc-11/debug/x86_64/threading-multi/visibility-hidden/http-server-async-ssl
You can even build without b2:
cd /boost_1_86_0/libs/asio/example/cpp11/ssl/
g++ -I/boost_1_86_0/ server.cpp -lssl -lcrypto
./a.out
Or
cd /boost_1_86_0/libs/beast/example/http/server/async-ssl/
g++ -I/boost_1_86_0/{,libs/beast} http_server_async_ssl.cpp -lssl -lcrypto
./a.out