Closed folone closed 10 years ago
Which version of mac osx are you using ?
10.9.3, gcc version is:
$ gcc --version
gcc (Homebrew gcc 4.8.3_1) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Can you try doing:
$ scala -cp path/to/scalaz3.jar
scala> new z3.scala.Z3Context
You should be getting an error, but I would be interested in what this error will be. Can you also do the same with the released osx jar?
The error is:
scala> new z3.scala.Z3Context
java.lang.UnsatisfiedLinkError: no scalaz3 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at z3.Z3Wrapper.loadFromJar(Z3Wrapper.java:97)
at z3.Z3Wrapper.<clinit>(Z3Wrapper.java:47)
at z3.scala.Z3Config.<init>(Z3Config.scala:6)
at z3.scala.Z3Context.<init>(Z3Context.scala:31)
... 32 elided
Where can I find the released osx jar?
It can be found under "Releases":
Oh, thanks. Same error:
$ scala -cp scalaz3-osx-64b-2.1.1.jar
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> new z3.scala.Z3Context
java.lang.UnsatisfiedLinkError: no scalaz3 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at z3.Z3Wrapper.loadFromJar(Z3Wrapper.java:97)
at z3.Z3Wrapper.<clinit>(Z3Wrapper.java:47)
at z3.scala.Z3Config.<init>(Z3Config.scala:6)
at z3.scala.Z3Context.<init>(Z3Context.scala:31)
... 32 elided
We actually just noticed that OS X has user-specific temporary folders, which could explain why the jar release doesn't work. However this doesn't tell us why the library cannot be found when you package the tool yourself. From your error messages, I see that both libraries (libscalaz3.dylib
and libz3.dylib
) should be extracted into /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_61f7962552d79e96a73fe47615a6b35d/lib-bin/
on your computer. Is this indeed the case?
@koksal Looks like it is not there. I've tried to re-run sbt package
, and look into the directory it mentions in -install_name
flag, empty:
$ ls /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_61f7962552d79e96a73fe47615a6b35d/lib-bin/
ls: /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_61f7962552d79e96a73fe47615a6b35d/lib-bin/: No such file or directory
What happens is that SBT will in advance get the tpmdir so that it can predict where the dylibs will be extracted to when first executing the jar.
Can you make sure the tmpdir obtained within SBT (apparent in the commands it outputs), is the same than the runtime one you obtain using
$ scala -e 'println(System.getProperty("java.io.tmpdir"));'
Seems to be the same directory. Here's the gcc command that sbt performs:
$ gcc -o /Users/georgii/workspace/ScalaZ3/lib-bin/libscalaz3.dylib -dynamiclib -install_name /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_61f7962552d79e96a73fe47615a6b35d/lib-bin/libscalaz3.dylib -I/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/../include -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -I/Users/georgii/workspace/ScalaZ3/z3/4.3-osx-64b/include -L/Users/georgii/workspace/ScalaZ3/z3/4.3-osx-64b/lib -g -lc -Wl,-rpath,/var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_61f7962552d79e96a73fe47615a6b35d/lib-bin/ -lz3 -fPIC -O2 -fopenmp /Users/georgii/workspace/ScalaZ3/src/c/casts.c /Users/georgii/workspace/ScalaZ3/src/c/extra.c /Users/georgii/workspace/ScalaZ3/src/c/z3_thycallbacks.c /Users/georgii/workspace/ScalaZ3/src/c/z3_Z3Wrapper.c
Here's result of checking the tmpdir:
$ scala -e 'println(System.getProperty("java.io.tmpdir"));'
/var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/
Here is a few steps to try:
1) delete everything scalaz3 might have extracted so far:
rm -rf /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_*
2) run
$ scala -Dscalaz3.debug.load=1 -cp path/to/built/scalaz3.jar
scala> new z3.Z3Wrapper
you should then see something looking like:
Extracting lib-bin/libz3.dylib from jar to libz3.dylib...
Extracting lib-bin/libscalaz3.dylib from jar to libscalaz3.dylib...
Loading scalaz3
<the error>
3) check the content of the extracted dir:
$ ls -alR /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_*
I'm really confused right now: somehow it just started working. I don't really know what I did. The only thing I recall was rebooting. I'm getting a persistent segfault in Calendar
test (everything passes if I disable it), but tests don't fail with the old linkage error any more.
$ rm -rf /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_*
zsh: no matches found: /var/folders/0b/7l03y9g17rldj97z8_ygqgmc0000gp/T/SCALAZ3_*
$ scala -Dscalaz3.debug.load=1 -cp target/scala-2.10/scalaz3_2.10-2.1.jar
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> new z3.Z3Wrapper
Extracting lib-bin/libz3.dylib from jar to libz3.dylib...
Extracting lib-bin/libscalaz3.dylib from jar to libscalaz3.dylib...
Loading scalaz3
res0: z3.Z3Wrapper = z3.Z3Wrapper@2c19cee5
scala> :q
$ sbt
[info] Loading project definition from /Users/georgii/workspace/ScalaZ3/project
[info] Compiling 1 Scala source to /Users/georgii/workspace/ScalaZ3/project/target/scala-2.10/sbt-0.13/classes...
[info] Set current project to ScalaZ3 (in build file:/Users/georgii/workspace/ScalaZ3/)
> test
[info] Compiling 10 Scala sources to /Users/georgii/workspace/ScalaZ3/target/scala-2.10/test-classes...
[warn] /Users/georgii/workspace/ScalaZ3/src/test/scala/z3/scala/ADTs.scala:111: method delete in class Z3Model is deprecated: Z3Model.delete() not be used, use incref/decref instead
[warn] model.delete
[warn] ^
[warn] /Users/georgii/workspace/ScalaZ3/src/test/scala/z3/scala/IntArith.scala:43: method delete in class Z3Model is deprecated: Z3Model.delete() not be used, use incref/decref instead
[warn] model.delete
[warn] ^
[warn] two warnings found
[info] NQueens:
[info] - NQueens
[info] IntArith:
[info] - Comfusy-like
[info] Core:
[info] - Core
[info] ForComprehension:
[info] - ForComprehension
[info] Quantifiers:
[info] - Quantifiers
[info] SatSolver:
[info] - Sat solver
[info] Arrays:
[info] - Arrays
[info] ADTs:
[info] - ADTs
[info] Sets:
[info] - Sets
[info] Calendar:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000011ddad5d5, pid=11224, tid=6403
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C [libz3.dylib+0x9f45d5] mpz_manager<true>::gcd(mpz const&, mpz const&, mpz&)+0x125
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/georgii/workspace/ScalaZ3/hs_err_pid11224.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Exception in thread "Thread-1" java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2598)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1318)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
at sbt.React.react(ForkTests.scala:110)
at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:69)
at java.lang.Thread.run(Thread.java:744)
[error] Error: Total 0, Failed 0, Errors 0, Passed 0
[error] Error during tests:
[error] Running java with options -classpath /Users/georgii/workspace/ScalaZ3/target/scala-2.10/test-classes:/Users/georgii/workspace/ScalaZ3/target/scala-2.10/scalaz3_2.10-2.1.jar:/Users/georgii/.sbt/boot/scala-2.10.2/lib/scala-library.jar:/Users/georgii/.ivy2/cache/org.scalatest/scalatest_2.10/jars/scalatest_2.10-1.9.1.jar:/Users/georgii/.ivy2/cache/org.scala-lang/scala-actors/jars/scala-actors-2.10.0.jar:/Users/georgii/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.0.jar:/Users/georgii/.sbt/boot/scala-2.10.2/org.scala-sbt/sbt/0.13.0/test-agent-0.13.0.jar:/Users/georgii/.sbt/boot/scala-2.10.2/org.scala-sbt/sbt/0.13.0/test-interface-1.0.jar sbt.ForkMain 57368 failed with exit code 134
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 10 s, completed Jun 18, 2014 11:43:32 AM
If the SCALAZ3_..
directory exists, it won't extract anything. So if for some obscure reason the extraction initially failed, it will never try again as long as it finds this SCALAZ3
directory. As far as the segfault is concerned, which version of z3 did you download/compile? Latest unstable?
Probably that. Thanks a lot for your help with this!
Hello,
I'm having a problem with the final step of the installation guide. Packaging seems to work correclty (at least I don't see any errors):
But then tests don't work at all:
Exceptions are all same, here's one of them:
Any help really appreciated!