Skip to content
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

Update ReproducibleBuilds.md with cygwin details #3973

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
20feacc
Update ReproducibleBuilds.md with cygwin details
judovana Oct 4, 2024
c2cbbca
Mentioned that jdk use don path must not be jdk whichis being patched
judovana Oct 4, 2024
12437e5
Mentioned also classpath
judovana Oct 4, 2024
7f9cbf9
Fixing markup lint
judovana Oct 7, 2024
6eb7990
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
f8d8074
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
b3b8934
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
b6efaac
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
164dfc7
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
8c58dff
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
9cbc886
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
6cd4bc3
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
6c6479c
Update tooling/reproducible/ReproducibleBuilds.md
judovana Oct 8, 2024
b5e7e17
Merge branch 'master' into comparableReadmeUpdate
judovana Oct 8, 2024
8f8492b
Merge branch 'adoptium:master' into comparableReadmeUpdate
judovana Oct 9, 2024
d1d5614
removed surpassed 777 from ReproducibleBuilds.md
judovana Oct 9, 2024
7e660c9
Update tooling/reproducible/ReproducibleBuilds.md
karianna Oct 10, 2024
b57ac2f
Update tooling/reproducible/ReproducibleBuilds.md
karianna Oct 10, 2024
9597d5d
Merge branch 'master' into comparableReadmeUpdate
judovana Oct 10, 2024
1b2f20e
Removed full example f extracting the the properties out of vm
judovana Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions tooling/reproducible/ReproducibleBuilds.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ before the comparable_patch.sh can be run.
- Ensure VS2022 SDK is installed and on PATH
- Compile:
- cd tooling/src/c
- run vcvarsall.bat as your arch needs. Eg: vcvars64.bat on x64 windows
- You can set up INCLUDES manually but it is not worthy
- vcvarsall.bat creates a subshell, if you do not want it to create a subshell, use `call` eg `call vcvars64.bat` instead of the direct execution.
- cl WindowsUpdateVsVersionInfo.c version.lib

3. Compile [src/java/temurin/tools/BinRepl.java](https://github.com/adoptium/temurin-build/blob/master/tooling/src/java/temurin/tools/BinRepl.java) :

- Ensure suitable JDK on PATH
- **do not** use JDK you are just patching, as that JDK gets **broken** by the process of patching
- cd tooling/src/java
- javac temurin/tools/BinRepl.java

Expand All @@ -79,17 +83,60 @@ before the comparable_patch.sh can be run.
- For BinRepl.class : export CLASSPATH=<temurin-build>/tooling/src/java:$CLASSPATH
- A JDK for running BinRepl java : export PATH=<jdk>/bin:$PATH

##### Cygwin treacherousness

- It is extremely difficult (maybe impossible) to invoke `vcvarsall.bat+cl` in cygwin directly
- Thus, it is recommended to launch this via `cmd -c` or preferably by an executable `.bat` file such as:

```bash
pushd "$MSVSC/BUILD/TOOLS"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@judovana I think this is far too complex for "doc"... I am thinking we need a helper script that does all this for a user... called something like "SetupReproEnv.bat" and "SetupComparableEnv.bat", we then make this doc very simple....thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have finished the publishable script yesterday. Will make PR with it today I think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would be great, thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that that script is nto that simple. Depnending on MSVS, MSVC lcoations, cygwin, architectures and so on...:(

Copy link
Contributor Author

@judovana judovana Oct 11, 2024

rm -f WindowsUpdateVsVersionInfo.obj
echo "
call vcvars64.bat
cl $(cygpath -m $YOUR_WORKDIR/temurin-build/tooling/src/c/WindowsUpdateVsVersionInfo.c) version.lib
" > bat.bat
karianna marked this conversation as resolved.
Show resolved Hide resolved
chmod 777 bat.bat
./bat.bat
# copy it to any dir on path or add this dir to path
mv WindowsUpdateVsVersionInfo.exe "$FUTURE_PATH_ADDITIONS"
rm WindowsUpdateVsVersionInfo.obj bat.bat
popd
```

- NOTE: The default paths should work fine, e.g.,:

```bash
MSBASE_PATH="/cygdrive/c/Program Files/Microsoft Visual Studio/"
MSVSC=$(find "$MSBASE_PATH" -type d | grep Hostx64/x64$ | head -n 1 )
WINKIT=$(dirname "$(find '/cygdrive/c/Program Files (x86)/Windows Kits' | grep x64/signtool.exe$ | head -n 1)")
MSVSCBUILDTOOLS=$(find "$MSBASE_PATH" -type d | grep Auxiliary/Build$ | head -n 1 )
```

- NOTE: Using `cygpath` is sometimes necessary. However, Java *binaries* can have issues with it:
- e.g., Use `cygpath` for `$CLASSPATH`,
- or javac it is mandatory:

```bash
ftureDir="$(pwd)/classes"
if uname | grep CYGWIN ; then
ftureDir=$(cygpath -m "${ftureDir}")
fi
$AQA_DIR/$jdkName/bin/javac -d "${ftureDir}" "../../tooling/src/java/temurin/tools/BinRepl.java"
```

#### Running comparable_patch.sh:

1. Unzip your JDK archive into a directory (eg.jdk1)
- Note, that jdk will be modified, so the location must be writable
- if it is in admin/root location, `cp -rL` it to some temp directory.

2. Run comparable_patch.sh

```bash
bash comparable_patch.sh --jdk-dir "<jdk_home_dir>" --version-string "<version_str>" --vendor-name "<vendor_name>" --vendor_url "<vendor_url>" --vendor-bug-url "<vendor_bug_url>" --vendor-vm-bug-url "<vendor_vm_bug_url>" [--patch-vs-version-info]
```

The Vendor strings and urls can be found by running your jdk's "java -XshowSettings":
The Vendor strings and URLs can be found by running your jdk's "java -XshowSettings":

```java
java -XshowSettings:
Expand All @@ -101,7 +148,9 @@ java -XshowSettings:
...
```

eg.
In cygwin, you must handle the trailing `\r` otherwise it will fail later. sed `\r` away as eg: `sed 's/\r.*//'` is usually enough.

e.g.,:

```bash
bash ./comparable_patch.sh --jdk-dir "jdk1/jdk-21.0.1+12" --version-string "Temurin-21.0.1+12" --vendor-name "Eclipse Adoptium" --vendor_url "https://adoptium.net/" --vendor-bug-url "https://github.com/adoptium/adoptium-support/issues" --vendor-vm-bug-url "https://github.com/adoptium/adoptium-support/issues"
Expand Down
Loading