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"