-
Notifications
You must be signed in to change notification settings - Fork 30
fix: add reproducible build flags to CMake configuration #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdded the CMAKE_SKIP_BUILD_RPATH=ON flag into the CMake configuration via DEB_CMAKE_EXTRA_FLAGS in debian/rules to prevent embedding build directory paths and guarantee reproducible binaries across environments. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
TAG Bot New tag: 2.0.16 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-E | ||
|
|
||
| # reproducible编译参数 | ||
| DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_SKIP_BUILD_RPATH=ON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMAKE_BUILD_RPATH_USE_ORIGIN 管用吗?(参考)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没试过,这个参数系统那边给的建议,
Added CMAKE_SKIP_BUILD_RPATH=ON flag to CMake configuration for reproducible builds This flag prevents CMake from embedding build directory paths in binaries, ensuring consistent builds across different environments The flag is appended to existing CMake flags through DEB_CMAKE_EXTRA_FLAGS variable This change addresses build reproducibility issues where binaries could differ due to embedded build paths Influence: 1. Verify that builds produce identical binaries when built from same source 2. Test building in different directories to ensure no path dependencies 3. Check that RPATH is not embedded in generated binaries 4. Validate that existing functionality remains unchanged 5. Test cross-environment builds for consistency fix: 为CMake配置添加可重复编译参数 在CMake配置中添加CMAKE_SKIP_BUILD_RPATH=ON标志以实现可重复编译 该标志防止CMake在二进制文件中嵌入构建目录路径,确保在不同环境中构建的一 致性 该标志通过DEB_CMAKE_EXTRA_FLAGS变量附加到现有的CMake标志中 此更改解决了由于嵌入构建路径导致二进制文件可能不同的构建可重复性问题 Influence: 1. 验证从相同源代码构建时是否生成相同的二进制文件 2. 在不同目录中测试构建以确保没有路径依赖 3. 检查生成的二进制文件中是否未嵌入RPATH 4. 验证现有功能是否保持不变 5. 测试跨环境构建的一致性
deepin pr auto review我来对这个git diff进行审查:
具体改进建议: diff --git a/debian/rules b/debian/rules
index 9ba6f2d0..335ead37 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,6 +7,11 @@ export DEB_CFLAGS_MAINT_APPEND = -Wall
export DEB_CXXFLAGS_MAINT_APPEND = -Wall
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-E
+# Enable reproducible builds
+# -DCMAKE_SKIP_BUILD_RPATH=ON: Skip build-time RPATH to ensure reproducible builds
+# and prevent potential security issues from untrusted library paths
+export DEB_CMAKE_EXTRA_FLAGS = -DCMAKE_SKIP_BUILD_RPATH=ON
+
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
VERSION = $(DEB_VERSION_UPSTREAM)主要改进点:
这些修改不会改变功能,但能提高代码的可读性和可维护性。 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Added CMAKE_SKIP_BUILD_RPATH=ON flag to CMake configuration for
reproducible builds
This flag prevents CMake from embedding build directory paths in
binaries, ensuring consistent builds across different environments
The flag is appended to existing CMake flags through
DEB_CMAKE_EXTRA_FLAGS variable
This change addresses build reproducibility issues where binaries could
differ due to embedded build paths
Influence:
source
fix: 为CMake配置添加可重复编译参数
在CMake配置中添加CMAKE_SKIP_BUILD_RPATH=ON标志以实现可重复编译
该标志防止CMake在二进制文件中嵌入构建目录路径,确保在不同环境中构建的一
致性
该标志通过DEB_CMAKE_EXTRA_FLAGS变量附加到现有的CMake标志中
此更改解决了由于嵌入构建路径导致二进制文件可能不同的构建可重复性问题
Influence:
Summary by Sourcery
Add CMAKE_SKIP_BUILD_RPATH=ON to CMake configuration via DEB_CMAKE_EXTRA_FLAGS to avoid embedding build paths in binaries and achieve reproducible builds across environments
Enhancements:
Build: