correct SWI_HOME_DIR value? - prolog

I encountered error:
"FATAL ERROR: Could not find system resources"
I then added the following code:
putenv("SWI_HOME_DIR=/usr/lib/swi-prolog");
I ran into another problem of:
"$c_call_prolog...Undefined procedure"
(More details here)
I ran the below command on Ubuntu 10.12
sudo apt-get install swi-prolog build-essential.
I wrote a simple C program to test it but was not able to retrieve the return value from prolog. Suppose I want to interact with mortal.pl, I compiled with:
swipl-ld -o mmm mortal.c mortal.pl
no error but like I mentioned. I did not get what I expected.
I obtained another code, nothing weird on the code. This time I got the first error. It seems that if swi-prolog is set to that directory, it won't search for my predicate.
Where and what should I set this SWI_HOME_DIR?

(Recap) with
putenv("SWI_HOME_DIR=/usr/lib/swi-prolog");
I called
mmm socrates
I got
$c_call_prolog...Undefined procedure
w/o putenv, the same call returned
FATAL ERROR: Could not find system resources
I finally changed
PL_initialise(1, plav)
where plav[0] = "mortal"; plav[1] = NULL; to
PL_initialise(1, argv)
I am able to obtain True/False from
rval = PL_call_predicate(NULL, PL_Q_NORMAL, pred, h0);
Though this confuses myself. What does PL_initialise() expect then?...not a to be called predicate?

No solution. I ended up installing ubuntu 12.10 64 bits (previously 32 bit). All those weird behavior are gone.

Related

Fault in reticulate in rstudio

