【问题标题】:Compilation failure in JNativeHookJNativeHook 中的编译失败
【发布时间】:2015-08-29 03:47:57
【问题描述】:

试图编译这个https://github.com/kwhat/jnativehook/wiki/Compiling

做到了我必须运行 ant all 来构建的步骤。

编译失败并在命令提示符中显示以下内容。

    [javac] Fatal Error: Unable to find package java.lang in classpath or bootcl
asspath

BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:394: Co
mpile failed; see the compiler error output for details.

Total time: 0 seconds

编辑:我刚刚将 rt 文件复制到我要编译的目录中。我克服了第一个错误,但现在我得到了

ava\org\jnativehook\mouse\NativeMouseWheelListener.java

download-libuiohook:

bootstrap-libuiohook:
     [echo] Bootstrapping libUIOHook...
[autoreconf] autoreconf --verbose --force --install

BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:351: Ex
ecute failed: java.io.IOException: Cannot run program "sh" (in directory "C:\Use
rs\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\src\libuiohook"): Creat
eProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Jav
a13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
        at org.jnitasks.autotools.AutoreconfTask.execute(AutoreconfTask.java:113
)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:853)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 24 more

Total time: 1 second

与此同时,仍在努力解决这个问题。

更新:

我想我一直在处理这个错误。我尝试在 MINGW64 中这样做,这可能是我应该这样做的。

遗憾的是,我仍在调查一个错误。

compile-java:
     [echo] Compiling Java source...

download-libuiohook:

bootstrap-libuiohook:
     [echo] Bootstrapping libUIOHook...
[autoreconf] autoreconf --verbose --force --install
[autoreconf] autoreconf: Entering directory `.'
[autoreconf] autoreconf: configure.ac: not using Gettext
[autoreconf] autoreconf: running: aclocal --force -I m4
[autoreconf] aclocal-1.15: error: aclocal: file '/msys64/usr/share/aclocal/xsize                    .m4' does not exist
[autoreconf] autoreconf: aclocal failed with exit status: 1

BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:351: ex                    ec returned: 1

Total time: 2 seconds

更新:

哇,msys64 有多少个 shell。我现在已经尝试了似乎是最后一个也是最后一个 shell msys2_shell.bat 并且它得到了更进一步但仍然失败。

现在我明白了

JNativeHook/bin --enable-debug --enable-quiet --enable-static --disable-shared --with-pic
[configure] checking build system type... x86_64-pc-msys
[configure] checking host system type... x86_64-pc-msys
[configure] checking target system type... x86_64-pc-msys
[configure] checking for a BSD-compatible install... /usr/bin/install -c
[configure] checking whether build environment is sane... yes
[configure] checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
[configure] checking for gawk... gawk
[configure] checking whether make sets $(MAKE)... yes
[configure] checking whether make supports nested variables... yes
[configure] checking for style of include used by make... GNU
[configure] checking for gcc... clang
[configure] configure: error: in `/c/Users/George/Downloads/sounds/JNativeHook-2.0.1/JNativeHook/bin/libuiohook':
[configure] checking whether the C compiler works... no
[configure] configure: error: C compiler cannot create executables
[configure] See `config.log' for more details

BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:361: exec returned: 77

Total time: 37 seconds

如此接近。

更新:

已安装 clang,现在从 config.log 文件中获取此详细错误。

configure:3580: checking whether the C compiler works
configure:3602: clang -march=armv6j -mfpu=vfp -mfloat-abi=hard -Os -g -pipe -fomit-frame-pointer -flto -ffat-lto-objects -fno-stack-protector  -Wl,--as-needed,-O1 -flto conftest.c  >&5
clang.exe: warning: optimization flag '-ffat-lto-objects' is not supported
clang.exe: error: 'i686-pc-windows-gnu': unable to pass LLVM bit-code files to linker
configure:3606: $? = 1
configure:3644: result: no
configure: failed program was

【问题讨论】:

    标签: java ant build compilation msys


    【解决方案1】:

    好吧,对于像我这样在 Windows 8.1 上执行此操作的未来 JNativeHook 编译器新手来说,我必须这样做才能使其正常工作。

    除了遵循 git 上提供的 compile for windows 部分中的所有步骤。

    你还需要...

    下载适用于 Windows 的 LLVM。 将您的 rt.jar 复制到 JNativeHook 目录中。 并确保绝对确保您已删除从失败的构建生成的任何 build.properties。

    这应该可以正常工作。

    【讨论】:

      【解决方案2】:

      如果您尝试编译 2.0.1,请不要忘记运行 ant distclean first。我忘记将 build.properties 文件包含在 zip 文件的排除列表中,从而搞砸了打包过程。我认为这也将解决您的 rt.jar 复制问题。它可能会解决您的所有问题;)无论如何,2.0.2 将解决问题并计划在周日发布。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-10-07
        • 1970-01-01
        • 2021-06-14
        • 2021-01-29
        • 2018-11-06
        • 1970-01-01
        • 2013-02-01
        • 2016-08-16
        相关资源
        最近更新 更多