-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
WIP: Add jvm.dll
to the %PATH%
on Windows
#30
base: main
Are you sure you want to change the base?
WIP: Add jvm.dll
to the %PATH%
on Windows
#30
Conversation
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
3a1030f
to
2eb75e9
Compare
jvm.dll
to the %PATH%
on Windowsjvm.dll
to the %PATH%
on Windows
644d0ad
to
d12b30e
Compare
Good idea to fix the root of the problem instead of the symptoms. |
d12b30e
to
5ef7179
Compare
The install steps for the activate scripts used a mixture of copying and echoing the contents. This tries to use a standard method used by other activate scripts in the conda-forge recipes to simply copy over the scripts while still respecting the layout here.
60bcf09
to
2cec88c
Compare
Hmm...so the compilation step proceeds ok with the test C file, but running it somehow causes the build to fail. Not totally sure why. 🤔 ref: https://ci.appveyor.com/project/conda-forge/openjdk-feedstock/build/1.0.105/job/c6se8l95qjo3wdyh |
I recommend not changing |
Also, you are claiming to add something then remove it later. This is not at all what's being done. PATH alterations made during activation get lost with this full backup and full restore scheme. |
One step at a time, @mingwandroid, I'd like to see us fix the issue first and then we can figure out what other options we'd like to try. |
Maybe you should just switch to IntelliJ JDK instead like I did? It does not suffer from this bug. |
And I worry about your 'one step at a time' statement, fix things correctly first time, it's far from guaranteed I'll spot or remember such a mistake if I don't comment upon it immediately. |
Don't have time to investigate that. If someone wants to start that PR, great. For now, I think we can solve this much more simply.
By which I mean let's see the tests pass. Just getting things to compile on Windows in the test phase was being a bit of a chore. Now that it is working we can explore other options. Already have a few in mind. |
bfb6dcc
to
ccc5fb0
Compare
As we don't actually use `curl` on Windows, just drop it as a dependency.
Include `errorlevel` checks and lower case commands as Windows is not case sensitive anyways.
Since we are done with this temporary variable, just unset it when we deactivate.
As `move *` misses subdirectories, which appears to result in lots of things end up missed on Windows, just switch to `xcopy` to make sure we get everything we need.
Since manipulating the `%PATH%` is a bad idea and we need the loader to find `jvm.dll` and its dependencies, just copy `jvm.dll` and related DLLs to some place that is already on the `%PATH%` on Windows namely `%LIBRARY_BIN%`.
This is being set for the Unix builds to point out where the `jvm` shared object is, but not on Windows. So go ahead and add it to the Windows activation/deactivation scripts.
Basically copies over the test from Unix and tries to implement it for Windows. Add missing include path to the Windows test Fix up compiler options
Now that the compilers are in use for the test phase, re-render the feedstock to properly select them for each platform.
Rebuild `openjdk` to get a new package with the fix to the activation script needed by libraries using JNI.
ccc5fb0
to
f7de6ad
Compare
copy %LIBRARY_PREFIX%\jre\bin\server\jvm.dll %LIBRARY_BIN%\ | ||
if errorlevel 1 exit 1 | ||
copy %LIBRARY_PREFIX%\jre\bin\*.dll %LIBRARY_BIN%\ | ||
if errorlevel 1 exit 1 |
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 second copy is probably the wrong approach as it is not targeted enough. Was adding it in as jvm.dll
said it was missing dependencies, but didn't say which ones. However this is causing new problems, where it is looking for jvm.cfg
in the wrong location and not finding it. Links to the relevant logs demonstrating these issues in order below.
ref: https://ci.appveyor.com/project/conda-forge/openjdk-feedstock/build/1.0.112/job/8eux8vxmsrb4bcql
ref: https://ci.appveyor.com/project/conda-forge/openjdk-feedstock/build/1.0.115/job/nemxfkj4135v2ies
recipe/scripts/activate.bat
Outdated
@@ -1,2 +1,5 @@ | |||
set "JAVA_HOME_CONDA_BACKUP=%JAVA_HOME%" | |||
set "JAVA_HOME=%CONDA_PREFIX%\Library" | |||
|
|||
set "JAVA_LD_LIBRARY_PATH_BACKUP=%JAVA_LD_LIBRARY_PATH%" | |||
set "JAVA_LD_LIBRARY_PATH=%JAVA_HOME%\jre\bin\server" |
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.
Was hoping this would help the issue on Windows (as it does on Unix), but it seems to be ignored AFAICT. If requested, we can drop it, but would slightly prefer to keep (though don't have strong feelings on it).
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.
As far as I know there is no LD_LIBRARY_PATH
on Windows, so what would be the purpose of adding a JAVA_LD_LIBRARY_PATH
?
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.
True. Wasn't sure if Java still defined it's own JAVA_LD_LIBRARY_PATH
for Windows anyways. Can drop it if that is not the case.
Unfortunately I lack a Windows machine to debug this further. So if someone can try this and advise me how to proceed, that would be very helpful. |
I have used some of your commits from this PR to #34. Hope it's ok for you. I didn't include the Windows JNI thing since it does not seem to be ready yet. |
Of course, happy to hear this is useful and to have help integrating it no matter how much was used. Completely understand punting on the Windows JNI thing. Based on my notes, it looks like commit ( 901125b ) fixed the issue as demonstrated in this build. While that changeset functionally worked, the fact that it hacks the Edit: Have updated the PR's contents to match those of commit ( 901125b ) for clarity. These are now under the new commit ( 0b3e686 ). Edit 2: Perhaps hard-linking would be a reasonable solution to address the Windows JNI issues. |
Resurrects commit ( 901125b )'s contents, which hacks the `PATH` on Windows to get JNI working. This is by no means ideal and almost certainly should not be used as is. However it is a good starting point where things have been tested and verified to be functional.
Hi! This is the friendly automated conda-forge-linting service. I was trying to look for recipes to lint for you, but it appears we have a merge conflict. Please ping the 'conda-forge/core' team (using the @ notation in a comment) if you believe this is a bug. |
When building code that relies on Java's JNI (Java Native Interface), which is the case for any C/C++ library that interacts with Java, the
jvm
library needs to be loadable. On Unix, this seems to work out of the box thanks to the existence ofrpath
s. However on Windows, we need to explicitly addjvm.dll
to the path or code requiring it will fail with a loading error.To fix this, we add the path to
jvm.dll
to the%PATH%
on Windows as part of the activation script. This ensures thatjvm.dll
can be loaded by libraries built with JNI that look for it. Whenever deactivation occurs, we strip this location from the%PATH%
.cc @hanslovsky