我正在尝试在安装了Arch linux ARM的Raspberry Pi2模型B上构建Pi4J。一切正常,除了JNI自然库的构建。这是错误消息(以及日志的一部分):
[INFO] --- maven-antrun-plugin:1.3:run (build-native-so) @ pi4j-native ---
[INFO] Executing tasks
build-libpi4j.so:
[echo] Building native libpi4j shared library for ABI: hard-float
[sshexec] Connecting to 192.168.178.94:22
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Pi4J :: Parent POM ................................. SUCCESS [01:04 min]
[INFO] Pi4J :: JNI Native Library ......................... FAILURE [ 18.906 s]
[INFO] Pi4J :: Java Library (Core) ........................ SKIPPED
[INFO] Pi4J :: GPIO Extension ............................. SKIPPED
[INFO] Pi4J :: Device Abstractions ........................ SKIPPED
[INFO] Pi4J :: Java Examples .............................. SKIPPED
[INFO] Pi4J :: OSGi Service ............................... SKIPPED
[INFO] Pi4J :: Distribution ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:50 min
[INFO] Finished at: 2015-08-11T20:50:37+00:00
[INFO] Final Memory: 11M/29M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:131)
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at net.sf.antcontrib.logic.IfTask.execute(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:118)
... 23 more
Caused by: /media/temp/pi4j-arch/pi4j-native/build.xml:10: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:188)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
... 53 more
Caused by: com.jcraft.jsch.JSchException: Algorithm negotiation fail
at com.jcraft.jsch.Session.receive_kexinit(Session.java:520)
at com.jcraft.jsch.Session.connect(Session.java:286)
at com.jcraft.jsch.Session.connect(Session.java:150)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:212)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:158)
... 66 more
我尝试了所有我能想到的东西,但我无法让它发挥作用。请帮助:)
修改
经过一番进一步调查后,我开始了解这些消息的含义及其工作原理。这是build.xml的一部分,它给出了错误:
<!-- ensure the target directory is empty on the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="rm --recursive --force ${pi-dirBuildTemp}" />
确切地说,它是以“详细”开头的行。我尝试编辑命令,删除部分内容......没有任何帮助。我尝试删除整个代码块,留下其他代码(看起来非常像),然后错误出现在下一个块的最后一行。这是整个/media/temp/pi4j-arch/pi4j-native/build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="pi4j-native" default="build-libpi4j.so" basedir=".">
<target name="build-libpi4j.so">
<echo message="Building native libpi4j shared library for ABI: ${pi-abi}"/>
<!-- ensure the target directory is empty on the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="rm --recursive --force ${pi-dirBuildTemp}" />
<!-- ensure the target directory exists on the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="false"
verbose="true" command="mkdir --parents ${pi-dirBuildTemp}" />
<!-- copy all the necessary source files to the Raspberry Pi -->
<scp todir="${pi-user}:${pi-password}@${pi-host}:${pi-dirBuildTemp}"
port="${pi-port}" trust="true" verbose="true" failonerror="true">
<fileset dir="src/main/native" />
</scp>
<!-- download and compile the 'wiringPi.a' native static library on the Raspberry
Pi platform -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="cd ${pi-dirBuildTemp}; sudo chmod +x wiringpi-build.sh; ./wiringpi-build.sh" />
<!-- compile the 'lib4j.so' JNI native shared library on the Raspberry
Pi platform -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="cd ${pi-dirBuildTemp}; make clean; make all" />
<!-- copy the compiled 'lib4j.so' JNI native shared library back -->
<scp
file="${pi-user}:${pi-password}@${pi-host}:${pi-dirBuildTemp}/libpi4j.so"
todir="${project-build-directory}/${pi-abi}/" port="${pi-port}" trust="true"
verbose="true" failonerror="true">
</scp>
<!-- remove the temporary target directory from the Raspberry Pi -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="rm --recursive --force ${pi-dirBuildTemp}" />
</target>
</project>
问题可能不在代码本身,而是在sshexec命令中。但我仍然不明白它究竟是如何运作的,可能是什么问题。明天我将尝试删除变量并将值放在那里,只是为了实验。
EDIT2:我测试了它...在同一个地方仍然出现同样的错误......
如果有人有任何想法,请分享。
EDIT3:
非常感谢,prunge!现在我领先几步!我做了你建议的两件事,就像第一件没有用的那样(但我在尝试时忘了重新启动SSH,所以也许它会起作用。)
现在我又得到了另一个错误......我用google搜索时只得到一个结果,但我找不到他们正在谈论的文件: https://github.com/rm-hull/wiringPi/issues/2 而且我不确定这是否完全相同。
这是错误:
fatal: destination path 'wiringPi' already exists and is not an empty directory.
[UnInstall]
wiringPi Build script
=====================
The wiringPi I2C helper libraries will not be built.
WiringPi library
[UnInstall]
make: Nothing to be done for 'all'.
[Install]
GPIO Utility
[Link]
gpio.o: In function `main':
gpio.c:(.text.startup+0x194): undefined reference to `wiringPiSetupPiFaceForGpioProg'
gpio.c:(.text.startup+0x670): undefined reference to `gertboardSPISetup'
gpio.c:(.text.startup+0x684): undefined reference to `gertboardAnalogWrite'
gpio.c:(.text.startup+0x884): undefined reference to `gertboardSPISetup'
gpio.c:(.text.startup+0x894): undefined reference to `gertboardAnalogRead'
collect2: error: ld returned 1 exit status
Makefile:45: recipe for target 'gpio' failed
make: *** [gpio] Error 1
Make Failed...
Please check the messages and fix any problems. If you're still stuck,
then please email all the output and as many details as you can to
projects@drogon.net
[ant] Exiting /media/temp/pi4j-arch/pi4j-native/build.xml.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Pi4J :: Parent POM ................................. SUCCESS [01:07 min]
[INFO] Pi4J :: JNI Native Library ......................... FAILURE [04:05 min]
[INFO] Pi4J :: Java Library (Core) ........................ SKIPPED
[INFO] Pi4J :: GPIO Extension ............................. SKIPPED
[INFO] Pi4J :: Device Abstractions ........................ SKIPPED
[INFO] Pi4J :: Java Examples .............................. SKIPPED
[INFO] Pi4J :: OSGi Service ............................... SKIPPED
[INFO] Pi4J :: Distribution ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:41 min
[INFO] Finished at: 2015-08-13T17:01:08+00:00
[INFO] Final Memory: 12M/30M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (build-native-so) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:131)
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:98)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: The following error occurred while executing this line:
/media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at net.sf.antcontrib.logic.IfTask.execute(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:118)
... 23 more
Caused by: /media/temp/pi4j-arch/pi4j-native/build.xml:27: Remote command failed with exit status 1
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.executeCommand(SSHExec.java:250)
at org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:162)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
... 53 more
我真的不知道它是如何工作的,我没有看到注释中的任何内容(在build.xml文件中)...这是导致错误的build.xml的一部分:
<!-- download and compile the 'wiringPi.a' native static library on the Raspberry
Pi platform -->
<sshexec host="${pi-host}" port="${pi-port}" username="${pi-user}"
password="${pi-password}" trust="true" failonerror="true"
verbose="true" command="cd ${pi-dirBuildTemp}; sudo chmod +x wiringpi-build.sh; ./wiringpi-build.sh" />
我找不到wirespi-build.sh ......
谢谢和问候, 克伦
答案 0 :(得分:0)
它没有通过SSH协议与你的Pi交谈。
如果您还没有,可能需要尝试将unlimited strength encryption policy files安装到运行Maven的JDK / JRE中。这将允许在通过SSH连接时协商更多算法。
另一种方法是更改Pi上的SSHD配置文件,以允许JDK / JRE支持的某些算法JSCH。执行此操作的详细信息位于this answer。