I am trying to develop a plugin to frama-c.
I did build the application, which has several files, and then created the makefile referencing all the files i needed.
I am able to use make and then make install and execute the plugin. My problem appears when i call functions from the ocamlyices library in a function...
I am still able to do the make and make install and when i try to execute i get the following error:
[kernel] warning: cannot load plug-in 'name' (incompatible with Fluorine-20130601).
[kernel] user error: option `<name>' is unknown.
use `frama-c -help' for more information.
[kernel] Frama-C aborted: invalid user input.
So it says it is incompatible when I add the call to ocamlyices functions. Is there any option/configuration I am missing somewhere?
Thank you for your help.
The final solution looked like this:
FRAMAC_SHARE := $(shell frama-c.byte -print-path)
FRAMAC_LIBDIR := $(shell frama-c.byte -print-libpath)
PLUGIN_NAME = Fact
# All needed files
PLUGIN_CMO = ../base/basic_types concolic_search run_fact ../lib/lib
PLUGIN_DOCFLAGS = -I ../base -I ../lib -I $(YICES) -I /usr/lib/ocaml/batteries -I ../instrumentation
PLUGIN_BFLAGS = -I ../base -I ../lib -I $(YICES) -I ../instrumentation
PLUGIN_OFLAGS = -I ../base -I ../lib -I $(YICES) -I ../instrumentation
PLUGIN_EXTRA_BYTE = $(YICES)/ocamlyices.cma
PLUGIN_EXTRA_OPT = $(YICES)/ocamlyices.cmxa
include $(FRAMAC_SHARE)/Makefile.dynamic
The variable $(YICES) is defined as
export YICES="/usr/local/lib/ocaml/3.12.1/ocamlyices"
As mentioned by Anne, if your plug-in uses an external library that is not already included by Frama-C itself, you need a few more steps than for a basic plug-in, especially setting PLUGIN_EXTRA_BYTE and PLUGIN_EXTRA_OPT to the external libraries that you want to be linked to your plug-in. It might also be necessary to adapt the flags passed to the linker with PLUGIN_LINK_BFLAGS and PLUGIN_LINK_OFLAGS, but this is heavily dependent on ocamlyices itself. More information on the variables that can be used to customize the compilation of your plug-in can be found in section 5.3.3 of Frama-C's development guide.
Related
I created new question, because I felt the previous one had been answered and this belongs in a new place.
I run bitbake core-image-minimal and I get the following error:
ERROR: systemd-1_232-r0 do_patch: Command Error: 'quilt --quiltrc /home/rama/repositories/poky/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/systemd/1_232-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0 Output:
Applying patch 0001-systemd-udevd.service.in-set-MountFlags-shared.patch
patching file units/systemd-udevd.service.in
Hunk #1 FAILED at 21.
1 out of 1 hunk FAILED -- rejects in file units/systemd-udevd.service.in
Patch 0001-systemd-udevd.service.in-set-MountFlags-shared.patch does not apply (enforce with -f)
ERROR: systemd-1_232-r0 do_patch: Function failed: patch_do_patch
ERROR: Logfile of failure stored in: /home/rama/repositories/poky/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/systemd/1_232-r0/temp/log.do_patch.5314
ERROR: Task (/home/rama/repositories/poky/meta/recipes-core/systemd/systemd_232.bb:do_patch) failed with exit code '1'
I located the place where the patch is written in file meta-toradex/recipes-core/systemd/systemd_%.bbappend :
FILESEXTRAPATHS_prepend := "${THISDIR}/systemd:"
SRC_URI += " \
file://rndis.network \
file://0001-systemd-udevd.service.in-set-MountFlags-shared.patch \
"
PACKAGECONFIG_append = " networkd"
do_install_append() {
# The network files need to be in /usr/lib/systemd, not ${systemd_unitdir}...
install -d ${D}${prefix}/lib/systemd/network/
install -m 0644 ${WORKDIR}/rndis.network ${D}${prefix}/lib/systemd/network/
}
FILES_${PN} += " \
${nonarch_base_libdir}/systemd/network \
I was told that I can :
Remove the patch.
Apply it manually.
To remove the path, Should I just remove it from SRC_URI list?
How does one apply patch manually? I tried to google this, I did not quite get how this can be done.
Any help is appreciated, Thank you.
When looking at repo manifest, meta-toradex is not used, and in meta-toradex, it says oe-core BSP layer (obsolete). I think you're not using the right environment.
Nevertheless, if you want to check patch problem, you can use devshell with bitbake -c devshell systemd, then type quilt push in new console. You then need to analyze with patch fails to apply by looking at patch file and corresponding source code.
You should not modify existing layer, and create your own layer overriding recipes, but if you want to, you can indeed remove patch to SRC_URI, then use bitbake -c clean systemd; bitbake systemd and it should be OK.
In Toradex developer knowledge-base, if you are making a new environment, i think you need to look at V2.1 and Later Images section.
Does anyone know if it is possible to have binary code from IR generated with llvmlite? in llvm, we can simply clang -emit-llvm -o foo.bc -c foo.c. What if I am using llvmlite?
As far as I can tell, llvmlite doesn't include a linker. You can write object code with, for example,
target = llvm.Target.from_default_triple()
machine = target.create_target_machine()
with llvm.create_mcjit_compiler(module, target) as mcjit:
def on_compiled(module, objbytes):
open('mymodule.o', 'w').write(objbytes)
mcjit.set_object_cache(on_compiled, lambda m: None)
mcjit.finalize_object()
And then use your standard linker ld, which usually you would have via gcc or clang to link the object file. LLVM 4 seems to ship with its own linker lld which is an option to use manually but llvmlite isn't on version 4 and wouldn't be able to expose that functionality.
On my machine for example, I can run from bash
$ gcc -o llvmapp mymodule.o
$ ./llvmapp
It appears the easiest solution thus far is directly write all your code in python, but it comes at the cost of run time, which I know some people don't care about.
Unfortunately, I would have to agree with #Jimmy. I haven't seen anything yet and it is 2019 which is 2 years later and still nothing.
I am new to Frama-C. I would like to run it under Windows enviroments. My compiler is gcc,mingw.
I have tryied to run same examples from Value Analysis tutorial by I have a problem with library header files.
I've found that it's not possible to run frama-c because restrict keyword. It shows error in string.h file
void * __cdecl memcpy(void * __restrict__ _Dst,const void * __restrict__ _Src,size_t _Size) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
When I manually add #define restrict to all *.c files in SkeinProject
schneier.com/code/skein_NIST_CD_102610.zip
everything works correcly. By doing it by hand is not what I'm looking for.
Next step was to add argument -D__restrict__
frama-c -cpp-extra-args=-D__restrict__ -main=Init -val SHA3api_ref.c
[kernel] preprocessing with "gcc -C -E -I. -D__restrict__ SHA3api_ref.c"
../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/string.h:41:[kernel] user error: syntax error
[kernel] user error: skipping file "SHA3api_ref.c" that has errors.
[kernel] Frama-C aborted because of an invalid user input.
I've also generated precompiled *.i files but error still the same.
gcc -E -D__restrict__ SHA3api_ref.c >SHA3api_ref.i
frama-c -main=Init -val SHA3api_ref.i
../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/string.h:41:[kernel] user error: syntax error
[kernel] user error: skipping file "SHA3api_ref.i" that has errors.
[kernel] Frama-C aborted because of an invalid user input.
What can I do with it?
Your system headers contain non-standard syntax extensions that are not supported by Frama-C. This is normal, as the headers are often provided as part of a complete package with the compiler, so the headers and the compiler only need to work together, not to work with all the other programs that take C source code as input.
Generally speaking, you should always use the headers provided with Frama-C
instead of those from your system.
When using GCC or a compatible compiler such as Clang, this involves
passing the pre-processor the options -nostdinc and -I... where ...
stands for the place where Frama-C's headers were installed. This
location can be obtained from Frama-C with the option -print-share-path.
All in all, on a Unix system, it may look like:
frama-c -cpp-extra-args=-nostdinc -cpp-extra-args=-I`frama-c -print-share-path`/libc .....
Doing the same thing with Windows and MinGW follows the same idea but sometimes involves extra trouble due to the perpetual ambiguity between \ and / as directory separators.
Recently, Frank Dordowsky has been having trouble with using a very new GCC version to pre-process C files for Frama-C. That was only when using -pp-annot, but in any case, the solution was to switch to Clang as pre-processor.
I am a new user of Ocaml-java (or Cafesterol) which compiles primtive Ocaml program to executable jar that is allowed run on JVM. However when I try to compile a test program into executable jar I got error info as follow:
>java -jar ~/ocaml-project/ocamljava-bin-1.4/bin/ocamljava.jar -standalone regexdna.ml -o regexdna.jar
File "regexdna.ml", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Str referenced from regexdna.cmj
Unix referenced from regexdna.cmj
It seems module Str and Unix is missing from Ocaml-java. However, str.jar and unix.jar do exist under ~/ocaml-project/ocamljava-bin-1.4/lib/others/ when I install Ocaml-java, and within these jars we do have Str.class and Unix.class. (I suppose this directory is on the path of the standard library of Ocaml-java, so it should be included in default search path)
Can any Ocaml-java user tell me how Ocaml-java search for dependency libraries?
Quoting Xavier Clerc on this :
Well it should work, but you have to pass explicitly the referenced
library (just as in vanilla OCaml). Leading in your case to:
$ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar ~/opt/ocamljava-2.0-early-access9/lib/ocamljava.jar str.cmja regexdna.ml
Note that I am using the latest ocamljava preview.
I am trying to install R package on AIX5.3. I've two queries regarding it:
I followed Fan Long's steps. I installed the GNU utilities: libiconv and gettext also. However, on running
./configure --with-libpth-prefix=/home/jayant/utils --disable-nls --without-libintl-prefiX --with-included-gettext=home/jayant/utils --with-blas="-llapack -lessl -lblas" --prefix=home/jayant/R-2.15.3
I get the following error:
"sys-std.c", line 893.13: 1506-045 (S) Undeclared identifier rl_readline_name.
Native 'sed' on aix does not support '-e' option. I installed sed from GNU utilities. In the configure script, how should I force it to take my sed instead of the native one. I tried
export sed=/home/jayant/sed-4.2/bin/sed.
but it does'nt work?
You need to ensure that the desired sed gets picked up. Say:
PATH=/home/jayant/sed-4.2/bin:${PATH} ./configure ...
Or if you want to add it to the PATH, say:
PATH=/home/jayant/sed-4.2/bin:${PATH}; export PATH
(Add it to your ${HOME}/.bashrc if you so desire.)