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

ant: missing dependency on JRE, needed at runtime #4105

Open
copumpkin opened this issue Sep 16, 2014 · 17 comments
Open

ant: missing dependency on JRE, needed at runtime #4105

copumpkin opened this issue Sep 16, 2014 · 17 comments
Assignees
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin 6.topic: java Including JDK, tooling, other languages, other VMs

Comments

@copumpkin
Copy link
Member

See https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/build-managers/apache-ant/default.nix.

It has a pretty hefty "launcher" script that calls readlink -f (and dirname) without referencing coreutils. Since the native readlink on Mac OS doesn't support -f, the script fails at startup. If you fix that, you get something like:

Unable to locate an executable at "/System/Library/Frameworks/JavaVM.framework/Versions/A/bin/java" (-1)

What confuses me more is that the launcher seems to deliberately go out of its way to find a jvm the hard way, without having the expression itself depend on java. I'm not sure why that's a good idea in nix, but given that @edolstra maintains it, I feel like I must be missing something.

@copumpkin
Copy link
Member Author

Ah, @edolstra gives rationale here: 54d1721.

Also, Ant no longer has a build-time dependency on a particular JDK.
It finds the JDK via $JAVA_HOME or $PATH (by looking up javac). This
way, we don't need to have separate packages like apacheAntOpenJDK and
apacheAntOracleJDK. It also seems reasonable: after all, installing
GNU Make doesn't give you a C compiler either. It does mean that
instead of

buildInputs = [ ant ];

you now need to write something like

buildInputs = [ ant jdk ];

I'm not sure I buy the rationale, but however it depends on the java runtime, it doesn't work on Mac OS 😄

@shlevy
Copy link
Member

shlevy commented Sep 16, 2014

I don't understand the reasoning in that commit. ant doesn't just manage java builds, it needs java to run. This is like not only failing to bundle gcc with make (which makes sense) but also failing to bundle glibc with make and finding it dynamically at runtime.

And if overriding a single drop-in replacement dependency one level deep is too onerous perhaps we should reconsider our package composition style?

@wmertens
Copy link
Contributor

On Tue, Sep 16, 2014 at 4:38 AM, Shea Levy [email protected] wrote:

I don't understand the reasoning in that commit. ant doesn't just manage
java builds, it needs java to run. This is like not only failing to bundle
gcc with make (which makes sense) but also failing to bundle glibc with
make and finding it dynamically at runtime.

Agreed, ant should depend on jdk, and obviously the heavy binary part can
be in a separate, wrapped, package.

The one thing I wonder about is if ant can build for a different JDK than
it is using itself?

@edolstra
Copy link
Member

It works for me:

$ nix-shell -p openjdk ant
[nix-shell:~]$ ant -version
Apache Ant(TM) version 1.9.3 compiled on December 23 2013

@copumpkin
Copy link
Member Author

But isn't the point to minimize the opportunity of "works for me"-style problems?

Ant needs a JRE at runtime so why, in principle, shouldn't it depend on one? If I were to change the ant expression to build the java code rather than download the binary tarball, would the answer be different?

On Sep 16, 2014, at 6:03, Eelco Dolstra [email protected] wrote:

It works for me:

$ nix-shell -p openjdk ant
[nix-shell:~]$ ant -version
Apache Ant(TM) version 1.9.3 compiled on December 23 2013

Reply to this email directly or view it on GitHub.

@copumpkin
Copy link
Member Author

Anyway, I'm not really sure what to do here, because I need ant. Would you oppose me making a pull request with a more conventional dependency on the JRE? My main concern is that I don't really understand the use cases you had that warranted today's weird set-up. I'm happy to do the naive thing though and see.

@domenkozar domenkozar added the 6.topic: darwin Running or building packages on Darwin label Oct 22, 2014
@stephenjudkins
Copy link

I second that ant should explicitly depend on a JDK. That's how apache-maven expression works, why not apache-ant? Seems like we should either change maven to work with this weird setup, or preferably change ant to explicitly depend on a JDK.

Who ends up making these decisions? Should someone just make a pull request?

@vcunat
Copy link
Member

vcunat commented Jan 7, 2015

@stephenjudkins: Decisions are typically done by people who have commit access and are "interested" in the particular issue/package. Submitting a PR is nice way to nudge them, and non-controversial reasonable changes are rarely rejected.

@Profpatsch
Copy link
Member

(triage) still a problem?

@wmertens
Copy link
Contributor

@copumpkin care to make that PR?

@copumpkin
Copy link
Member Author

Probably, but it's fairly low on my priority list right now. I'll try to get to it in the next couple of weeks.

@murnieza
Copy link

murnieza commented Nov 2, 2016

I had to export JAVA_HOME=$(/usr/libexec/java_home) to make it work.

@copumpkin
Copy link
Member Author

Still broken!

@shlevy
Copy link
Member

shlevy commented Oct 30, 2017

As is the logic behind the original change 🦆

@stale
Copy link

stale bot commented Jun 5, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 5, 2020
@Gaelan
Copy link
Contributor

Gaelan commented Jan 27, 2023

Still broken; ant just hangs forever unless you do (e.g.) nix shell nixpkgs#ant nixpkgs#jdk

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 27, 2023
@tomodachi94 tomodachi94 added 0.kind: bug Something is broken 6.topic: java Including JDK, tooling, other languages, other VMs labels Nov 5, 2024
@tomodachi94 tomodachi94 changed the title Ant is broken on Mac OS (and kind of weird) ant: missing dependency on JRE, needed at runtime Nov 5, 2024
@tomodachi94 tomodachi94 self-assigned this Nov 5, 2024
@tomodachi94 tomodachi94 added this to Java Nov 10, 2024
@tomodachi94 tomodachi94 moved this to Todo in Java Nov 13, 2024
@tomodachi94
Copy link
Member

This will be fixed by #359451, since we elect to hard-code values like the path to JAVA_HOME (we use the JRE in this case).

@tomodachi94 tomodachi94 linked a pull request Nov 27, 2024 that will close this issue
13 tasks
@tomodachi94 tomodachi94 moved this from To do to In progress in Java Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin 6.topic: java Including JDK, tooling, other languages, other VMs
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.