Where are nanomsg nng libraries installed - cmake

I am new to nanomsg and cmake. I installed the nanomsg using the documentation
$ mkdir build
$ cd build
$ cmake -G Ninja ..
$ ninja
$ ninja test
$ ninja install
I am not sure where are the packages installed. I see the headers in /usr/include and cmake directory in /usr/lib64 directory.
/usr/lib64/cmake/nng# ls
nng-config.cmake nng-config-noconfig.cmake
I am unable to compile my sample programs due to this confusion. Any help would be highly appreciated.

Related

Build in a linux container fails to find gtest (using vcpkg and CMake)

I've tried build a project in a container and have some very (simple?) problem.
I have a couple of unit tests that use gtest and chose to use vcpkg to build it since I aim to target windows/linux machines.
When I build on my or someone else's computer everything seem to work, but when I build the project in the container it fails to find the include files for gtest.
Is there anything I missed in the CMake integration with vcpkg that needs to be done for my project?
My current state is that I start the container and use an interactive shell to manually build everything inside it (so I can try debug the issue).
Here is my Dockerfile:
FROM ubuntu:20.04
# Needed to be set for the cmake package to be installed properly without interactive input
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install git -y
RUN apt-get install gcc-10 -y
RUN apt-get install g++-10 -y
# Set gcc/g++ so they default to the installed versions
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 1
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 1
RUN apt-get install cmake -y
# zip / pkg-config were required for vcpkg to build some dependencies
RUN apt-get install zip -y
RUN apt-get install pkg-config -y
# below are convenience for opening a shell terminal in the docker image
RUN apt-get install vim -y
RUN apt-get install curl -y
# enables tab-completion and some colors
RUN curl -L https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
# copy local files to be built
COPY scripts /build/scripts
COPY src /build/src
COPY CMakeLists.txt /build
Here is my CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg)
message( FATAL_ERROR
"Clone vcpkg at ${CMAKE_CURRENT_SOURCE_DIR}\n"
"cd ${CMAKE_CURRENT_SOURCE_DIR}\n"
"git clone https://github.com/Microsoft/vcpkg.git --depth 1\n"
"cd vcpkg\n"
"./bootstrap-vcpkg.sh"
"./vcpkg install gtest:x64-linux"
)
endif()
if (WIN32)
set(CMAKE_GENERATOR_PLATFORM x64) # Force 64 bits
elseif (LINUX)
set(VCPKG_TARGET_TRIPLET "x64-linux")
endif()
# Setup vcpkg toolchain
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/runtime)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
project(TheProject)
find_package(GTest CONFIG REQUIRED)
include_directories(
"src/cpp"
)
add_subdirectory(src)
EDIT: If I hardcode the include paths / library paths to point to the vcpkg installed directory in the CMakeLists.txt everything works, but I thought it should only be necessary to setup the toolchain file for it to work.
The unmodified toolchain-integration works like a charm outside any container (on a computer).
How can I avoid this hack? It will not scale at all later on.
Below is the hack that make everything work (not needed on a computer):
include_directories(
"src/cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/installed/x64-linux/include"
)
link_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/installed/x64-linux/lib"
)

cmake installation on aix installed but command not found

i installed cmake on my AIX 7.2
bash-3.2# yum install cmake
Setting up Install Process
Package cmake-3.16.0-2.ppc already installed and latest version
Nothing to do
bash-3.2#
but running it .
bash-3.2$ cmake
bash: cmake: command not found
there is also no folder for cmake in /opt/bin directory
The RPM's on AIX likely install software to /opt/freeware so you probably need /opt/freeware/bin in your PATH to casually use "cmake" on the command line.
You can verify the paths installed by a package with e.g.
rpm -ql cmake|grep bin/

how to build apache httpd 2.* and beyond on msys2

