Closed tchaikov closed 2 months ago
since we have FTBFS when developer happens to point JAVA_HOME
to a java-1.8 installation. it'd be nice to fix this in the building system. so, this change resurrects #345.
once this change is merged, and scylla picks up the submodule change, i will update https://github.com/scylladb/scylladb/blob/master/tools/toolchain/Dockerfile#L16 to remove
ENV JAVA8_HOME=/usr/lib/jvm/java-1.8.0-openjdk
To be honest, I don't understand why you need to fix anything in this project, which is mostly a fork of Cassandra and could be built like Cassandra.
Personally, to compile scylla-tools-java I use the command:
ant realclean
JAVA_HOME=/usr/lib/jvm/java-11 JAVA8_HOME=/usr/lib/jvm/java-1.8.0 ant jar
I have a README to remind me of that. You don't have to change the build.xml to explicitly override JAVA_HOME and JAVA8_HOME.
To compile more recent Cassandra, I need to use an even more elaborate command to have it avoid Java 17, but it also works:
JAVA_HOME=/usr/lib/jvm/java-11 JRE_HOME=/usr/lib/jvm/java-11/jre PATH=$JAVA_HOME:$JRE_HOME/bin:$PATH CASSANDRA_USE_JDK11=true ant -Duse.jdk11=true
What worries me is that I don't know if your changes, while improving the situation on your build environment, break it for other people with different build environments you didn't consider (I'm not saying it will - I'm just saying it worries me).
wanted to address the pain of those who fail to build this project. A README in one's $HOME directory or memory does not address this for developers who happen to run into this problem. I think the code is more reproducible than document. As always, i believe that developers' time is precious.
I'm ok with this, but if we finally remove the java 8 compilation, why not just call JAVA11_HOME JAVA_HOME and just verify we have the appropriate level javac in build.xml?
Yeah. The original goal was to setup the right path for JAVA_HOME, but when I was reading your comment, I thought we could go further. IMHO, JAVA11_HOME is more explicit than JAVA_HOME. But I don't feel strong either way. I am not sure how to verify this in build.xml though. Just wanted to address the pain of FTBFS. The cleanup was but a bonus.
wanted to address the pain of those who fail to build this project. A README in one's $HOME directory or memory does not address this for developers who happen to run into this problem. I think the code is more reproducible than document. As always, i believe that developers' time is precious.
I agree with that, just make sure that after your changes it actually works for everyone, not just for you :-) Since I already figured out how to build the existing project, I'm worried I'll need to learn new tricks to build it with your changes, if it doesn't just work out of the box:
Please correct me if I'm wrong, your patch doesn't just make "ant" work automatically - I still need to set JAVA11_HOME instead of the JAVA_HOME I had to set before. Right? If this is the case, I am not sure how it addresses the pain of people who build this project... Or maybe I'm missing something and just plain "ant" should work after your patch?
wanted to address the pain of those who fail to build this project. A README in one's $HOME directory or memory does not address this for developers who happen to run into this problem. I think the code is more reproducible than document. As always, i believe that developers' time is precious.
I agree with that, just make sure that after your changes it actually works for everyone, not just for you :-) Since I already figured out how to build the existing project, I'm worried I'll need to learn new tricks to build it with your changes, if it doesn't just work out of the box:
no. it's not a breaking change. at least i think it is not.
Please correct me if I'm wrong, your patch doesn't just make "ant" work automatically - I still need to set JAVA11_HOME instead of the JAVA_HOME I had to set before. Right? If this is the case, I am not sure how it addresses the pain of people who build this project... Or maybe I'm missing something and just plain "ant" should work after your patch?
the goal is to make the following workflow more smooth:
install-dependencies.sh
./configure.py
to setup the building systemninja -j14
one does not need to setup JAVA_HOME
or JAVA11_HOME
. because the build.ninja
generated by configure.py
calls into tools/java/build_reloc.sh
, which sets this up for us, and ant
picks the environmental variable up. even his/her JAVA11_HOME
or JAVA_HOME
points to the shining java-17.0.9, the tree should still build on recent release of ubuntu or fedora.
i guess the developers who are already familiar with ant
should be able to find their way out after reading the error message in the cover letter =)
EDIT, corrected the last step of the workflow.
As far as I know (please correct me if I'm wrong), ninja build/release/scylla
doesn't call tools/java/build_reloc.sh. We have other scripts that do this, but not ninja build/release/scylla
.
Anyway, if you don't care what "cd tools/java; ant" does, why did you want to modify build.xml at all? You could have done anything you wanted in the scripts you mentioned - including "unset JAVA_HOME" if you wanted to.
Anyway, I'm not against this patch - all that I'm saying, I guess, is that I don't understand it :-)
As far as I know (please correct me if I'm wrong),
ninja build/release/scylla
doesn't call tools/java/build_reloc.sh. We have other scripts that do this, but notninja build/release/scylla
.
sorry. i failed to copy the command line and instead typed the one i was using. it should be
ninja -j14
Anyway, if you don't care what "cd tools/java; ant" does, why did you want to modify build.xml at all? You could have done anything you wanted in the scripts you mentioned - including "unset JAVA_HOME" if you wanted to.
agreed. a minimal change does not need to touch build.xml
. that'd be more or less what #345 does. but the more i read the comments in that PR the more i was tempted to go further: if we don't need this and that, why would we need to install and build foo and bar, and how about ... hence these changes.
Anyway, I'm not against this patch - all that I'm saying, I guess, is that I don't understand it :-)
v2:
LGTM
v3:
this fails the build. see https://jenkins.scylladb.com/job/scylla-master/job/byo/job/byo_build_tests_dtest/1961/consoleText
[2023-12-22T06:59:52.909Z] [151/1070] cd tools/java && ./reloc/build_reloc.sh --version $(<../../build/SCYLLA-PRODUCT-FILE)-$(sed 's/-/~/' <../../build/SCYLLA-VERSION-FILE)-$(<../../build/SCYLLA-RELEASE-FILE) --nodeps
[2023-12-22T06:59:52.909Z] FAILED: tools/java/build/scylla-tools-5.5.0~dev-0.20231222.7b1a0af13993.noarch.tar.gz
[2023-12-22T06:59:52.909Z] cd tools/java && ./reloc/build_reloc.sh --version $(<../../build/SCYLLA-PRODUCT-FILE)-$(sed 's/-/~/' <../../build/SCYLLA-VERSION-FILE)-$(<../../build/SCYLLA-RELEASE-FILE) --nodeps
[2023-12-22T06:59:52.909Z] unable to find jdk-11
we need to install openjdk-11-jdk-headless
or up to fix it. i think, currently, the dbuild image only contains java-11-openjdk-headless
at this moment, but openjdk-11-jdk-headless
is missing in it.
[2024-08-20T07:13:09.727Z] [99/631] cd tools/java && ./reloc/build_reloc.sh --version $(<../../build/SCYLLA-PRODUCT-FILE)-$(sed 's/-/~/' <../../build/SCYLLA-VERSION-FILE)-$(<../../build/SCYLLA-RELEASE-FILE) --nodeps [K
[2024-08-20T07:13:09.727Z] [31mFAILED: [0mtools/java/build/scylla-tools-6.2.0~dev-0.20240820.8bdeaf72664c.noarch.tar.gz
[2024-08-20T07:13:09.727Z] cd tools/java && ./reloc/build_reloc.sh --version $(<../../build/SCYLLA-PRODUCT-FILE)-$(sed 's/-/~/' <../../build/SCYLLA-VERSION-FILE)-$(<../../build/SCYLLA-RELEASE-FILE) --nodeps
[2024-08-20T07:13:09.727Z] unable to find jdk-11
[2024-08-20T07:13:10.334Z]
https://jenkins.scylladb.com/job/scylla-master/job/byo/job/byo_build_tests_dtest/2451/consoleText . still the same.
anyway, i think there is no need to get this in, as
in short, for the same reason put at #207. i am not going to continue pushing forwards this PR anymore.
EDIT, because of https://jenkins.scylladb.com/job/scylla-master/job/next/8228/ , i think this change is still relevant.
@scylladb/scylla-maint hello maintainers, could you help install openjdk-11-jdk-headless
to the dbuild image?
we are seeing build failures in our CI due to the --release
problem:
would be nice if we can fix it once and for all.
I agree with the change, but I don't want to bring it in for a toolchain update.
Also, do we need -devel, or is the jdk enough?
I see -devel and openjdk are interdependent.
Turns out adding java-11-openjdk wasn't enough
Turns out adding java-11-openjdk wasn't enough
@avikivity adding java-11-openjdk is not enough, but openjdk-11-jdk-headless
should suffice. the former runs a java application, the later builds it.
openjdk-headless is a subset of openjdk-devel, no?
It doesn't contain javac for instance. We need -devel.
It doesn't work installing random stuff, and does work with this series. My conclusion is that something changed in how Fedora selects Java, and this series fixes it (although: it works on my workstation without the series).
before this change, we rely on JAVA_HOME to build for java11 target. but user might set JAVA_HOME to a java-8, in this case the
javac
from openjdk-8 would fail to compile, because it does not understand the--release
option:in this change, we use the JAVA11_HOME environmental variable exposed by
build_reloc.sh
, so that ant is able to build with the proper java even if user sets JAVA_HOME to java-8.