Build failed for man pages (cmake)

Asked by islander

Hello, i'm trying to publish package of small utility built with CMake.

Build failed with this error:

 fakeroot debian/rules binary
cd build_dir; cmake -DCOMPONENT=Unspecified -DCMAKE_INSTALL_PREFIX=../debian/tmp/usr -P cmake_install.cmake
-- Install configuration: ""
-- Install component: "Unspecified"
-- Installing: /<<PKGBUILDDIR>>/build_dir/../debian/tmp/usr/bin/xkb-switch
-- Set runtime path of "../debian/tmp/usr/bin/xkb-switch" to ""
-- Installing: /<<PKGBUILDDIR>>/build_dir/../debian/tmp/usr/lib/libxkbswitch.so.1.7.0
-- Installing: /<<PKGBUILDDIR>>/build_dir/../debian/tmp/usr/lib/libxkbswitch.so.1
-- Installing: /<<PKGBUILDDIR>>/build_dir/../debian/tmp/usr/lib/libxkbswitch.so
-- Installing: /usr/share/man/man1/xkb-switch.1.xz
CMake Error at cmake_install.cmake:101 (file):
  file INSTALL cannot copy file
  "/<<PKGBUILDDIR>>/build_dir/xkb-switch.1.xz" to
  "/usr/share/man/man1/xkb-switch.1.xz".

My debian/rules is:

#!/usr/bin/make -f

BUILDDIR = build_dir

build:
 mkdir -p $(BUILDDIR)
 cd $(BUILDDIR); cmake -DOPT_BIN_SUFFIX=ON -DCMAKE_INSTALL_PREFIX=/usr ..
 make -C $(BUILDDIR) preinstall
 touch build

binary: binary-indep binary-arch

binary-indep: build

binary-arch: build
 cd $(BUILDDIR); cmake -DCOMPONENT=Unspecified -DCMAKE_INSTALL_PREFIX=../debian/tmp/usr -P cmake_install.cmake
 mkdir -p debian/tmp/DEBIAN
 dpkg-gensymbols -pxkb-switch
 dh_shlibdeps
 dpkg-gencontrol -pxkb-switch
 dpkg --build debian/tmp ..

clean:
 rm -f build
 rm -rf $(BUILDDIR)

.PHONY: binary binary-arch binary-indep clean

My cmake_install.cmake is:

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1" TYPE FILE FILES "/home/user/src/debian-build/xkb-switch.1.xz")
endif()

My CMakeLists.txt is:

SET(MANDIR "share/man" CACHE STRING "Manpages installation path")
INSTALL(FILES ${compressed_man}
    DESTINATION ${MANDIR}/man${man_type})

How can I fix this issue?
Or have we good practices to build man files on launchpad?

Question information

Language:
English Edit question
Status:
Answered
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Colin Watson (cjwatson) said :
#1

This isn't a Launchpad problem - you should be able to reproduce exactly the same thing locally using sbuild (https://wiki.ubuntu.com/SimpleSbuild).

The problem appears to be that your build system is trying to install the man page directly to /usr/share/man/... rather than to a prefix, but I'm not clear why your setting of CMAKE_INSTALL_PREFIX apparently isn't taking effect here. In general we can't debug your build system for you, though - I suggest focusing on reproducing the problem in sbuild and then you can debug it locally.

Revision history for this message
islander (zombie32) said :
#2

Ok, thanks, I'll try to install sbuild locally and test there.

Can you help with this problem?

Provide an answer of your own, or ask islander for more information if necessary.

To post a message you must log in.