Generating aarch64 RPM package from yocto SDK - cmake

I am running Ubuntu 18:04 x86_64 in Docker.
I have copied and sourced SDK I have produced with Yocto.
source /sdk/environment-setup-aarch64-poky-linux
I am compiling my library
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
Everything is fine so far, when I check the lib architecture file myLib.so it says aarch64
myLib.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=5e01090be56b47a2dd2edd7c44e9861709f3090a, with debug_info, not stripped
Now I want to generate RPM package using cpack -G "RPM"
-- Toolchain file defaulted to '/sdk/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake'
CPack: Create package using RPM
CPack: Install projects
CPack: - Run preinstall target for: myLib
CPack: - Install project: myLib
CPack: Create package
-- CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=/myLib/build/_CPack_Packages/Linux/RPM
CPackRPM: Will use GENERATED spec file: /myLib/build/_CPack_Packages/Linux/RPM/SPECS/myLib.spec
CPack: - package: /myLib/build/myLib.rpm generated.
The result of the rpm file when I check it with rpm -qi myLib.so is
Name : myLib
Version : 1.1.1
Release : 1
Architecture: x86_64
...
Why is the architecture of RPM file x86_64?
What am I missing for the cpack to produce aarch64 RPM file?

The variable CPACK_RPM_PACKAGE_ARCHITECTURE defaults to uname -m which is currently set to the architecture of your computer. You can manually set this variable to override the package architecture.
CPACK_RPM_PACKAGE_ARCHITECTURE=aarch64 cpack -G "RPM"

Related

Use CMake binares to build cpp projects without installing CMake

I want to use specific version of CMake 3.19.0 for Ubuntu 14.04 (32-bits) without installing CMake (use only binaries).
I tried to build CMake 3.19.0 on my test machine. It builded and installed successfully. In install_manifest.txt I see lot of files that were installed on my test system.
So, I tried to copy only installed binaries from /usr/local/bin/ (this is default path where CMake binaries were installed) and paste it to another machine that doesn't know about CMake. I paste 3 binaries: cmake, ctest, cpack to /usr/local/bin/.
If I run which cmake it shows path:
/usr/local/bin/cmake
If I run cmake --verison it shows:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.19
cmake version 3.19.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
It looks like CMake needs some modules that I haven't copied yet. I tried to build my cpp project and it shows me:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.19
CMake Error: Error executing cmake::LoadCache(). Aborting.
What are the minimum required modules needed for stable building? And where I should copy it?
Just copied builded Modules and Templates directories from cmake-3.19.0 build directory to /usr/local/share/cmake-3.19

How to check if a library (libssh) is installed with Cmake before adding executable

I have an executable in cmake that depends on libssh being installed on the system.
I use this to install it:
sudo apt-get install -y libssh-dev
This is my Cmake:
cmake_minimum_required(VERSION 3.5.0)
project(validateTensor VERSION 0.0.1)
find_package(gflags QUIET)
add_executable(myapplication
"myapplication.cpp"
)
target_link_libraries(myapplication gflags teamApplication -lssh)
add_dependencies(myapplication teamApplication)
My question is how can I use cmake to check if libshh is installed on the system before adding the executable. If it is not installed then I want to exclude the executable from the build but not have the build fail.
How to check if a library (libssh) is installed with Cmake before adding executable
With find_library.
find_library(HAVE_SSH NAMES ssh)
add_executable(myapplication
myapplication.cpp
)
target_link_libraries(myapplication gflags teamApplication)
if (HAVE_SSH)
target_link_libraries(myapplication ssh)
endif()
No need to add_dependencies(myapplication teamApplication) - target_link_libraries already "does that".

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/

ccmake using cmake version 3.10

I am trying to install the new ITK version which needs a cmake version higher than 3.9
I have just download the cmake 3.10 version.
and when I install it there is no ccmake in the bin folder. usually the new ccmake version is here.
when I want to install ccmake using apt it links it to the 3.5 cmake version.
How can I do to have a ccmake version linked to the 3.10 version of cmake ?
Turning my comment into an answer
You can use the following tutorial to build and install the latest CMake version: How do I install the latest version of cmake from the command line?
But - as for the time of your question - it was lacking the hint to install the curses library/headers first (see here,
you don't get ccmake built and installed without it ). So I had the same problem on my Ubuntu and was able to install and rebuild it with the following steps:
# sudo apt-get install libncurses-dev
# cd ~/temp/cmake-3.10.2
# cmake .
...
# make -j8
...
# sudo make install
...
# ccmake
Usage
ccmake <path-to-source>
ccmake <path-to-existing-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
Run 'ccmake --help' for more information.
The binary ccmake is a target of the make file.
To get all, perform:
./configure
make all
sudo make install
To just get ccmake, perform:
make ccmake

CMake v3.4.1 finds CUDA 7.5 instead of CUDA 8.0 on Ubuntu 16.04

I am trying to install the GPU support for XGBoost but I get the following error when I try to build it with CMake:
CMake Error at /usr/local/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find CUDA: Found unsuitable version "7.5", but required is at
least "8.0" (found /usr)
I only installed CUDA 8.0 and the environmental variables in .bashrc are specified as:
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
How can I have CMake detect the right CUDA version?
PATH and LD_LIBRARY_PATH have no effect on cmake, so what you have tried will not work.
If you look at the documentation for find_package it is possible to provide a PATHS argument to tell cmake to look in non-standard locations
Unfortunately, if you look at the source for XGBoost's CMakeLists.txt, you can see it calls find_package(CUDA ...), but doesn't allow the user to provide a PATHS option
if(USE_CUDA)
find_package(CUDA 8.0 REQUIRED)
...
endif()
As such you are left with 2 options:
Edit XGBoost's CMakeLists.txt file, and add PATHS /usr/local/cuda-8.0 to the find_package call
Install cuda-8.0 into a standard location (eg: use /usr/local as your PREFIX, not /usr/local/cuda-8.0)
I ran into a similar issue when trying to install the R version with GPU support. The issue was that I was running the commands from their install guide:
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git submodule init
git submodule update
cd R-package
R CMD INSTALL .
and then running the commands for GPU support:
mkdir build
cd build
cmake .. -DUSE_CUDA=ON -DR_LIB=ON
I was able to avoid the issue by running:
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
mkdir build
cd build
cmake .. -DUSE_CUDA=ON -DR_LIB=ON
make install -j