bjam for boost 1.54 - c++

I've boost 1.54 installed in Linux Debian (according to this). Then I installed bjam as follows:
apt-get install bjam
Then, in order to run a sample tut1 program with boost filesystem I typed:
$ cd boost-root/libs/filesystem/example/test
$ ./setup.sh
$ ./bld.sh
This should result in building tut1 file. But there is no tut1 file in test folder. There is only tut1.cpp copied here by setup.sh. I suspect the bjam installed is not for boost 1.54. How to install bjam properly?
After typing bjam I get:
warning: mismatched versions of Boost.Build engine and core
warning: Boost.Build engine (bjam) is 03.1.16
warning: Boost.Build core (at /usr/include/boost_1_54_0/tools/build/v2) is 2011.12-svn

Related

Cross compiling boost for Arm (armhf) fails with unknown in module "warnings-feature"

Following the Boost "Cross-compilation" instructions here,
Having already run bootstrap.sh, and created a local, native b2.
And using a user-config.jam of:
using gcc : arm :arm-linux-gnueabihf-g++ ;
Kicking off the build:
./b2 toolset=gcc-arm target-os=linux
Boost's b2 spits out a bunch of error messages, and halts:
username#ubuntu:~/Code/boost_1_81_0$ ./b2 toolset=gcc-arm target-os=linux
/home/username/Code/boost_1_81_0/tools/build/src/util/numbers.jam:23: in numbers.check from module numbers
error: arm in arm
error: is not a number
/home/username/Code/boost_1_81_0/tools/build/src/build/version.jam:110: in version.version-compatible from module version
/home/username/Code/boost_1_81_0/tools/build/src/tools/common.jam:1132: in common.find-compiler from module common
/home/username/Code/boost_1_81_0/tools/build/src/tools/gcc.jam:165: in gcc.init from module gcc
/home/username/Code/boost_1_81_0/tools/build/src/build/toolset.jam:44: in toolset.using from module toolset
/home/username/Code/boost_1_81_0/tools/build/src/build-system.jam:543: in process-explicit-toolset-requests from module build-system
/home/username/Code/boost_1_81_0/tools/build/src/build-system.jam:610: in load from module build-system
/home/username/Code/boost_1_81_0/tools/build/src/kernel/modules.jam:294: in import from module modules
/home/username/Code/boost_1_81_0/tools/build/src/kernel/bootstrap.jam:135: in module scope from module
Obviously it doesn't expect the values the instructions suggest.
Is there any way forward ?
I am not sure about what exactly went wrong, but a complete, working procedure for cross-compiling boost for arm-linux-gnueabihf on Ubuntu 22.04 would be:
# Retrieve/install cross-compiler.
wget https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
tar Jxf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
export CROSS_COMPILE=$(pwd)/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
# Retrieve/install boost source code.
wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2
tar jxf boost_1_81_0.tar.bz2
# Build boost
cd boost_1_81_0
echo "using gcc : arm : ${CROSS_COMPILE}g++ ;" > user_config.jam
./bootstrap.sh --prefix=$(pwd)/boost-1.81.0-arm-none-linux-gnueabihf
./b2 install toolset=gcc-arm link=static cxxflags=-fPIC --with-filesystem --with-test --with-log --with-program_options -j32 --user-config=user_config.jam
After the compilation ends, the compilation artifacts should reside in directory boost_1_81_0/boost-1.81.0-arm-none-linux-gnueabihf.

fatal error: 'openssl/evp.h' file not found cmake + make

Operating system: macOS Catalina
I have a project that has a file called CMakeLists.txt. I ran cmake and then make, but the make command failed:
/Users/blablabla/Downloads/myproject/src/main.cpp:10:10: fatal error:
'openssl/evp.h' file not found
#include <openssl/evp.h>
I tried reinstalling OpenSSL via homebrew, linking the libraries but it still gave this error.
What am I could be doing wrong?
Any help would be highly appreciated
either openssl's dev library is not installed, or the g++ command that cmake generates probably is missing a -I.
try sudo apt-get install libssl-dev first and if that doesn't work, make sure the openssl include dir is provided to g++.
according to https://cmake.org/cmake/help/v3.6/module/FindOpenSSL.html, it creates an env var of OPENSSL_INCLUDE_DIR
edit: just noticed you're on OSX. you can install the the dev libssl package with brew install openssl

How to Install Wt into a Custom Folder Without "fatal error: Wt/WApplication: No such file or directory"

I'm new to Wt and c++ and I just installed the Wt webframework on Ubuntu 16.04 LTS into a custom folder in my home directory. I cannot install or build any software into the /usr diretories of this computer. Even if I could, the PPA hasn't been active for 2 1/2 years, and the official Ubuntu installation instructions are also outdated. Aptitude no longer ships with Ubuntu and will eventually be discontinued.
I compliled and installed everything successfully, yet when I try to compile the Hello World example I get the following error:
g++ -o hello hello.cpp -lwt -lwthttp
fatal error: Wt/WApplication: No such file or directory
Here are my installation steps:
Boost:
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2
tar --bzip2 -xf boost_1_65_1.tar.bz2
cd boost_1_65_1
./bootstrap.sh --prefix=../myfolder
sudo ./b2 install --prefix=../myfolder
CMake:
wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
tar -xvzf cmake-3.9.2.tar.gz
cd cmake-3.9.2
./configure --prefix=../myfolder
make
sudo make install
vim .profile
export PATH=$PATH:/home/ubuntu/myfolder/bin
Wt:
git clone https://github.com/emweb/wt.git
cd wt
cmake -DCMAKE_INSTALL_PREFIX:PATH=../myfolder .
-- Generating done
-- Build files have been written to: /home/ubuntu/myfolder
make
sudo make install
make -C examples
Since I'm lumping everything together in /myfolder I did not use the /build folder per the Wt installation instructions. The libwt and libboost libraries are in /myfolder/lib. I assumed all of the linking was taken care of during installation.
Any thoughts? Thanks in advance.
You have to tell your compiler to look for includes and libraries in the right folders, so instead of:
g++ -o hello hello.cpp -lwt -lwthttp
Try:
g++ -o hello hello.cpp -I/home/ubuntu/myfolder/include -L/home/ubuntu/myfolder/lib -lwt -lwthttp
Note that when you run your application, you'll also have to make sure that it can find the dynamic libs (.so files) it needs. You could do this:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/ubuntu/myfolder/lib"

