[Git][reproducible-builds/reproducible-website][master] deterministic_build_systems: add more CMake and Qt moc/rcc notes
Peter Wu
gitlab at salsa.debian.org
Fri Jan 18 21:51:58 CET 2019
Peter Wu pushed to branch master at Reproducible Builds / reproducible-website
Commits:
83d4700c by Peter Wu at 2019-01-18T20:51:49Z
deterministic_build_systems: add more CMake and Qt moc/rcc notes
- - - - -
1 changed file:
- _docs/deterministic_build_systems.md
Changes:
=====================================
_docs/deterministic_build_systems.md
=====================================
@@ -51,18 +51,50 @@ CMake notes
The default configuration of CMake makes the build directory part of the
build environment. Here are some known issues and recommendations:
- * CMake sets a `RPATH` for binaries that link to a library in the build
- directory, containing the build directory. Even if this is stripped
- at installation time, the build-id section will be different.
- Possible workarounds:
+ * CMake sets a `RPATH` for binaries that link to a library in the the
+ same project. Even when this is stripped at installation time, the
+ build-id section will be different. Possible workarounds:
* Set `CMAKE_BUILD_WITH_INSTALL_RPATH=ON` or `CMAKE_SKIP_RPATH=ON` to
ensure a deterministic RPATH. Disadvantage: programs from the build
directory cannot be run without setting `LD_LIBRARY_PATH`.
* Set
- [`CMAKE_BUILD_RPATH_USE_ORIGIN=ON`](https://cmake.org/cmake/help/git-master/prop_tgt/BUILD_RPATH_USE_ORIGIN.html).
+ [`CMAKE_BUILD_RPATH_USE_ORIGIN=ON`](https://cmake.org/cmake/help/git-master/prop_tgt/BUILD_RPATH_USE_ORIGIN.html)
to enable the use of relative directories in RPATH (requires CMake
3.14). This is an appropriate option for both upstream projects
and downstream distributions.
+ * Qt projects can use [rcc](https://doc.qt.io/qt-5/rcc.html) to embed
+ resources such as translations and images. Since Qt 5.8, rcc includes
+ the file modification time of source files in the build output.
+ This is especially problematic for translation files that are
+ generated at build time. Possible workarounds:
+ * (Since Qt 5.9) If a project does not rely on an accurate
+ [QFileInfo::lastModified](https://doc.qt.io/qt-5/qfileinfo.html#lastModified),
+ pass `--format-version 1` to `rcc`. If
+ [`AUTORCC`](https://cmake.org/cmake/help/latest/prop_tgt/AUTORCC.html)
+ is enabled, this can be done by setting
+ [`CMAKE_AUTORCC_OPTIONS`](https://cmake.org/cmake/help/latest/variable/CMAKE_AUTORCC_OPTIONS.html)
+ to `--format-version;1`. Upstream projects are encouraged to do
+ this after checking that Qt 5.9 or newer is in use.
+ * Ensure that generated source files are touched with a fixed
+ timestamp before rcc is called. See also
+ https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894476
+ * Qt projects that use `Q_OBJECT` macros require
+ [moc](https://doc.qt.io/qt-5/moc.html) to generate additional C++
+ files. CMake will automatically do this when
+ [`AUTOMOC`](https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html)
+ is enabled, but then the relative path from the build directory to
+ the source directory will become part of the build environment.
+ For example, if the build directory is `/tmp/build` and the source
+ file is at `/tmp/foo/widget.h`, then the generated file will include
+ `../[...]/../foo/widget.h`. Possible workarounds:
+ * Use the `-p` option to override the include prefix. This requires
+ the prefix plus the header filename to be available from the
+ include path.
+ See also https://gitlab.kitware.com/cmake/cmake/issues/18815
+ * Ensure that the build directory and source directory remains fixed
+ across builds. For example, if users always create a `build`
+ directory in the source tree, then reproducibility won't be
+ affected.
Disclaimer
----------
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/commit/83d4700cde5b852ddcf35f2921f5e134879f630f
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/commit/83d4700cde5b852ddcf35f2921f5e134879f630f
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190118/e70ca6c2/attachment.html>
More information about the rb-commits
mailing list