openziti / ziti-tunnel-sdk-c

Apache License 2.0
43 stars 17 forks source link

cmake target "package" does not produce Linux packages unless arch is x86_64 #543

Closed qrkourier closed 1 year ago

qrkourier commented 1 year ago

Instead of invoking the DEB and RPM generators, CMake creates a ZIP of the C-SDK. Weird.

qrkourier commented 1 year ago
Run CPack packaging tool...
/usr/local/bin/cpack --config ./CPackConfig.cmake
CPack: Create package using ZIP
CPack: Install projects
CPack: - Install directory: /mnt
CPack: - Run preinstall target for: ziti-sdk
CPack: - Install project: ziti-sdk []
CPack: Create package
CPack: - package: /mnt/build-arm64/package/ziti-sdk-0.30.4-Linux-aarch64.zip generated.
qrkourier commented 1 year ago

The generated top-level Makefile has these lines for target "package":

# Special rule for the target package
package: preinstall
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool..."
    /usr/local/bin/cpack --config ./CPackConfig.cmake
.PHONY : package

# Special rule for the target package
package/fast: package
.PHONY : package/fast

# Special rule for the target package_source
package_source:
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Run CPack packaging tool for source..."
    /usr/local/bin/cpack --config ./CPackSourceConfig.cmake /mnt/build-arm/CPackSourceConfig.cmake
.PHONY : package_source

# Special rule for the target package_source
package_source/fast: package_source
.PHONY : package_source/fast
qrkourier commented 1 year ago

I found CPackConfig.cmake had unexpected values and finally realized I'd failed to set BUILD_DIST_PACKAGES=ON. Thanks for the hint @sabedevops.

qrkourier commented 1 year ago

Next step is to figure out why CMake is linking the amd64 version of libatomic when it's cross compiling for arm64

# running buster in emulated arm64 (aarch64)
root@7b1bd64aa89f:/# apt install /mnt/build-arm64/ziti-edge-tunnel-0.20.8-1.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'ziti-edge-tunnel:amd64' instead of '/mnt/build-arm64/ziti-edge-tunnel-0.20.8-1.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ziti-edge-tunnel:amd64 : Depends: libatomic1:amd64 but it is not installable
E: Unable to correct problems, you have held broken packages.
qrkourier commented 1 year ago

Needed to set:

set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm)
set(CPACK_RPM_PACKAGE_ARCHITECTURE armv7l)