How to Build libcxx and libcxxabi by clang on CentOS 7

I want to use C++11 or C++14 with clang/clang++ on CentOS 7. How do I build this building environment?
This article teaches how to build C++11 building environment on CentOS 7: RHEL's EPEL repo provides Clang packages, but no C++ library packages. So, these parts are a bit troublesome to be built by hand. The customized C++ libraries for Clang is libc++ (libcxx) [1]. Then, libcxx also needs an ABI library, libc++abi (libcxxabi) [2]. Unfortunately, these two libraries have a circular dependency problem. For breaking the circular dependency problem, libc++ can be built without linking libc++abi. Then, with this libc++, we can build libc++abi linking libc++. Finally, with the libc++abi, we can build a new libc++ linking libc++abi.
The clang, libc++, and libc++abi environment building steps are given in the following:
Add RHEL's EPEL repo.
Open the following link and find the section "How can I use these extra packages?"
https://fedoraproject.org/wiki/EPEL
Find the epel package for your CentOS version. E.g.,:
sudo rpm -i https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Install Subversion for getting the latest libcxx and libcxxabi.
sudo yum install svn
Install Clang and llvm-devel (with llvm-config).
sudo yum install clang llvm-devel
Install cmake.
cd /usr/local
wget https://cmake.org/files/v3.5/cmake-3.5.2-Linux-i386.sh
sudo chmod 755 cmake-3.5.2-Linux-i386.sh
sudo ./cmake-3.5.2-Linux-i386.sh
# Check cmake is in /usr/local/bin.
1st round to build libcxx without libcxxabi.
# Get libcxx.
svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
cd libcxx
# It is not recommended to build libcxx in the source root directory.
# So, we make a tmp directory.
mkdir tmp
cd tmp
# Specifying CMAKE_BUILD_TYPE to Release shall generate performance optimized code.
# The CMAKE_INSTALL_PREFIX changes the install path from the default /usr/local to /usr.
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
sudo make install
cd ..
rm tmp -rf
cd ..
Build libcxxabi with libc++.
# Get libcxxabi.
svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi
cd libcxxabi
mkdir tmp
cd tmp
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include ..
sudo make install
cd ../..
2nd round to build libcxx with libcxxabi.
cd libcxx
mkdir tmp
cd tmp
# This time, we want to compile libcxx with libcxxabi, so we have to specify LIBCXX_CXX_ABI=libcxxabi and the path to libcxxabi headers, LIBCXX_LIBCXXABI_INCLUDE_PATHS.
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi/include ..
sudo make install
Write a C++ test program.
// t.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Hello world!" << endl;
}
Test C++ compilation by clang++.
# -std specifies the C++ standard. -stdlib specifies the C++ library you want to use with clang/clang++. -lc++abi is necessary, because the new LD (linker and loader) on CentOS 7 doesn't allow indirect library linking.
clang++ -std=c++11 -stdlib=libc++ -lc++abi t.cpp
./a.out
References:
[1] http://libcxx.llvm.org/
[2] http://libcxxabi.llvm.org/

Cross compiling boost for m68k using bjam

Using the docs, I run:
$ echo "using gcc : m68k : /opt/freescale/usr/local/gcc-4.2.125-eglibc-2.5.125/m68k-linux/bin/m68k-linux-gnu-g++ ;" > tools/build/v2/user-config.jam
$ ./bootstrap.sh
$ ./bjam -d2 --toolset=gcc-m68k '-sBUILD=release static multi/single' link=static --prefix=/home/damann/coldfire/boost --layout=system --with-filesystem --with-system --with-thread --with-serialization --with-date_time install
Which gives the following errors:
error: toolset gcc initialization:
error: version 'm68k' requested but 'g++-m68k' not found and version '4.4.3' of default 'g++' does not match
error: initialized from
/home/damann/boost_1_48_0/tools/build/v2/build/toolset.jam:38: in toolset.using from module toolset
/home/damann/boost_1_48_0/tools/build/v2/build-system.jam:481: in process-explicit-toolset-requests from module build-system
/home/damann/boost_1_48_0/tools/build/v2/build-system.jam:562: in load from module build-system
/home/damann/boost_1_48_0/tools/build/v2/kernel/modules.jam:283: in import from module modules
/home/damann/boost_1_48_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build from module
/home/damann/boost_1_48_0/boost-build.jam:17: in module scope from module
It seems that the user-config is being ignored, although it is read (see it during --debug-configuration)
Discovered that (at least on Linux) bjam also looks for a user-config.jam in the user's homedir - and I had one (that I had forgotten from an earlier build) - so that one was overriding my efforts.