Bug #7083
P2J Native Build Cannot Find -ljvm Under Windows
100%
History
#1 Updated by Greg Shah over 1 year ago
- Description updated (diff)
Environment¶
Windows VirtualBox VM is set up by following the steps in Windows 11 Virtual Machine Setup with FWD v4 and the Testcase Project
java version "1.8.0_341" Java(TM) SE Runtime Environment (build 1.8.0_341-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)
Code¶
Latest p2j trunk
(r14483) clean checkout.
Steps to reproduce¶
Run gradlew all
.
Issue¶
The build fails on gradle task ant-native. Run gradle ant-native --debug
to debug it.
22:57:57.563 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:exec] C:\clean\trunk\build\native>gcc -g -Wall -s -LC:\Java\jdk1.8.0_341\jre/lib/amd64/server/ -DNDEBUG -D_UNICODE -m64 -IC:\Java\jdk1.8.0_341\jre/..//include -IC:\Java\jdk1.8.0_341\jre/..//include/win32 -IC:\clean\trunk/src/native C:\clean\trunk/src/native\winspawn.c -o ..\..\build\native\spawn.exe -ljvm -m64 22:57:58.366 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:exec] make[1]: Leaving directory `C:/clean/trunk/build/native' 22:57:58.367 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:exec] c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ljvm 22:57:58.367 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:exec] collect2.exe: error: ld returned 1 exit status 22:57:58.367 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:exec] make[1]: *** [build] Error 1 22:57:58.367 [INFO] [org.gradle.api.internal.project.ant.AntLoggingAdapter] [ant:exec] make: *** [spawn] Error 2 22:57:57.212 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] 22:57:57.212 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :ant-native FAILED
The gcc
command in src/native/makefile.spawn
has received LDFLAGS+=-ljvm
. -ljvm
option is resolved as libjvm
, which can be found in GCD Linux workstation under /usr/lib/libjvm.so
(symlink to /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so
created by the initial setup).
In Windows the same file is found under %JAVA_HOME%\jre\bin\server
and is called jvm.dll
. Even though the path is in the System Environment PATH, the library cannot be found and it seems that's because the command looks for a file called libjvm
instead jvm
.
Temporal solution¶
Replace -ljvm
in src/native/makefile.spawn
and src/native/makefile.launcher
with the full path to the library %JAVA_HOME%\jre\bin\server\jvm.dll
.
#2 Updated by Greg Shah over 1 year ago
- Project changed from Internal Systems to Build and Source Control
- Start date deleted (
01/31/2023)
#4 Updated by Eugenie Lyzenko 12 months ago
Galya B wrote:
Note: The temporal solution works with an absolute path, where JAVA_HOME is replaced by the actual path.
Have you performed instruction from this: set up jvm.lib?
The Windows OS as developer system has several specific command and all are to be done for successful FWD
build.
#5 Updated by Galya B 12 months ago
Thank you, Eugenie, copying the file fixed it. I updated my guide as well Windows 11 Virtual Machine Setup with FWD v4 and the Testcase Project. We can close this issue.