User Error: Prover 'alt-ergo' not found in why3.conf - frama-c

I am trying to test a function with Frama-c:
/*#
ensures \result >= x && \result >= y;
ensures \result == x || \result == y;
*/
int max( int x, int y){
return (x>y) ? x : y;
}
After I installed all the requirements: OPAM, why3, alt-ergo
Whenever I execute frama-c -wp fct.c I receive:
[kernel] Parsing fct.c (with preprocessing)
[wp] Warning: Missing RTE guards
[wp] User Error: Prover 'alt-ergo' not found in why3.conf
[wp] Goal typed_max_ensures : not tried
[wp] Goal typed_max_ensures_2 : not tried
[wp] User Error: Deferred error message was emitted during execution.
See above messages for more information.
[kernel] Plug-in wp aborted: invalid user input.

As mentioned in Frama-C's installation instructions, why3 must be explicitely configured to check for available provers, through the why3 config --detect command (Note that, depending on the exact version of Why3 that you have installed, you might also use why3 config --full-config instead). You should see an output like:
Found prover Alt-Ergo version 2.0.0, OK.
... possibly other provers if you have installed them
Save config to /PATH/TO/HOME/.why3.conf
After that, you will be able to use the provers in Frama-C/WP

Related

mypy throws "error: Too many arguments for 'object'" on pre-commit hook run but not on local run

from typing import Callable, Type, TypeVar
T = TypeVar("T")
def repo(class_: Type[T]) -> Callable:
def instantiate(*args, **kwargs) -> T:
return class_(*args, **kwargs)
return instantiate
Code above throws "error: Too many arguments for 'object'" on pre-commit hook run but not on local run (python poetry run mypy repo.py).
Neither error message nor difference of behaviour between hook and local run make sense to me.
Any clue?
Thanks.
you've got a version mismatch between your two environments.
the one that is failing is mypy<=0.910:
$ mypy --version
mypy 0.910
$ mypy t.py
t.py:7: error: Too many arguments for "object"
Found 1 error in 1 file (checked 1 source file)
the one that's passing is mypy>0.910
$ mypy --version
mypy 0.971 (compiled: yes)
$ mypy t.py
Success: no issues found in 1 source file

implicit declaration of function Error when building CPython on MacOS

I'm trying to build CPython from its 3.9 branch on a MacOS machine, but I'm getting the following errors when I run make -j2 -s:
./Modules/posixmodule.c:7192:9: error: implicit declaration of function 'openpty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0)
^
./Modules/posixmodule.c:7192:9: note: did you mean 'openat'?
/usr/include/sys/fcntl.h:516:5: note: 'openat' declared here
int openat(int, const char *, int, ...) __DARWIN_NOCANCEL(openat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
^
./Modules/posixmodule.c:7192:9: warning: this function declaration is not a prototype [-Wstrict-prototypes]
if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0)
^
./Modules/posixmodule.c:7293:11: error: implicit declaration of function 'forkpty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
pid = forkpty(&master_fd, NULL, NULL, NULL);
^
./Modules/posixmodule.c:7293:11: warning: this function declaration is not a prototype [-Wstrict-prototypes]
2 warnings and 2 errors generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
My Makefile was generated by running the following command:
CPPFLAGS="-I$(brew --prefix zlib)/include" \
LDFLAGS="-L$(brew --prefix zlib)/lib" \
./configure --with-openssl=$(brew --prefix openssl) \
--with-pydebug
Do you have any idea of what could be wrong or missing?
Update:
Apparently, this is a known and unresolved issue. https://bugs.python.org/issue34027
I've been plagued by this problem on a few different systems. In any case, I tried again, and found this GitHub issues thread for pyenv which had a lot of suggestions. In the end, this worked for me:
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk pyenv install 3.10.0
Since this original question was not about pyenv I gave it a try separately. I was able to get through make but not make test and, unfortunately, I don't have time to sleuth it all out, but maybe this will help someone anyway.

Julia 0.4.5: libz fails to load on Ubuntu

While I was attempting to use Requests in Julia, the following error was output:
julia> using Requests
INFO: Precompiling module Requests...
ERROR: LoadError: LoadError: error compiling version: could not load library "libz"
libz: cannot open shared object file: No such file or directory
while loading /home/michael/.julia/v0.4/Libz/src/lowlevel.jl, in expression starting on line 110
while loading /home/michael/.julia/v0.4/Libz/src/Libz.jl, in expression starting on line 11
ERROR: LoadError: Failed to precompile Libz to /home/michael/.julia/lib/v0.4/Libz.ji
while loading /home/michael/.julia/v0.4/Requests/src/Requests.jl, in expression starting on line 27
ERROR: Failed to precompile Requests to /home/michael/.julia/lib/v0.4/Requests.ji
in compilecache at ./loading.jl:400
I'm not knowledgeable enough in Julia to discern exactly what is happening, but here is the code from Libz.jl (line 11)...
include("lowlevel.jl")
...from lowlevel.jl (lines 103-110)...
# Functions
# ---------
function version()
return unsafe_string(ccall((:zlibVersion, zlib), Ptr{UInt8}, ()))
end
const zlib_version = version()
...and from Requests.jl (line 27)
using Libz
This problem has persisted after I've removed then reinstalled Libz, MbedTLS, and Requests, and after I've Pkg.update()'ed and restarted julia and my computer. Is anyone well enough versed in Julia to know how to fix this?
Per the comment by Gnimuc K and a tiny bit more research:
sudo apt-get install zlib1g-dev
installs zlib, which Julia needed. Once it was installed...
julia> Pkg.update()
julia> Pkg.build("Libz")
worked all the kinks out.

