]> code.ossystems Code Review - openembedded-core.git/commitdiff
vulkan-samples: Fix reproducibility issue
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 13 Jan 2021 23:07:16 +0000 (23:07 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 15 Jan 2021 13:39:21 +0000 (13:39 +0000)
There is code to remove the prefix CMAKE_SOURCE_DIR from __FILENAME__ paths
used for logging with LOGE() in the code. We need to make this match the value we use
in the debug source remapping from CFLAGS. If we don't, the code is firstly removing
the incorrect prefix and possibly moving outside the string, secondly, it causes a
reproducibility issue depending on the length of path the build happens in.

Add a small patch and configuration to avoid the issue.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-graphics/vulkan/vulkan-samples/debugfix.patch [new file with mode: 0644]
meta/recipes-graphics/vulkan/vulkan-samples_git.bb

diff --git a/meta/recipes-graphics/vulkan/vulkan-samples/debugfix.patch b/meta/recipes-graphics/vulkan/vulkan-samples/debugfix.patch
new file mode 100644 (file)
index 0000000..d723fcc
--- /dev/null
@@ -0,0 +1,31 @@
+There is code to remove the prefix CMAKE_SOURCE_DIR from __FILENAME__ paths
+used for logging with LOGE() in the code. We need to make this match the value we use
+in the debug source remapping from CFLAGS
+
+We export the right path to use in the recipe with:
+
+EXTRA_OECMAKE = "-DCMAKE_DEBUG_SRCDIR=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/"
+
+and we then patch this into the code instead of the broken use
+of CMAKE_SOURCE_DIR since __FILENAME__ will match our path prefix
+changes.
+
+This also breaks reproducibility since the path length of the build directory
+will currently change the output!
+
+Upstream-Status: Pending [needs to be discussed upstream]
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+
+Index: git/bldsys/cmake/global_options.cmake
+===================================================================
+--- git.orig/bldsys/cmake/global_options.cmake
++++ git/bldsys/cmake/global_options.cmake
+@@ -47,7 +47,7 @@ set(CMAKE_CXX_STANDARD 14)
+ set(CMAKE_DISABLE_SOURCE_CHANGES ON)
+ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
+-string(LENGTH "${CMAKE_SOURCE_DIR}/" ROOT_PATH_SIZE)
++string(LENGTH "${CMAKE_DEBUG_SRCDIR}/" ROOT_PATH_SIZE)
+ add_definitions(-DROOT_PATH_SIZE=${ROOT_PATH_SIZE})
+ set(CMAKE_C_FLAGS_DEBUG   "-DDEBUG=0 ${CMAKE_C_FLAGS_DEBUG}")
index 896b2483272e017db40079db816a26d41d6a6f7c..447d498fb34bcc120ce32933abe708f401fe47f3 100644 (file)
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=48aa35cefb768436223a6e7f18dc2a2a"
 SRC_URI = "gitsm://github.com/KhronosGroup/Vulkan-Samples.git \
            file://0001-CMakeLists.txt-do-not-hardcode-lib-as-installation-t.patch \
            file://0001-support-link-against-libatomic-if-no-built-in-atomic.patch \
+           file://debugfix.patch \
            "
 
 UPSTREAM_CHECK_COMMITS = "1"
@@ -19,3 +20,10 @@ REQUIRED_DISTRO_FEATURES = 'vulkan'
 inherit cmake features_check
 
 FILES_${PN} += "${datadir}"
+
+#
+# There is code to remove the prefix CMAKE_SOURCE_DIR from __FILENAME__ paths
+# used for logging with LOGE in the code. We need to make this match the value we use
+# in the debug source remapping from CFLAGS
+#
+EXTRA_OECMAKE = "-DCMAKE_DEBUG_SRCDIR=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/"
\ No newline at end of file