eaplatanios / tensorflow_scala

TensorFlow API for the Scala Programming Language
http://platanios.org/tensorflow_scala/
Apache License 2.0
936 stars 95 forks source link

Error when compile code from my forked repo #71

Closed lucataglia closed 6 years ago

lucataglia commented 6 years ago

I'm try to write some examples that I will push on my forked repo and that made a Pull Request but I can't compile your code. These are the step I follow:

  1. git clone
  2. open intellij
  3. import project with sbt 1.1.0

ERROR

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
[info] Loading settings from idea.sbt ...
[info] Loading global plugins from /Users/databiz/.sbt/1.0/plugins
[info] Loading project definition from /Users/databiz/Desktop/tensorflowHome/tensorflow_scala/project/project
[info] Updating ProjectRef(uri("file:/Users/databiz/Desktop/tensorflowHome/tensorflow_scala/project/project/"), "tensorflow_scala-build-build")...
[info] Done updating.
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /Users/databiz/Desktop/tensorflowHome/tensorflow_scala/project
[warn] there was one feature warning; re-run with -feature for details
[warn] one warning found
[info] Loading settings from version.sbt,build.sbt ...
[info] Set current project to TensorFlow for Scala (in build file:/Users/databiz/Desktop/tensorflowHome/tensorflow_scala/)
[info] sbt server started at local:///Users/databiz/.sbt/1.0/server/906ae31cea2e22def755/sock
sbt:TensorFlow for Scala>
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile, shellPrompt
[info] The new values will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to TensorFlow for Scala (in build file:/Users/databiz/Desktop/tensorflowHome/tensorflow_scala/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/databiz/Library/Application Support/IntelliJIdea2017.2/Scala/launcher/sbt-structure-1.1.jar
[error] java.lang.ClassNotFoundException: org.jetbrains.sbt.CreateTasks$
[error]     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     at java.lang.Class.forName0(Native Method)
[error]     at java.lang.Class.forName(Class.java:348)
[error]     at sbt.internal.inc.ModuleUtilities$.getObject(ModuleUtilities.scala:20)
[error]     at sbt.BasicCommands$.$anonfun$call$5(BasicCommands.scala:203)
[error]     at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
[error]     at scala.collection.immutable.List.foreach(List.scala:389)
[error]     at scala.collection.TraversableLike.map(TraversableLike.scala:234)
[error]     at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
[error]     at scala.collection.immutable.List.map(List.scala:295)
[error]     at sbt.BasicCommands$.$anonfun$call$2(BasicCommands.scala:203)
[error]     at sbt.Command$.$anonfun$applyEffect$4(Command.scala:134)
[error]     at sbt.Command$.$anonfun$applyEffect$2(Command.scala:130)
[error]     at sbt.MainLoop$.processCommand(MainLoop.scala:153)
[error]     at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:136)
[error]     at sbt.State$$anon$1.runCmd$1(State.scala:242)
[error]     at sbt.State$$anon$1.process(State.scala:248)
[error]     at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:136)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]     at sbt.MainLoop$.next(MainLoop.scala:136)
[error]     at sbt.MainLoop$.run(MainLoop.scala:129)
[error]     at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:107)
[error]     at sbt.io.Using.apply(Using.scala:22)
[error]     at sbt.MainLoop$.runWithNewLog(MainLoop.scala:101)
[error]     at sbt.MainLoop$.runAndClearLast(MainLoop.scala:57)
[error]     at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:42)
[error]     at sbt.MainLoop$.runLogged(MainLoop.scala:34)
[error]     at sbt.StandardMain$.runManaged(Main.scala:113)
[error]     at sbt.xMain.run(Main.scala:76)
[error]     at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]     at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]     at xsbt.boot.Launch$.run(Launch.scala:109)
[error]     at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]     at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]     at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]     at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error]     at xsbt.boot.Boot$.main(Boot.scala:17)
[error]     at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.ClassNotFoundException: org.jetbrains.sbt.CreateTasks$
[error] Use 'last' for the full log.
[info] shutting down server

Then I try to:

  1. manually modify project/build.properties in order to set the sbt version to 1.0.4
  2. import project inside intellij
  3. modify back the sbt version to 1.1.0 modifying project/build.properties
  4. from terminal execute the following command: sbt clean cleanFiles reload compile

ERROR

[error] Undefined symbols for architecture x86_64:
[error]   "_TFE_DeleteContextOptions", referenced from:
[error]       _Java_org_platanios_tensorflow_jni_Tensor_00024_eagerAllocateContext in tensor.cc.o
[error]   "_TFE_NewContextOptions", referenced from:
[error]       _Java_org_platanios_tensorflow_jni_Tensor_00024_eagerAllocateContext in tensor.cc.o
[error]   "tensorflow::Graph::AddControlEdge(tensorflow::Node*, tensorflow::Node*, bool)", referenced from:
[error]       tensorflow::AddControlInput(TF_Graph*, TF_Operation*, TF_Operation*) in python_api.cc.o
[error]   "tensorflow::Graph::RemoveControlEdge(tensorflow::Edge const*)", referenced from:
[error]       tensorflow::ClearControlInputs(TF_Graph*, TF_Operation*) in python_api.cc.o
[error] ld: symbol(s) not found for architecture x86_64
[error] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[error] make[2]: *** [libtensorflow_jni.so] Error 1
[error] make[1]: *** [CMakeFiles/tensorflow_jni.dir/all] Error 2
[error] make: *** [all] Error 2
[error] java.lang.RuntimeException: Failed to build the native library. Exit code: 2.
[error]     at scala.sys.package$.error(package.scala:27)
[error]     at BuildTool$ConfigureMakeInstall$Instance.libraries(BuildTool.scala:61)
[error]     at BuildTool$ConfigureMakeInstall$Instance.libraries$(BuildTool.scala:58)
[error]     at BuildTool$CMake$$anon$3.libraries(BuildTool.scala:113)
[error]     at JniNative$.$anonfun$settings$13(JniNative.scala:92)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error]     at sbt.std.Transform$$anon$4.work(System.scala:66)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]     at sbt.Execute.work(Execute.scala:271)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]     at java.lang.Thread.run(Thread.java:748)
[error] (jni / nativeCompile) Failed to build the native library. Exit code: 2.
[error] Total time: 50 s, completed Jan 24, 2018 5:38:45 PM

I'm using macOS HighSierra I installed libtensorflow with brew and I have under /usr/local/lib libtensorflow.so and libtensorflow_framework.so

eaplatanios commented 6 years ago

@lucaRadicalbit This is because the current source code only supports the current master branch of TensorFlow. You were probably trying to compile with an older version. I think that if you install the latest version of libtensorflow, the library might compile fine. Otherwise, you should try to compile libtensorflow from the TensorFlow master branch sources and everything will work fine.