Why3 is unable to run prover on windows via cygwin

I am trying to use cvc4 prover with Frama-c wp plugin through Why3 on Windows environment. I have frama-c and why3 installed on my system. Why3 is configured properly to include cvc4 as a prover :
$ why3 --list-provers
Known provers:
Alt-Ergo (0.95.2)
CVC4 (1.4)
I used frama-c Wp plugin to generate why3 format (.why) file corresponding to my .c file (C source file with ACSL Specifications) with following command:
frama-c -wp -wp-print -wp-proof-trace -wp-out C:/Users/user/temp -wp-prover cvc4 swap.c
The above command generate a file swap_Why3_ide.why in C:/Users/user/temp/typed directory.
When I try to prove Theories in generated swap_Why3_ide.why file using why3 with cvc4 as prover it fails with following error:
$ why3 prove -P cvc4 -L C:/cygwin/usr/local/share/frama-c/wp/why3 temp/typed/swap_Why3_ide.why
temp/typed/swap_Why3_ide.why VCswap_post WP : HighFailure (0.02s)
Prover exit status: exited with status 1
Prover output:
/usr/local/lib/why3/why3-cpulimit: Error: failed when launching <"/cygdrive/c/cvc4-1.4-win32-opt.exe" "--lang=smt2" "/tmp/why_29ba75_swap_Why3_ide-T-WP.smt2">
Fatal: CreateProcess failed with error 0: The operation completed successfully.
I performed same steps on a linux environment and why3 was able to execute prover:
why3 prove -P cvc4 -L /usr/local/share/frama-c/wp/why3/ temp/typed/swap_Why3_ide.why
temp/typed/swap_Why3_ide.why VCswap_post WP : Valid (0.05s)
Can anyone suggest how to execute Why3 on windows?
It seems like no one is using why3 on Windows. But anyways, for anyone who will try to use Why3 on windows in future, here are steps I performed to run a prover on theories in a .why file:
1) On Windows, even if provers are installed, executing why3 config --detect will not add provers. So when executing why3 config --detect --add-prover cvc4 path_to_executable_in_Windows_format make sure that path to executable is in windows format( for example C:\provers\cvc4-1.4-win32-opt.exe)
If path is not in windows format, following error is thrown:
/usr/local/lib/why3/why3-cpulimit: Error: failed when launching <"/cygdrive/c/cvc4-1.4-win32-opt.exe" "--lang=smt2" "/tmp/why_29ba75_swap_Why3_ide-T-WP.smt2">
Fatal: CreateProcess failed with error 0: The operation completed successfully.
2) After setting path to provers properly, try to execute why3 as follows:
why3 prove -P cvc4 -L C:/cygwin/usr/local/share/frama-c/wp/why3 C:/temp/typed/swap_Why3_ide.why
This will throw following error:
C:/temp/typed/swap_Why3_ide.why VCswap_post WP : HighFailure (0.03s)
Prover exit status: exited with status 1
Prover output:
(error "Couldn't open file: /tmp/why_727ef8_swap_Why3_ide-T-WP.smt2")
why3cpulimit cpu time: 0.015625s wall time: 0.015625s
This error is occurring because why3 generates *.smt2 files in cygwin tmp directory (/tmp) and when provers are called over these files complete path to these files in not provided and prover complain that it Couldn't open file /tmp/XX.smt2
To fix this I had to update command executed to run prover in .why3.conf as following:
[prover]
command = "%l/why3-cpulimit %t %m -s C:/provers/cvc4-1.4-win32-opt.exe --lang=smt2 C:/cygwin%f
driver = "/usr/local/share/why3/drivers/cvc4.drv"
editor = ""
in_place = false
interactive = false
name = "CVC4"
shortcut = "cvc4"
version = "1.4"
Note that I changed the file format from %f to C:/cygwin%f which is windows path to /tmp directory

Nginx-gridfs compiling #error must have a 64bit int type in Mac

running 10.7.2 follow the guide configure than append CFLAGS=-Wno-error to bypass the error, than I got stuck at
In file included from /usr/local/src/nginx-gridfs/mongo-c-driver/src/bson.h:24,
from /usr/local/src/nginx-gridfs/mongo-c-driver/src/mongo.h:24,
from /usr/local/src/nginx-gridfs/ngx_http_gridfs_module.c:43:
/usr/local/src/nginx-gridfs/mongo-c-driver/src/platform.h:50:2: error: #error must have a 64bit int type
make[1]: *** [objs/addon/nginx-gridfs/ngx_http_gridfs_module.o] Error 1
make: *** [build] Error 2
any idea?
I have had the same problem when compiling for Windows. You need to ensure you have a typedef for int64_t and uint64_t.
In order to address I needed to ensure that MONGO_USE__INT64 was defined.
For Mac you almost certainly have unistd.h available - so ensure you define MONGO_HAVE_UNISTD

Resources