-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8326685: Linux builds not reproducible if two builds configured in different build folders #18009
Conversation
…fferent build folders Signed-off-by: Andrew Leonard <anleonar@redhat.com>
👋 Welcome back aleonard! A progress list of the required criteria for merging this PR into |
@andrew-m-leonard The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Tested locally on an aarch64 VM, with two build directories, build1 and build2. The resulting jdk image was identical. |
make/autoconf/flags-cflags.m4
Outdated
DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=\$(SUPPORT_OUTPUTDIR)/=" | ||
DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=\$(HOTSPOT_OUTPUTDIR)/=" |
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.
This is only a problem if the build directory is located outside the workspace root. In the case where the build directory is inside the root, I think it would be preferable to stick to just the one prefix map, for consistent relative paths for all affected files. If the build directory is outside, like in your example, I would suggest adding just $(OUTPUTDIR)/=
to both -fdebug-prefix-map
and -fmacro-prefix-map
for consistency. We don't seem to have a variable indicating if the OUTPUTDIR is inside WORKSPACE_ROOT or not, but we can add one in basic.m4 where the OUTPUTDIR is initialized. Then you can conditionally add the extra prefix maps based on that variable.
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.
I have not thought this fully through, but just throwing out a question: would this work even if one build directory were inside the workspace root, and the other not?
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.
Oh you are right, we should always add the OUTPUTDIR to both maps regardless of if it's internal to the WORKSPACE_ROOT or not. Paths relative to the OUTPUTDIR should be stable across builds in different output directories, but paths inside the OUTPUTDIR, expressed as relative to the WORKSPACE_ROOT will vary.
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.
I have not thought this fully through, but just throwing out a question: would this work even if one build directory were inside the workspace root, and the other not?
Yes, I have tested that scenario as well, and does work. It was in fact the scenario in which I discovered the problem in the first place.
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.
Oh you are right, we should always add the OUTPUTDIR to both maps regardless of if it's internal to the WORKSPACE_ROOT or not. Paths relative to the OUTPUTDIR should be stable across builds in different output directories, but paths inside the OUTPUTDIR, expressed as relative to the WORKSPACE_ROOT will vary.
@erikj79 @magicus Yes, it needs to always be present as you've pointed out the OUTPUTDIR when within the WORKSPACE will be eg.WORKSPACE/build/linux-aarch64-server-release/support and the standard WORKSPACE mapping will make that build/linux-aarch64-server-release/support, but a build dir outside will be simply <any_path>/support
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.
Also, this mapping business is getting really convoluted. :-( I did not like it as it was, and this patch makes it even worse. I think we need to rewrite this to create some kind of dict/map, and then iterate over the map and apply -fdebug-prefix-map
to all items in the map. Unfortunately, the data structures available in shell scripts is limited and will make this a bit tricky to pull off. :(
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.
It seems correct to include the output dir in the remapping, but I have two objections/questions to the way you are doing it.
1. Why not just use OUTPUTDIR instead of the two specialized subdirs? That is simpler, more general and future-proof. 2. Why not expand the value of the OUTPUTDIR variable? I.e.
DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=$OUTPUTDIR/="
instead of trying to preserve it as a variable to be expanded in the make execution.
Ah thanks @magicus I hadn't seen that existed! that would simplify it, i'll try that now
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.
Also, this mapping business is getting really convoluted. :-( I did not like it as it was, and this patch makes it even worse. I think we need to rewrite this to create some kind of dict/map, and then iterate over the map and apply
-fdebug-prefix-map
to all items in the map. Unfortunately, the data structures available in shell scripts is limited and will make this a bit tricky to pull off. :(
yeah, although that's not easy for example for the gcc include paths that we have to work out based on the users compiler paths, so it wouldn't be a simple dict
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.
@magicus thank you for the tip, it works nicely, ready for re-review please
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.
Looks good to me now, but please let Erik have a look as well before pushing.
…fferent build folders Signed-off-by: Andrew Leonard <anleonar@redhat.com>
…fferent build folders Signed-off-by: Andrew Leonard <anleonar@redhat.com>
@andrew-m-leonard This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 33 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@erikj79 ready for re-review please |
/integrate |
Going to push as commit 3b90ddf.
Your commit was automatically rebased without conflicts. |
@andrew-m-leonard Pushed as commit 3b90ddf. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Adds Linux -fdebug-prefix-map'ing for SUPPORT_OUTPUTDIR and HOTSPOT_OUTPUTDIR when absolute paths are not allowed in the binaries, thus making the building of a JDK identically reproducible from different build directories.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18009/head:pull/18009
$ git checkout pull/18009
Update a local copy of the PR:
$ git checkout pull/18009
$ git pull https://git.openjdk.org/jdk.git pull/18009/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18009
View PR using the GUI difftool:
$ git pr show -t 18009
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18009.diff
Webrev
Link to Webrev Comment