httpd build on msys2 fails with the following error:
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
On real linux distros, installing the expat-devel package seems to solve the problem see here,
more precisely, expat-devel is an apr-util prerequisite
and at least its headers ar missing on msys2.
So how to build httpd with msys since no expat-devel package or headers is available ?
When configuring httpd --with-included-apr, where do apr-utils look for expat headers or how to configure that ?
more precisely the CHANGES-APR-UTIL-1.6 documentation says
Changes with APR-util 1.6.0
*) The expat dependency of apr-util is no longer built with
apr-util.
Install expat (including development headers and libraries) first
before building apr-util.
where should expat headers and libs be installed in httpds build directory tree ?
I finally had to build expat separately,
then other errors arised and found a solution thanks to
this link for missing libtool and to that link for the effective way to build expat without generating export redefinition.
let find the full build script here:
pacman -S make gcc libcrypt perl unzip libtool msys/libcrypt-devel
cd OpenSSL_1_1_1-stable
curl http://mirrors.standaloneinstaller.com/apache/httpd/httpd-2.4.38.tar.gz --output httpd-2.4.38.tar.gz
tar xvf httpd-2.4.38.tar.gz
cd $HOME
git clone --branch OpenSSL_1_1_1-stable https://github.com/openssl/openssl.git
mv openssl OpenSSL_1_1_1-stable
cd OpenSSL_1_1_1-stable
./configure gcc --prefix=$HOME/openssl
make
make install
cd $HOME
wget https://github.com/libexpat/libexpat/releases/download/R_2_2_6/expat-2.2.6.tar.bz2
tar xjvf expat-2.2.6.tar.bz2
cd $HOME/expat-2.2.6
./configure --prefix=$HOME/httpd --exec-prefix=$HOME/httpd
make
make install
cd $HOME
curl http://mirrors.standaloneinstaller.com/apache//apr/apr-1.6.5.tar.gz --output apr-1.6.5.tar.gz
tar xvf apr-1.6.5.tar.gz
curl http://mirrors.standaloneinstaller.com/apache//apr/apr-util-1.6.1.tar.gz --output apr-util-1.6.1.tar.gz
tar xvf apr-util-1.6.1.tar.gz
cd $HOME/apr-1.6.5
./configure --prefix=$HOME/httpd
make
make install
cd $HOME/apr-util-1.6.1
./configure --prefix=$HOME/httpd --with-apr=$HOME/httpd --with-expat=$HOME/httpd
make
make install
cd $HOME
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar xvf pcre-8.43.tar.gz
cd pcre-8.43
./configure --prefix=$HOME/pcre
make
make install
cd $HOME
wget https://github.com/nghttp2/nghttp2/releases/download/v1.37.0/nghttp2-1.37.0.tar.gz
tar xvf nghttp2-1.37.0.tar.gz
cd $HOME/nghttp2-1.37.0
./configure --exec-prefix=$HOME/httpd --prefix=$HOME/httpd
make
make install
cd $HOME/httpd-2.4.38
./configure --prefix=$HOME/httpd --with-expat==$HOME/httpd --with-apr-util=$HOME/httpd --with-apr=$HOME/httpd --with-pcre=$HOME/pcre --enable-ssl --enable-ssl-staticlib-deps --with-ssl=$HOME/openssl --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-balancer --enable-http2 --enable-nghttp2-staticlib-deps --with-nghttp2=$HOME/nghttp2
make
make install
The build process completed successfully,
but usefull to say that the runtime can't be used since httpd is not able to load its dynamic modules as described here

CMake not finding CMakeLists.txt

I am trying to install ants in Ubuntu 18 which requires a CMake step.
So far I have taken the following steps:
apt-get install ants
cd /tmp
git clone https://github.com/stnava/ANTs.git
mkdir /opt/ants
cd /opt/ants
cmake -c -g /tmp/ANTS
I keep getting the following error:
CMake Error: The source directory "/tmp/ANTS" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
You apparently have a typo in the path (S should be lower case), try this:
cmake -c -g /tmp/ANTs

Why is Travis not recognising installed CMake in script?

I'm trying to put together a Travis CI script for my application, which requires CMake 3.5 or greater. The entire Travis script can be found here. Following advice I found elsewhere, I use the following to install CMake:
install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz";
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake;
export PATH=${DEPS_DIR}/cmake/bin:${PATH};
else
brew outdated cmake || brew upgrade cmake;
fi
- cmake --version
Then I fill out the build matrix with various OS/compiler combinations, and finally I run a Python installation script (see here):
before_script:
- cd "${TRAVIS_BUILD_DIR}"
script:
- ./install.py --compiler=$COMPILER
The Python script essentially just calls cmake and make, the first CMakeLists.txt can be found here.
The OSX builds which install CMake using Homebrew works perfectly. However, all of the Linux builds fail at the script stage due to CMake not meeting the minimum requirement:
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.5 or higher is required. You are running version 3.2.2
Even though CMake 3.7 was successfully installed during install:
$ cmake --version
cmake version 3.7.2
What am I doing wrong?
This is strange, the preinstalled version of CMake (= v3.2 on Travis) is used instead of the newer one – but only when called from Python.
You can try these:
Solution 1: Remove the CMake shipped by Travis
This will prevent the usage of the older version. If this doesn't work (eg. maybe because "Cmake isn't found"), this will show the actual reason of the problem.
You can add this to your linux branch of the install step:
sudo apt-get purge cmake
Or:
sudo apt-get remove cmake
(Possible you need to add -y for confirmation, so it becomes remove -y).
Solution 2: Use the CMake installer
Installation through the CMake Installer is a much cleaner way. It turned out the be the faster one on Travis btw.
...
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
CMAKE_INSTALLER=install-cmake.sh
curl -sSL https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh -o ${CMAKE_INSTALLER}
chmod +x ${CMAKE_INSTALLER}
sudo ./${CMAKE_INSTALLER} --prefix=/usr/local --skip-license
else
...
I'm using curl instead of wget + travis_retry, but this doesn't matter. You can still use them as before.
If both don't work, you should check where the Python script looks for executables.