Articles/Battles with Cockpit: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
I had the task of creating a recipe for the [https://github.com/performancecopilot/pcp Performance Co-Pilot], a system-level performance monitoring and management tool. What didn't help is that I knew nothing about the project itself. I've been working with Yocto for almost 3 years. I'm getting better, but am still learning, as this experience has shown me. Here is my story.
I had the task of creating a recipe for [http://cockpit-project.org/ Cockpit], a Linux platform configuration tool. A key dependency is [https://github.com/performancecopilot/pcp Performance Co-Pilot], a system-level performance monitoring and management tool. What didn't help is that I knew nothing about the project itself. I've been working with Yocto for almost 3 years. I'm getting better, but am still learning, as this experience has shown me. Here is my story.


I started by using devtool's recipe generation feature.  
I started by using devtool's recipe generation feature.  

Latest revision as of 06:02, 16 June 2017

I had the task of creating a recipe for Cockpit, a Linux platform configuration tool. A key dependency is Performance Co-Pilot, a system-level performance monitoring and management tool. What didn't help is that I knew nothing about the project itself. I've been working with Yocto for almost 3 years. I'm getting better, but am still learning, as this experience has shown me. Here is my story.

I started by using devtool's recipe generation feature.

$ devtool add devtool add pcp https://github.com/performancecopilot/pcp.git

It gave me a recipe, let's take a look

# Recipe created by recipetool
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)

SUMMARY = "System-level performance monitoring and performance management"
# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
# your responsibility to verify that the values are complete and correct.
#
# NOTE: multiple licenses have been detected; they have been separated with &
# in the LICENSE value for now since it is a reasonable assumption that all
# of the licenses apply. If instead there is a choice between the multiple
# licenses then you should change the value to separate the licenses with |
# instead of &. If there is any doubt, check the accompanying documentation
# to determine which situation is applicable.
#
# The following license files were not able to be identified and are
# represented as "Unknown" below, you will need to check them yourself:
#   COPYING
#   man/html/qwtlicense.html
#   debian/copyright
#   build/mac/installer-resources/License.html
#
# NOTE: spec file indicates the license may be "GPLv2+ and LGPLv2.1+ and CC-BY"
LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://COPYING;md5=37ab75b580d5aad4ada04260efa3702f \
                    file://man/html/qwtlicense.html;md5=c5c69645704bbe5b502541dc8b8f25a0 \
                    file://debian/copyright;md5=7fecb9815c8887be096ca82876491a3b \
                    file://build/mac/installer-resources/License.html;md5=8b1eb407ff164d61266fda749147081a"

SRC_URI = "git://github.com/performancecopilot/pcp.git;protocol=https"

# Modify these as desired
PV = "3.11.10+git${SRCPV}"
SRCREV = "023872a815c9a914c53d755c0447e411440877be"

S = "${WORKDIR}/git"

# NOTE: the following prog dependencies are unknown, ignoring: which xz lzma hdiutil md5sum mkinstallp dpkg dblatex rpmbuild gzip publican qmake-qt4 qshape xmlto pod2man makepkg seinfo git dlltool gawk makedepend qmake-qt5 pkgmk true gmake dtrace rpm bzip2 gtar xconfirm echo qmake
# NOTE: unable to map the following pkg-config dependencies: libmicrohttpd libsystemd-journal
#       (this is based on recipes that have previously been built and packaged)
# NOTE: the following library dependencies are unknown, ignoring: nss pfm regex ibmad sasl2 papi gen ibumad nspr
#       (this is based on recipes that have previously been built and packaged)
DEPENDS = "libx11 ncurses cairo openssl bison-native zlib readline systemd avahi flex-native"

# NOTE: if this software is not capable of being built in a separate build directory
# from the source, you should replace autotools with autotools-brokensep in the
# inherit line
inherit perlnative python3native pkgconfig pythonnative autotools

# Specify any options you want to pass to the configure script using EXTRA_OECONF:
EXTRA_OECONF = ""

It seemed to do a pretty good job. It figured out some licences, detected an autotools project that included python and perl components, added some package dependencies and highlighted some that it couldn't figure out. I was almost there. How hard could it be? Now let's try and build it.

$ devtool build pcp
<snip>
| FATAL ERROR: Cannot perform cross-compilation without a file to source
|              configuration information from (config.linux is missing)
<snip>

I'm not much of an autotools guy but luckily had Joshua Lock to call on. It turns out that the project wasn't properly set up for cross-compiling. He also spotted that the project wasn't capable of building into a seprate build folder. Luckily if already had a config file for mingw-w64 so I copied it, tweaked it slightly and renamed to config.linux. I added it to the recipe

SRC_URI += "file://config.linux"

However we have to copy the file to the right place. As with Yocto, there are many way to do this. I chose to do it manually before the compile step as

  1. ${S} is not set when SRC_URI declarations are typically given, so we can't use the subdir parameter
  2. Doing the copy after unpack would be more natural but as unpack is a pythno python, appends can't be a simple shell command