1

我正在尝试使用来自saddle的 hdf5 存储。我尝试的第一件事实际上是从项目中运行测试。不幸的是,他们只是挂起:

[info] Loading project definition from /home/folone/workspace/saddle/project
[info] Set current project to saddle (in build file:/home/folone/workspace/saddle/)
[saddle]$ project saddle-hdf5
[info] Set current project to saddle-hdf5 (in build file:/home/folone/workspace/saddle/)
[saddle-hdf5]$ test
[warn] Credentials file /home/folone/.ivy2/.credentials does not exist
[warn] Credentials file /home/folone/.ivy2/.credentials does not exist
[1]    22192 killed     sbt

我试着从 repl 玩它。没运气:

> console
[warn] Potentially incompatible versions of dependencies of {file:/home/folone/workspace/ad-ngrams/}adngrams:
[warn]    org.scala-lang: 2.10.1, 2.10.0
[info] Starting scala interpreter...
[info] 
Welcome to Scala version 2.10.1 (OpenJDK 64-Bit Server VM, Java 1.7.0_21).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import org.saddle.io._
import org.saddle.io._

scala> java.lang.Runtime.getRuntime.loadLibrary("jhdf5")

scala> val file = H5Store.openFile("/home/folone/workspace/ad-ngrams/temporary_store_ad.h5")
java.lang.UnsatisfiedLinkError: ncsa.hdf.hdf5lib.HDF5Constants.H5_QUARTER_HADDR_MAX()J
    at ncsa.hdf.hdf5lib.HDF5Constants.H5_QUARTER_HADDR_MAX(Native Method)
    at ncsa.hdf.hdf5lib.HDF5Constants.<clinit>(HDF5Constants.java:35)
    at org.saddle.io.H5Store$.openFile(H5Store.scala:409)
    at .<init>(<console>:10)
    at .<clinit>(<console>)
    at .<init>(<console>:7)
    at .<clinit>(<console>)
    at $print(<console>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734)
    at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983)
    at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)
    at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)
    at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)
    at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
    at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:889)
    at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
    at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)
    at sbt.Console.console0$1(Console.scala:23)
    at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)
    at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
    at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)


scala> val fid1 = H5Store.createFile("/home/folone/workspace/ad-ngrams/test.h5")
java.lang.NoClassDefFoundError: Could not initialize class ncsa.hdf.hdf5lib.HDF5Constants
    at org.saddle.io.H5Store$.createFile(H5Store.scala:433)
    at .<init>(<console>:10)
    at .<clinit>(<console>)
    at .<init>(<console>:7)
    at .<clinit>(<console>)
    at $print(<console>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734)
    at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983)
    at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)
    at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)
    at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)
    at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
    at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
    at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:889)
    at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
    at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)
    at sbt.Console.console0$1(Console.scala:23)
    at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)
    at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
    at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)

我的系统中安装了这个包,我的 sbt build config 的库依赖项中有这些行:

...
// Saddle
"org.scala-saddle" %% "saddle-core" % "1.2.+",
"org.scala-saddle" %% "saddle-hdf5" % "1.2.+",
"org.scala-saddle" %% "jhdf5"       % "2.9",
...

我需要什么才能让它工作?

谢谢。

4

1 回答 1

2

完整说明在这里 - http://blog.adamdklein.com/?p=661

总共:

如果你运行 sbt -> console,并查看你的 java.library.path,你可能会看到如下内容:

scala> println(System.getProperty("java.library.path")) 
.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

所以我在 /usr/lib/java 中添加了一些符号链接:

lrwxr-xr-x  1 root  wheel     78 Jul  8 13:29 libjhdf5.jnilib@ -> <dir>/libjhdf5.jnilib

其中 dir 替换为 hdf5 二进制库的路径。

鞍的注意事项,你只需要 libjhdf5.jnilib

于 2013-06-05T12:58:02.093 回答