Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

Tag Archives: cmake

Fedora Packaging: resolving /usr/bin/../bin/../lib/bfd-plugins/LLVMgold.so: wrong ELF class: ELFCLASS32

When I provide an update to barrier-2.4.0, I encountered:

/usr/bin/../bin/../lib/bfd-plugins/LLVMgold.so: wrong ELF class: ELFCLASS32

Barrier uses CMake to build. It called ar and ranlib during the build, however, wrong plugins was invoked and caused the above error.

While the above error can be avoided by adding option --plugin , however, CMake does not have an easy way to do that. Fortunately, gcc provides gcc-ar and gcc-ranlib wrappers that point to the correct plugins. So I inserted the commands that point to gcc-ar and gcc-ranlib in the section %prep with:

sed -i.use-gcc-ar -e '/include (CheckIncludeFiles)/ i set(CMAKE_AR "/usr/bin/gcc-ar")' CMakeLists.txt
sed -i.use-gcc-ranlib -e '/include (CheckIncludeFiles)/ i set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")' CMakeLists.txt

The build worked.

cmake-fedora-2.5.0 is released

  • Enhancement:
    • New Target: changelog_no_force: Does not update ChangeLog if RELEASE-NOTES.txt is newer than ChangeLog.
  • Fixed:
    • MANAGE_ZANATA: Error message that missing right bracket.
      Thanks ChangZhu Chen for pointing it out.
    • Bug 1295278 – cmake-fedora: failed to update version when CMakeCache.txt is newer than RELEASE-NOTES.txt

cmake-fedora-2.4.3 is released

cmake-fedora consists CMake modules and scripts that simplify and automate the release process for software package, especially for Fedora and EPEL.

Even if you are not using CMake on your packages, you can still using following scripts to simplify your package chores. For examples, if you want your packages to be build in koji and submit to bodhi in all active branches like rawhide, f23, f22, f21, simply run

cmake-fedora-fedpkg <SRPM>

It builds the SRPM on all the active branches, skip the already built ones, then submit them to bodhi.

cmake-fedora-1.0.5 is released

Change from 1.0.2:

1.0.5

  • Fedora 18 support.
  • Source tarball filename is changed back to name-version-Source.tar.gz to avoid confusion between source generate by cmake-fedora (which contains ChangeLog? and projectName.pot) and tarball generation service from hosting site (which does not contain generated files)
  • koji-build-scratch: rawhide build target does not always have suffix -candidate.
  • README updated.
  • TODO updated.

1.0.4

  • Source tarball filename is now name-version.tar.gz instead of name-version-Source.tar.gz
  • after_release_commit depends rpm_changelog_prev_update if RPM supported enabled.
  • Corrected the ‘FORCE’ of cmake CACHE
  • Update the error messages when cmake-fedora is not installed.
  • Fixed target: zanata_push_trans.
  • Fixed zanata arguments.
  • fedpkg clone is now triggered if the clone directory does not exist when doing the fedpkg_commit, it no longer the listed OUTPUT of an ADD_CUSTOM_COMMAND.
  • Add target: translations as an universal easy target to generate/update translation files.

cmake-fedora 整骨完畢

cmake-fedora 1.0.2 終於生出來了。

這次最主要是大幅簡化:

  1. 程式設計
  2. 巨集以及函式呼叫。
  3. 模組名稱更加合理

對於其他distro使用者更為友善:

  1. 若是沒有必須的Dependency只會給出[Off] (停用)警告
  2. 若是不想看到這些警告可以  -DCMAKE_FEDORA_ENABLE_FEDORA_BUILD=0,直接跳過相關模組。
  3. 要更追求「純淨的話可以把 ManageRPM 和 ManageReleaseFedora 刪除。

日後的版本不會改變模組、巨集及函式名稱。

 

Generate JUnit XML format for Jenkins from CMake CTest

In JUnit XML Skeleton fits for Hudson., I showed the minimal JUnit XML for showing  meaningful results in Hudson/Jenkins.

