-
-
Notifications
You must be signed in to change notification settings - Fork 464
cmake: Make build reproducible across different build directories #730
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
This mostly works, but the path of
This seems to be from the precompiled headers, which somehow include the file from Anyone have an idea why this is? I checked the include paths and it has only the wrapper path. However when I copy the root |
When inspecting
|
This seems to only happen with |
Ah, I get it, PCH starts including This matches the
So it seems like the include path for PCH dependencies is wrong? |
GCC actually resolves the symlinks:
I'm still not quite sure how this then winds up in the binary, but it is definitely through the |
Updated to find the project root. |
e1552d6
to
fd360f6
Compare
144be6b
to
b7ef2f1
Compare
Updated to not loop over the parent directories. I noticed that the |
Please raise an issue. I'll have to look into it. |
0ae543a
to
2448126
Compare
Updated, |
@@ -17,8 +26,11 @@ if (NOT hasParent) | |||
option (BUILD_WRITERS "Build with writer support (encoders)" ON) | |||
option (BUILD_READERS "Build with reader support (decoders)" ON) | |||
set(BUILD_DEPENDENCIES "AUTO") | |||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/core) |
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.
Looking at this line, it occurred to me that is does not make any sense in current HEAD because core
always exists. Then I realized: your function is not necessary at all. Simply do the IS_SYMLINK
check on core
(which will fail in an sdist build) and if it is a symlink, then hardcode the ../../core
path. Less lines of code to worry about.
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.
Will change, but maybe not today.
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.
Updated, I still kept the EXISTS
check but made a variable CORE_PATH
that is set conditionally based on whether ./core
is a symlink.
Without this, the usage of the __FILE__ macro leaves the build directory in the binary. When building the Python extension with build isolation enabled this would lead to random paths in the binary.
2448126
to
1bda584
Compare
This updates the zxing-cpp build to use a patched version of the zxing-cpp 2.2.1 release with a patch for reproducible build see zxing-cpp/zxing-cpp#730
@EchterAgo I just noticed that this change broke my debugging environment because the IDE can't find the sources anymore and displays assembly instead. A quick fix is to only apply the file-prefix-map flag in a release build. I guess this would still satisfy your requirements? |
Maybe try I think just using |
|
Without this, the usage of the FILE macro leaves the build directory in the binary. When building the Python extension with build isolation enabled this would lead to random paths in the binary.