I would like to install libRmath.dylib on Mac OS X (Mavericks) preferably with Homebrew since I already use this package manager.
I did not find a formula for libRmath, but I did find a formula for R so I tried to extend it with (see entire file at end):
# Also build libRmath.dylib
system "cd src/nmath/standalone"
system "make"
system "make install"
system "cd ../../.."
lib.mkpath
ln_s prefix+"R.framework/Resources/lib/", lib
The commands ./configure; cd src/nmath/standalone; make do create libRmath.dylib if I execute them manually. But not using brew install r. I cannot find libRmath.dylib in Cellar. What am I doing wrong? (Note that I am new to Ruby and Homebrew's formula.)
Below is the entire file.
require 'formula'
class RDownloadStrategy < SubversionDownloadStrategy
def stage
quiet_safe_system 'cp', '-r', #clone, Dir.pwd
Dir.chdir cache_filename
end
end
class R < Formula
homepage 'http://www.r-project.org/'
url 'http://cran.rstudio.com/src/base/R-3/R-3.1.1.tar.gz'
mirror 'http://cran.r-project.org/src/base/R-3/R-3.1.1.tar.gz'
sha1 'e974ecc92e49266529e8e791e02a80c75e50b696'
head do
url 'https://svn.r-project.org/R/trunk', :using => RDownloadStrategy
depends_on :tex
end
option "without-accelerate", "Build without the Accelerate framework (use Rblas)"
option 'without-check', 'Skip build-time tests (not recommended)'
option 'without-tcltk', 'Build without Tcl/Tk'
depends_on :fortran
depends_on 'readline'
depends_on 'gettext'
depends_on 'libtiff'
depends_on 'jpeg'
depends_on 'cairo'
depends_on :x11 => :recommended
depends_on 'valgrind' => :optional
depends_on 'openblas' => :optional
# This is the same script that Debian packages use.
resource 'completion' do
url 'https://rcompletion.googlecode.com/svn-history/r28/trunk/bash_completion/R', :using => :curl
version 'r28'
sha1 'af734b8624b33f2245bf88d6782bea0dc5d829a4'
end
def install
args = [
"--prefix=#{prefix}",
"--with-aqua",
"--with-libintl-prefix=#{Formula['gettext'].prefix}",
"--enable-R-framework",
]
if build.with? 'valgrind'
args << '--with-valgrind-instrumentation=2'
ENV.Og
end
if build.with? "openblas"
args << "--with-blas=-L#{Formula["openblas"].opt_lib} -lopenblas" << "--with-lapack"
elsif build.with? "accelerate"
args << "--with-blas=-framework Accelerate" << "--with-lapack"
# Fall back to Rblas without-accelerate or -openblas
end
args << '--without-tcltk' if build.without? 'tcltk'
args << '--without-x' if build.without? 'x11'
# Also add gettext include so that libintl.h can be found when installing packages.
ENV.append "CPPFLAGS", "-I#{Formula['gettext'].include}"
# Pull down recommended packages if building from HEAD.
system './tools/rsync-recommended' if build.head?
system "./configure", *args
system "make"
ENV.deparallelize # Serialized installs, please
system "make check 2>&1 | tee make-check.log" if build.with? 'check'
system "make install"
# Also build libRmath.dylib
system "cd src/nmath/standalone"
system "make"
system "make install"
system "cd ../../.."
lib.mkpath
ln_s prefix+"R.framework/Resources/lib/", lib
# Link binaries and manpages from the Framework
# into the normal locations
bin.mkpath
man1.mkpath
ln_s prefix+"R.framework/Resources/bin/R", bin
ln_s prefix+"R.framework/Resources/bin/Rscript", bin
ln_s prefix+"R.framework/Resources/man1/R.1", man1
ln_s prefix+"R.framework/Resources/man1/Rscript.1", man1
bash_completion.install resource('completion')
prefix.install 'make-check.log' if build.with? 'check'
end
test do
(testpath / 'test.R').write('print(1+1);')
system "r < test.R --no-save"
system "rscript test.R"
end
def caveats; <<-EOS.undent
To enable rJava support, run the following command:
R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
EOS
end
end
Formula r now has the option with-librmath-only which only builds the standalone libRmath library.
Related
I'm developing a cluster using mpi4py and when i run a basic script to test the cluster the result is weird:
the result should be this (script executed in c):
My code:
from mpi4py import MPI
world_comm = MPI.COMM_WORLD
world_size = world_comm.Get_size()
name = MPI.Get_processor_name()
my_rank = world_comm.Get_rank()
print('World Size: {0} | Name: {1} | Rank: {2}'.format(world_size,name,my_rank))
And the hostfile:
no02 slots=3
no01 slots=5
How could I get around this problem?
I managed to solve it as follows: I reinstalled mpi4py, but this time I passed the MPICC env before installation:
env MPICC=/usr/bin/mpicc pip3 install mpi4py --no-cache-dir
But you need to make sure the libopenmpi-dev library is installed and then run the which mpicc command and put it as a path in the env in the above command
For a while now I've been happily using Github's Actions to run my library's R CMD check and deploying the package's documentation. Suddenly the package action started failing with the following error:
── Commiting updated site ──────────────────────────────────────────────────────
Running git add -A .
Running git commit --allow-empty -m 'Built site for lares: 4.9.0#d936943'
*** Please tell me who you are.
Run
git config --global user.email "you#example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'runner#Mac-1594850189701.(none)')
Error: System command 'git' failed, exit status: 128, stdout & stderr were printed
Stack trace:
1. pkgdown::deploy_to_branch(new_process = FALSE)
2. pkgdown:::github_push(dest_dir, commit_message, remote, branch)
3. pkgdown:::with_dir(dir, { ...
4. base:::force(code)
5. pkgdown:::git("commit", "--allow-empty", "-m", commit_message)
6. processx::run("git", c(...), echo_cmd = echo_cmd, echo = echo, ...
7. throw(new_process_error(res, call = sys.call(), echo = echo, ...
x System command 'git' failed, exit status: 128, stdout & stderr were printed
── Removing worktree ───────────────────────────────────────────────────────────
Running git worktree remove \
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/Rtmpp2vz58/file888686837c1
Execution halted
##[error]Process completed with exit code 1.
I've tried running those commands with my name and email from RStudio's terminal, tried from different computers I code, checked pkgdown::deploy_to_branch() documentation... with no success.
Any idea how to solve this? What am I not seeing? Is it a bug on something that recently changed?
- run: |
git config --global user.email "you#example.com"
git config --global user.name "Your Name"
Just add step like that somewhere in your workflow.
In fact, it looks you already (almost) wrote a fix but decided for some reason to use Rscript as shell for that, and didn't close '. That threw other kind of error so you kicked it out and are back at square one :)
I'm trying to use llvm binding in ocaml, in my file test.ml, I have one line of code:
open Llvm
When I run the command
ocamlbuild -use-ocamlfind test.byte -package llvm
I get this result:
+ ocamlfind ocamldep -package llvm -modules test.ml > test.ml.depends
ocamlfind: Package `llvm' not found
Command exited with code 2.
Compilation unsuccessful after building 1 target (0 cached) in 00:00:00.
What did I do wrong in this? Thanks.
BTW, the _tag file contains:
"src": traverse
<src/{lexer,parser}.ml>: use_camlp4, pp(camlp4of)
<*.{byte,native}>: g++, use_llvm, use_llvm_analysis
myocamlbuild.ml contains:
open Ocamlbuild_plugin;;
ocaml_lib ~extern:true "llvm";;
ocaml_lib ~extern:true "llvm_analysis";;
flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
I don't know why the instructions that you're using are so complex. You don't have to do anything like this to use llvm bindings in OCaml, provided you have installed them via opam.
Here is the recipe:
Install llvm bindings via opam.
it could be as simple as
opam install llvm
However, opam may try to install the latest version that is not available on your system, so pick a particular version, that you have and do the following (suppose you have llvm-3.8):
opam install conf-llvm.3.8
opam install llvm --criteria=-changed
(The -criteria flag will prevent opam from upgrading conf-llvm to the newest version)
Once it succeeds, you can easily compile your programs without any additional scaffolding.
Create and build your project
create a fresh new folder, e.g.,
mkdir llvm-project
cd llvm-project
create a sample application (borrowed from some tutorial, that I've found online):
cat >test.ml<<EOF
open Llvm
let _ =
let llctx = Llvm.global_context () in
let llmem = Llvm.MemoryBuffer.of_file Sys.argv.(1) in
let llm = Llvm_bitreader.parse_bitcode llctx llmem in
Llvm.dump_module llm ;
()
EOF
compile it for bytecode
ocamlbuild -pkgs llvm,llvm.bitreader test.byte
or to the native code
ocamlbuild -pkgs llvm,llvm.bitreader test.native
run it
./test.native mycode.bc
I am testing an R package called eutradeflows on travis. The package contains test programmed with testthat and I would like to see the output of devtools::test() in travis.
There was a line in the main travis log saying :
Status: 4 NOTEs
See ‘/home/travis/build/stix-global/eutradeflows/eutradeflows.Rcheck/00check.log’
for details
From this answer, I learned that its possible to display a file in the travis log. In .travis.yml I have asked travis to print that file after the test:
- cat /home/travis/build/stix-global/eutradeflows/eutradeflows.Rcheck/00check.log
But it doesn't contain the result of testthat tests.
How can I display the output of testthat tests in travis?
This is particularly important since I have skip instructions in the tests and I would like to know which tests have been skipped.
To display the result of testthat tests,
add this to .travis.yml:
r_binary_packages:
- devtools
- roxygen2
after_success:
- Rscript -e 'devtools::install();devtools::test()'
I used a slightly heavier weight fix to ensure that build and test only happened once. In the build matrix I put the following in for the script
script: |
R CMD build .
R CMD INSTALL RMINC*.tar.gz
R CMD check --as-cran --no-install RMINC*.tar.gz
cat RMINC.Rcheck/00check.log
Rscript -e "\
testr <- devtools::test(); \
testr <- as.data.frame(testr); \
if(any(testr\$error) || any(testr\$warning > 0)) \
stop('Found failing tests') \
"
pass=$?
if [[ $pass -ne 0 || $(grep -i "WARNING\|ERROR" RMINC.Rcheck/00check.log) != "" ]]; then
(exit 1)
else
(exit 0)
fi
This runs R CMD check and properly displays build output, failing on warnings or errors in either check or test phases.
PROBLEM:
I am having difficulty running Healpix-IDL routines with GDL with the current version of Healpix, Healpix_3.20.
The easiest thing to do would be to follow user gilo in this post:
http://sourceforge.net/p/gnudatalanguage/discussion/338692/thread/6546b9ad/?limit=25#324d
All Healpix IDL routines are downloaded in ~/user/downloads/Healpix_3.20/src/idl
Then, use !PATH i.e.:
GDL> !PATH = expand_path('+/user/myname/downloads/HEALPix_3.20/')+':'+!PATH
and after that you have access to all healpix procedures within gdl
That doesn't work for me. I try the command hidl and hididle in the Terminal (I'm using Mac OS X Yosemite, 10.10.5):
GDL> hidl
% Procedure not found: HIDL
% Execution halted at: $MAIN$
Any other solutions?
POSSIBLE SOLUTIONS:
In the installation procedures install.pdf, Section 7.6 hidl usage describes that hidl is sometimes not recognized. A fix is setting the environment variable IDL STARTUP to be equal to the HEALPix startup file HEALPix startup including the directory path to the file, i.e. use
setenv IDL_STARTUP /disk1/user1/HEALPix_2.15a/src/idl/HEALPix_startup for C shell, csh
export IDL_STARTUP="+/disk1/user1/HEALPix_2.15a/src/idl/HEALPix_startup" for s, sh, bash
For my routines, this should be
export IDL_STARTUP="+/usr/downloads/HEALPix_3.20/src/idl/HEALPix_startup"
on bash Terminal
(Recall syntax:
export key=value is sh, ksh, bash
setenv key value is csh)
This doesn't work for me. After executing the command, and entering gdl, I get:
% Error opening startup file: /user/myname/downloads/HEALPix_3.20/src/idl/HEALPix_startup
Following Section 7.8 Using GDL instead of IDL, I try
$ export IDL_TMPDIR=/tmp
$ gdl
This doesn't work either.
Following Using HEALPix IDL together with other IDL libraries in the IDL routines manual, idl.pdf, I try
export IDL_PATH="+/user/myname/downloads/HEALPix_3.20/src/idl/:+/opt/local/share/gnudatalanguage/lib:<IDL_DEFAULT>"
export IDL_STARTUP="+/user/myname/downloads/HEALPix_3.20/src/idl/HEALPix_startup"gdl`
output error:
% Error opening startup file: /user/myname/downloads/HEALPix_3.20/src/idl/HEALPix_startup.
I try
export IDL_PATH="+/opt/local/share/gnudatalanguage/lib:<IDL_DEFAULT>"
hidl
output error:
-bash: hidl: command not found
Nothing works.
BACKGROUND:
Healpix has the installation procedures here, at source forge.net: healpix.sourceforge.net/pdf/install.pdf
and the IDL routines here: healpix.sourceforge.net/pdf/idl.pdf
The sourcecode is here: sourceforge.net/projects/healpix/
In order to install Healpix, you use ./configure and then make. (See install.pdf, section 4)
Healpix IDL routines are downloaded in /user/myname/downloads/HEALPix_3.20/
GDL routines are located in /opt/local/share/gnudatalanguage/lib/
hidl is an alias to start IDL with the Healpix startup file and path. Type it on the system command line, not the IDL command line. You must run through their configure system to define hidl.
In subdirectory ~/.healpix/3_20_Darwin there are two files, config and idl.sh.
The config is
# configuration for Healpix 3.20
HEALPIX=/Users/myname/downloads/Healpix_3.20 ; export HEALPIX
HPX_CONF_DIR=/Users/myname/.healpix/3_20_Darwin
if [ -r ${HPX_CONF_DIR}/idl.sh ] ; then . ${HPX_CONF_DIR}/idl.sh ; fi
if [ -r ${HPX_CONF_DIR}/f90.sh ] ; then . ${HPX_CONF_DIR}/f90.sh ; fi
if [ -r ${HPX_CONF_DIR}/cpp.sh ] ; then . ${HPX_CONF_DIR}/cpp.sh ; fi
if [ -r ${HPX_CONF_DIR}/c.sh ] ; then . ${HPX_CONF_DIR}/c.sh ; fi
The idl.sh file is
# IDL configuration for HEALPix Fri MONTH DAY TIME EDT YEAR
# make sure IDL related variables are global
export IDL_PATH IDL_STARTUP
# back up original IDL config, or give default value
OIDL_PATH="${IDL_PATH-<IDL_DEFAULT>}"
OIDL_STARTUP="${IDL_STARTUP}"
# create Healpix IDL config, and return to original config after running Healpix-enhanced IDL
HIDL_PATH="+${HEALPIX}/src/idl:${OIDL_PATH}"
HIDL_STARTUP="${HEALPIX}/src/idl/HEALPix_startup"
alias hidl="IDL_PATH=\"${HIDL_PATH}\" ; IDL_STARTUP=${HIDL_STARTUP} ; idl ; IDL_PATH=\"${OIDL_PATH}\" ; IDL_STARTUP=${OIDL_STARTUP} "
alias hidlde="IDL_PATH=\"${HIDL_PATH}\" ; IDL_STARTUP=${HIDL_STARTUP} ; idlde ; IDL_PATH=\"${OIDL_PATH}\" ; IDL_STARTUP=${OIDL_STARTUP} "
So, if I manually set the paths in this idl.sh file and run config, i.e ~/.config. This should then allow one to use hidl in the command line to run the Healpix IDL routines, right?