But how to generate the JUnit XML from cmake and ctest?

I got the inspiration from How to get CTest results in Hudson / Jenkins in StackOverflow and create following  CTest2JUnit.xsl.

To use the xsl, you may either use the CTest2JUnit.pl I provide in the same directory, or following command in Linux:

xsltproc CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > JUnitTestResults.xml

cmake-fedora 0.8.1 released

What has changed:

  • Fixed Bug 738958 – cmake-fedora: remove excessive quotation marks for Precompile definition
  • Fixed Bug 733540 – cmake-fedora: "" should be read as empty string
  • ManageEnvironment: Now defined cmake_policy won't get overridden.
  • ManageString: STRING_UNQUOTE is now merely remove quote marks in the beginning and end of string. The string will not be changed otherwise.
  • UseUninstall has renamed as ManageUninstall
  • ManageMaintainerTargets: Reveal MAINTAINER_UPLOAD_COMMAND
  • ManageTranslation: Adopt zanata python client 1.3, arguments are redesigned.
    • Change target: from "translations" to "gmo_files"
    • Add targets: zanata_push, zanata_push_trans, zanata_pull_trans
    • Add argument: ALL_FOR_PUSH, ALL_FOR_PUSH_TRANS and ALL_FOR_PULL
    • Add argument: OPTIONS for passing arguments.
  • ManageReleaseOnFedora: Now default to build against candidate repos,
    unless _CANDIDATE_PREFERRED is set to "0".

cmake-fedora

Were you ever bored by the following release chores:

  • Verifying the consistence of versioning in program, tarball, git tags, RPMs, ChangeLog, and whatever place that need to know current version?
  • Pasting change summaries and details in submission messages, ChangeLog, RPM ChangeLog, bodhi notes, and the hosting website?
  • Forget to rpmlint again?
  • Having to scratch build, commit, build, and submitting to bodhi in for each dist you intent to support?
  • Embarrassed by inconsistency amongst source tarballs and RPMs?
  • Need to manually upload source tarball to hosting service providers?
  • Manually to copy the COPYING and fill the information in COPYING?

I do, thus the birth of the cmake-fedora, which automates many chores describe above.

CMake is a powerful cross-platform build system, it is considered faster and easier to understand than autotools. However, there are some gotchas for novice packagers.

For example, without setting CPACK_SOURCE_IGNORE_FILES, novices might notice the tarball grow geometrically each time they pack, because the old tarballs are not excluded.

Advance developers also benefit from these convenient macros and targets for project release chores like writing the same release information to ChangeLog, RPM spec file, source control tags, koji build and bodhi submission.

What does cmake-fedora do exactly? (Feature List)

  • Edit once in RELEASE-NOTES.txt, applied everywhere, such as:
    • ChangeLog
    • Source tarball generation
    • RPM
    • koji scratch build
    • fedpkg scratch build, commit, build, update
    • bodhi submission, the Change is applied as note.
    • Uploading to hosting services like FedoraHosted, SourceForge, GitHub, Google Project hosting (the last three is under development)
  • A script to generate templates of build files and documents, such as
    • CMakeLists.txt
    • MAINTAINER_SETTING_NO_PACK
    • RELEASE-NOTES.txt
    • SPECS/project.spec.in
    • COPYING (and COPYING.LESSER for LGPL)
  • Helper macros and targets to:
    • Build
    • Pack source tarball
    • Build rpm, srpm
    • rpmlint
    • Submit to fedpkg, koji, and bodhi
    • Clean older builds
    • uninstall

Project’s home page is at here.

CMake String regex match annoyance (aftermath)

Bill Hoffman kindly informed me that I can use “” to protect the semicolon.

For example, to get value of variable “_line” should be written as “${_line}”.

Thanks, Bill.

CMake Introduction slides

I’ve just made slides to introduce CMake.

Please download the slides and example programs from:
http://dchen.fedorapeople.org/files/CMake_Tutorial.tgz
if you are interested.