476/5000
rstudio generates error when running R code with python code. At first the code worked very well but in the second installation it started to generate faults. Here is the link of the code in case you want to play #https: //www.r-bloggers.com/r-and-python-using-reticulate-to-get-the-best-of-both-worlds/
. My laptop is hp 4 gigs of ram and 500 mb of hard disk.
I would greatly appreciate who can explain the failure and how to solve it.
I have reinstalled anaconda last version twice.
library(reticulate)
use_python("/usr/local/bin/python")
use_virtualenv("r-reticulate")
os <- import("os")
Error: lexical error: invalid char in json text.
WARNING: The conda.compat modul
(right here) ------^
os$listdir(".")
Error: object 'os' not found
py_config()
Error: lexical error: invalid char in json text.
WARNING: The conda.compat modul
(right here) ------^
Actually, it comes from a deprecation warning reported a few days ago (fix compat import showing warning #8507).
But the fact is that this warning in "conda.compat" generates some errors, for example in the case of using conda environments in R through "reticulate" functions. This issue has been reported quite recently Conda warnings taken as errors #477.
The solution is to simply install the github version of "reticulate" in order to avoid these errors and ignore the conda warnings which shouldn't necessarily impede these functionalities. You can do it like this way:
remotes::install_github("rstudio/reticulate")
And don't forget to have the latest Rtools installed in your operating system!
This might be useful for you: https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/
I have Anaconda, and set up Python 2 environment. Once activated, run 'use_python' with the path to that environment and set the 'required' parameter to TRUE.
I had the same problem. I solved the problem by installing an older version of conda.
In anaconda promt
conda install conda = 4.1.6

Clojure fireplace in vim asking for python

Trying to get get fireplace set up in vim but having trouble with some error messages.
When I type cpr in a clojure buffer the following error shows up:
Error detected while processing function <SNR>53_RunTests..fireplace#capture_te
st_run..<SNR>53_eval..fireplace#client..fireplace#platform..fireplace#register_
port_file..fireplace#nrepl_connection#open..fireplace#nrepl#for..<SNR>75_nrepl_
process..<SNR>75_nrepl_message..<SNR>75_nrepl_call..<SNR>74_nrepl_transport_cal
l..<SNR>74_nrepl_transport_dispatch:
line 6:
E605: Exception not caught: nREPL: zsh:1: command not found: python^#
Error detected while processing function <SNR>53_RunTests..fireplace#capture_te
st_run..<SNR>53_eval..fireplace#client..fireplace#platform:
line 9:
E171: Missing :endif
The thing I understand is that it cant find python. In my shell I can start python with the python command which will fire up 3.4.2.
Im using nixos
:echo has('python') returns 0
echo $PATH and :! echo $PATH return the same path.
What can I try in order to find what is actually causing this error?
You have to install/compile vim with python support for vim-fireplace to work, and this may not be the default on your system. I believe typing :help python will do this for you. If you don't get anything, you may have to recompile vim with python support, for which I'll direct you towards Google for now.
Another option if you have pip installed is to consider switching to neovim. Installing neovim with pip install neovim will get you python support. I've been using neovim lately, and it's worked pretty well for me.

Error with the command 'make basics ' while install winexe

I want to isntall winexe on Ubuntu 13.1 32bit version.
I did exactly after this guide: Winexe - aldeid
If I execute the command "make basics bin/winexe" there occurs the following error:
Compiling ../librpc/idl/atsvc.idl
/usr/include/stdc-predef.h:0: error: Syntax error near '3'
Failed to parse ../librpc/idl/atsvc.idl at ./../pidl/pidl line 608.
make: *** [idl] Error 1
I have absolutely no idea how to fix this.
I would be even satisfied with a solution suggestion to this problem.
Thank you.
make "CPP=gcc -E -ffreestanding" basics bin/winexe works around this error.
I found "another" way to isntall winexe.
ubuntu forum
The Donwload-Links to the static version (just unzip and run winexe) are working at the moment (on some other pages they didn't).
I still don't know why the error above occurs, if anybody knows it, please tell me anyway. I am still interessted.
VERY IMPORTANT EDIT: After restart winexe gives put an Internal Error signal 11
So I still need a solution for winexe. Either to isntall the verision from git or to fix this error.
EDIT nummber 2: OK, why am I sking questions if I answer them by myself?
The installation form the quide mentiond in my question qorks fine on Ubuntu 12 LTS and winexe-static-version is also ok if you don't make typing errors as I did.

How to write llvm pass in Mac OS X 10.9

I built my pass on Linux and it worked there correctly. Now when I brought in my code to Mac OS X 10.9 on Mac Airbook, its not working anymore. I am describing below the steps I took for building my llvm pass.
My source tree is llvm-3.4 and llv-3.4/tools/clang-3.4
I ran ./configure --prefix=/some-path --enable-targets=host which was successful.
Then I ran make && make install which completed without any errors.
I exported the bin path export PATH=/some-path/bin:$path and checked for which clang which opt and they pointed to my installation.
Now when I tried to load hello pass opt -load /some-path/lib/LLVMHello.dylib -hello <fac.bc >/dev/null I get the following error
Error opening '/some-path/lib/LLVMHello.dylib': dlopen(/some-path/lib/LLVMHello.dylib, 9): Symbol not found: __ZN4llvm12FunctionPass17assignPassManagerERNS_7PMStackENS_15PassManagerTypeE
Referenced from: /some-path/lib/LLVMHello.dylib
Expected in: flat namespace
in /some-path/lib/LLVMHello.dylib
-load request ignored.
opt: Unknown command line argument '-hello'. Try: '/some-path/bin/opt -help'
opt: Did you mean '-help'?
Can someone help me fix this issue or at least point in the right direction.
In my case, the dynamic LLVM library, which is required for dynamically loaded passes, was missing. I solved it by configuring LLVM with --enable-shared. I also had --enable-keep-symbols set, but I don't think this is necessary. The full configure command I used:
./configure --enable-shared --enable-keep-symbols
I know I'm a bit late with the answer, but I recently ran into the same problem. And since I spent quite some time solving the issue, I wanted to pass on my findings. Hope it helps.
Cheers, Marcus

Can't install PDQ tool for R on windows

I've been trying for half an hour following this simple guide http://www.perfdynamics.com/Tools/PDQcode.html#tth_sEc1.1.1
It simply throws this error:
> install.packages("C:\\Users\\Neven\\Downloads\\pdq_6.0-1.tar.gz",repos=NULL,type="source")
Warning: invalid package 'C:/Users/Neven/Downloads/pdq_6.0-1.tar.gz'
Error: ERROR: no packages specified
Warning messages:
1: running command '"C:/PROGRA~1/R/R-30~1.2/bin/x64/R" CMD INSTALL -l "C:\ProgramFiles\R\R-3.0.2\library" "C:/Users/Neven/Downloads/pdq_6.0-1.tar.gz"' had status 1
2: In install.packages("C:\\Users\\Neven\\Downloads\\pdq_6.0-1.tar.gz", :
installation of package ‘C:/Users/Neven/Downloads/pdq_6.0-1.tar.gz’ had non-zero exit status
I've been searching for an answer on the website, trying different things but nothing did it.
I was copy/pasting the command from their documentation and it seems their documentation is out of date.
The command is:
install.packages("C:\\Users\\Neven\\Downloads\\pdq_6.0-1.tar.gz",repos=NULL,type="source")
Since there's a new version of R (6.1-1), it should be:
install.packages("C:\\Users\\Neven\\Downloads\\pdq_6.1-1.tar.gz",repos=NULL,type="source")
Really stupid mistake, but that's what solved the problem.

Resources