Rstudio problems about Knit to pdf - r-markdown

I'm still getting the error:
Error in contrib.url (repos, "source"): trying to use Cran without setting a mirror Calls: withVisible -> eval -> eval -> install.oackages -> contrib.url Execution halted.

Related

How to force ppx to use an OCaml version?

I have the below OCaml file which compiles correctly without ppx and fails with this dune file
(library
(name so_proj)
(preprocess
(pps
ppx_inline_test
ppx_deriving.show
ppx_deriving.ord
ppx_deriving.map
ppx_deriving.eq
ppx_deriving.fold
ppx_deriving.iter)))
and works with
(library
(name so_proj))
the error being
File "SO_naming_existential.ml", line 23, characters 16-18:
23 | fun (Mod (type xr) (m : xr)) ->
^^
Error: migration error: existentials in pattern-matching is not supported before OCaml 4.13
here's the OCaml file in question which uses a new syntax (and provides an equivalent - I believe - version when it's not available)
type existentiel = Mod : 'x -> existentiel
module type existentiel_m = sig
type x
val value : x
end
let to_Module : existentiel -> (module existentiel_m) =
fun (Mod m) ->
let namedxr : type xr. xr -> (module existentiel_m) =
fun v ->
(module struct
type x = xr
let value = v
end)
in
namedxr m
(* Since 4.13 https://github.com/ocaml/ocaml/pull/9584 *)
let to_Module2 : existentiel -> (module existentiel_m) =
fun (Mod (type xr) (m : xr)) ->
(module struct
type x = xr
let value = m
end)
To confirm the origin of the error (and to run first for avoiding to waste time..) the command
dune build --verbose points indeed at an error happening in ppx
Running[2]: (cd _build/default && .ppx/0789030747a4993265eb655c993f5cab/ppx.exe --cookie 'inline_tests="enabled"' --cookie 'library-name="so_proj"' -o SO_naming_existential.pp.ml --impl SO_naming_existential.ml -corrected-suffix .ppx-corrected -diff-cmd - -dump-ast)
Command [2] exited with code 1:
$ (cd _build/default && .ppx/0789030747a4993265eb655c993f5cab/ppx.exe --cookie 'inline_tests="enabled"' --cookie 'library-name="so_proj"' -o SO_naming_existential.pp.ml --impl SO_naming_existential.ml -corrected-suffix .ppx-corrected -diff-cmd - -dump-ast)
File "SO_naming_existential.ml", line 23, characters 16-18:
23 | fun (Mod (type xr) (m : xr)) ->
^^
Error: migration error: existentials in pattern-matching is not supported before OCaml 4.13
Can one force ppx to use 4.13, or get a warning when a ppx is not compatible with a given version ? (or is it a bug ?)
An executable or a library could only be composed of compilation units that are compiled by the same compiler. In other words, you can't build some parts of your project with one compiler and the other parts with another.
When you compile an OCaml project using dune the compiler is searched in the in the directories specified in your PATH variable (in Linux). You can see which compiler is selected using the shell command which ocaml. And ocaml -version will tell you its version.
If you're using opam (most likely you are), then you can install the required version of the compiler using the following shell command,
opam switch create 4.13.1
once it is finished, activate the created switch with
eval $(opam env)
This will ensure that the newly installed version of OCaml is available in your path. Double-check that using which ocaml and ocaml -version.
Finally, install the dependencies required by your project with opam install and rebuild the project.

Z3 bindings on ocaml

I am currently using ocaml 4.06.0 and I am trying to use the Z3 sat solver. I am using opam's oasis to compile the files (which is building everything successfully). However, when I run the native code produced I am getting the following error: error while loading shared libraries: libz3.so. I tried reinstalling the z3 package but the error still persists. Can anyone help me solve this please because I have no idea what else to try?
Here is what I did just now to install z3 under Ubuntu 18.04.1:
$ opam depext conf-gmp.1
$ opam depext conf-m4.1
These installed gmp and m4 outside of opam. Pretty impressive.
$ opam install z3
Now the z3 library is installed so you can use it from OCaml code. But there are no executables installed (that I can find).
$ export LD_LIBRARY_PATH=~/.opam/4.06.0/lib/z3
$ ocaml -I ~/.opam/4.06.0/lib/z3
OCaml version 4.06.0
# #load "nums.cma";;
# #load "z3ml.cma";;
# let ctx = Z3.mk_context [];;
val ctx : Z3.context = <abstr>
The setting of LD_LIBRARY_PATH is what makes it possible to find libz3.so.
This is as far as I got for now. Maybe this will be helpful.
Update
Here is how I compiled and linked a test program.
$ export LD_LIBRARY_PATH=~/.opam/4.06.0/lib/z3
$ cat tz3.ml
let context = Z3.mk_context []
let solver = Z3.Solver.mk_solver context None
let xsy = Z3.Symbol.mk_string context "x"
let x = Z3.Boolean.mk_const context xsy
let () = Z3.Solver.add solver [x]
let main () =
match Z3.Solver.check solver [] with
| UNSATISFIABLE -> Printf.printf "unsat\n"
| UNKNOWN -> Printf.printf "unknown"
| SATISFIABLE ->
match Z3.Solver.get_model solver with
| None -> ()
| Some model ->
Printf.printf "%s\n"
(Z3.Model.to_string model)
let () = main ()
$ ocamlopt -I ~/.opam/4.06.0/lib/z3 -o tz3 \
nums.cmxa z3ml.cmxa tz3.ml
$ ./tz3
(define-fun x () Bool
true)
$ unset LD_LIBRARY_PATH
$ ./tz3
./tz3: error while loading shared libraries: libz3.so:
cannot open shared object file: No such file or directory
It works--i.e., it says that the trivial formula x can be satisfied by making x be true.
Note: initially I thought the setting of LD_LIBRARY_PATH wasn't necessary here. But in later testing I've found that it is necessary. So that is probably the key to your problem.
It's a little cumbersome and error prone to set LD_LIBRARY_PATH for running your programs. It's good enough for personal testing, but probably not for any kind of wider deployment. There are ways to set the search path for shared libraries at link time.
I hope this helps.

Frama-C Aluminum "Unbound module GMenu"

On Fedora 21, I compiled the Frama-C Aluminum distribution from source after installing all its prerequisites. My version of OCaml is 4.02.3. Frama-C and the Frama-C GUI work fine. I am trying to follow section 2.3, "The ViewCfg plug-in" of the Frama-C Plug-In Development Guide. However, in section 2.3.4, "Extending the Frama-C GUI", after I add the GUI extension code and run it using the "-load-script" option, I get the following message:
File "cfg_print.ml", line 87, characters 19-43:
Error: Unbound module GMenu
[kernel] user error: compilation of 'cfg_print.ml' failed
Lines 86-87 read:
let cfg_selector
(popup_factory:GMenu.menu GMenu.factory) main_ui ~button:_ localizable =
I googled "unbound module gmenu" but didn't find anything useful. I also never ran into this error while using the Neon and Sodium versions of Frama-C. Interestingly, if I skip that section and follow section 2.3.5, "Splitting files and writing a Makefile", I no longer get the "Unbound module GMenu" message, and the example works fine.
If I had to guess, when I use the "-load-script" option, Frama-C (or my version of OCaml, whatever the case may be) apparently cannot find the Gtk libraries for some reason. But if I use make, OCaml can find the Gtk libraries. Is there something possibly wrong with the way I installed Frama-C and/or the Gtk libraries? How can I check this, or more importantly, how can I fix this?
Your Frama-C installation is probably ok. What you observe is a bug that was introduced when we transitioned to OCamlfind. We will fix it for Frama-C Silicium.
In case you really want to use a script, here is the patch that you need to apply to the sources of Frama-C:
--- a/src/kernel_services/plugin_entry_points/dynamic.ml
+++ b/src/kernel_services/plugin_entry_points/dynamic.ml
## -236,7 +236,7 ## let load_script base =
else
Format.fprintf fmt "%s -c" Config.ocamlc ;
Format.fprintf fmt " -w Ly -warn-error A -I %s" Config.libdir ;
- if !Config.is_gui then Format.pp_print_string fmt " -I +lablgtk" ;
+ if !Config.is_gui then Format.pp_print_string fmt " -package lablgtk2" ;
List.iter (fun p -> Format.fprintf fmt " -I %s" p) !load_path ;
Format.fprintf fmt " %s.ml" base ;
Format.pp_print_flush fmt () ;

Cocos2d-x C++ build error on Eclipse ADT

I'm newbie of Cocos2d-x C++. I tried to run then debug the sample code HelloCpp of cocos2d-x 2.2.1 on my Mac. The following is what I did:
1 . Set environment variables: NDK_TOOLCHAIN_VERSION, NDK_ROOT, ANDROID_SDK_ROOT, COCOS2DX_ROOT, ...
I can run build_native.sh from Terminal without errors.
2 . Add C++ classes to project
HelloCpp is a C++ project already so I ignored converting this project to C/C++ project in Eclipse.
C++ classes added to project successfully.
3 . Change the project settings to specify how to run make command
In My project -> Properties -> C/C++ Build -> Builder Setting:
Set "Build command" = /bin/bash ${ProjDirPath}/build_native.sh NDK_DEBUG=1 V=1
In My project -> Properties -> C/C++ Build -> Builder Setting -> Tool Chain Editor:
Set "Current toolchain" = Android GCC
Set "Current builder" = Gnu Make Builder
4 . Run project as an Android Application. I got these errors:
.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 68: mkdir: command not found
.../ADT/adt-bundle-mac-x86_64-20130917/android-ndk-r9b//ndk-build: line 40: dirname: command not found
.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 33: dirname: command not found
.../cocos2d-x-2.2.1/samples/Cpp/HelloCpp/proj.android/build_native.sh: line 52: dirname: command not found
.../ADT/adt-bundle-mac-x86_64-20130917/android-ndk-r9b//ndk-build: line 132: uname: command not found
I searched a lot but cannot resolved errors. I was wrong somewhere. Thank you for your help.
I've listed all the possibilities to cause error while building cocos2d-x in eclipse here in my blog. Hope it helps you. Let me know if it still doesn't fix your issue.
There is a README.md document in 'yourproject/proj.android' folder, it will help you build your project in eclipse.

How to force restart after uninstall for a Basic MSI Project in InstallShield 2009 Premier

InstallShield 2009 Premier, Basic MSI Project:
After uninstall completes, I want to force restart the computer. How?
Googling found, i have to set 'REBOOTPROMPT' TO 'S' or 'R' and the "Reboot" property.
How to set these properties and with what values?
Here is the Solution
You have to let InstallShield know that you want a reboot.How?: From 'Installation Designer' tab -> 'Behavior and Logic' -> 'Custom Actions and Sequences' -> 'Sequences' -> 'Installation' -> 'Execute' -> 'ScheduleReboot' set the value of 'Conditions' to "NOT REMOVE" (with out the inverted commas) if you want the reboot to happen after install and to "REMOVE" if after uninstall.
So up to now after install/uninstall the installer would show a warning message something like "... click ok to restart your machine now or cancel to restart later...". Now if you don't want to show this warning message even do step 3.
Go to 'Installation Designer' tab -> 'Behavior and Logic' -> 'Property Manager', a table would be open. Now add/edit the (Name, Value) pair with (REBOOTPROMPT, Suppress). This would suppress the message.