error while installing gmp (frama-c prerequisite) on mac os catalina using opam on terminal - macos-catalina

I ran these commands to install Frama-C as said on http://frama-c.com/install-sulfur-20171101.html#installing-frama-c-on-mac-os-x:
brew install autoconf opam
Do not forget to opam init and eval $(opam config env) for a proper OPAM installation (if not already done before on your machine).
brew install gmp gtk+ gtksourceview libgnomecanvas
brew install graphviz
opam install altgr-ergo why3
I encountered an error after the 3rd command (of course there are 2 more commands to install frama-c completely, but the same error is showing up after the last command too).
ERROR while compiling conf-gmp.1
test.c:7:2: error: implicit declaration of function '__gmp_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
__gmp_init();

Your issue is related to opam and the conf-gmp (version 1) package in particular, which is used by Frama-C, but not caused by it.
If you do opam update and then opam install conf-gmp.2, you should be able to install the package without errors.
Otherwise, if you have control over whatever is adding -Werror to your CFLAGS environment variable, you can try removing it and reinstalling the packages.
Long explanation
It is likely that your CFLAGS environment variable contains -Werror or some similar setting which is causing the warning emitted by conf-gmp during its compilation to become an error.
The conf-gmp.1 package indeed does emit a warning when compiled, but in standard settings, the warning is simply ignored by opam and everything works. In your system, the warning became an error, and prevented the other packages from being installed.
A new version of conf-gmp was posted after the issue was noticed due to this question. Running opam update and then opam install conf-gmp.2 should get this new version and hopefully avoid any warnings. Note that having -Werrors in CFLAGS may trigger some issues in other packages, however. For instance, in my configuration, it is impossible to install lablgtk with -Werror, since its compilation inevitably raises several warnings. It might be necessary to add CFLAGS=-Wno-error or similar to ensure lablgtk will be compiled. Otherwise, you may have to compile Frama-C from source (lablgtk is optional in this case).

Related

Boost MPI flags can't be found when installing Repast HPC

Using M1 Mac, I've followed the manual install procedures to install Repast HPC.
I'm trying to run ./install.sh rhpc and the following error persists:
configure: error: cannot not find the flags to link with Boost mpi
The suggested solution says to add the compiler wrappers with the following commands:
export PATH=$BASE_DIR/MPICH/bin:$PATH
MPI_COMPILER_INVOCATION=$BASE_DIR/MPICH/bin/mpicxx
which didn't work as the command mpicxx still couldn't be invoked.
So I tried installing mpich through homebrew, where mpicxx now works outside of the install. However, the error persists.
So I tried installing boost through homebrew and directing the install to the homebrew directory, but the error persists.
So I tried installing open-mpi through homebrew, and mpicxx still works, but the error persists.
Any suggestions? I'm running out of online resources to solve the issue.

Is it necessary to install X Code for c++ compiler? What if I install X Code and Uninstall it? Will g++ compiler will also get deleted?

I am not sure if I should delete the X Code as it takes a lot of space on MacBook. I want to use g++ compiler for compiling my c++ program.
It is possible to install just the Xcode command line tools. Open Terminal and execute xcode-select --install. This will get you your compiler (clang, not g++. g++ is just an alias for clang++ on Macs), linker, make, etc.
To actually answer your question, yes. If you install something and then uninstall it, the stuff that got installed will get uninstalled.
If you want the actual g++ compiler, you will need to install it yourself, homebrew is the easiest way. The gcc package will create versioned symlinks for you (g++-9), and you can just use that, or create another symlink that redirects g++ to g++-9. If you did that, you'll have to remember to manually update that symlink when the major version changes. All this is found in usr/local/bin after installing homebrew and the gcc package.

Opam switch install could not install the older version of ocaml (3.08.3)

I'm doing some works with ocaml and opam.
I need ocaml of version 3.08.3, so I tried install this version via opam.
opam switch install 3.08.3
The above command would install it successfully, I hoped. But it couldn't.
opam-switch could not install 3.* versions of ocaml with the following error message.
[ERROR] Could not resolve set of base packages
I searched this message everywhere, but I couldn't get any of hints. Does anyeone have a clue to solve this problem? Thanks.
compilers/3.08.3/3.08.3/3.08.3.comp, the file to describe the base packages for that compiler version tells:
packages: [
"base-unix"
"base-bigarray"
"base-threads"
"base-ocamlbuild"
]
So it requires base-unix, base-bigarray, base-threads and base-ocamlbuild. However, the package description of base-ocamlbuild, packages/base-ocamlbuild/base-ocamlbuild.base/opam says:
ocaml-version: [>= "3.10" & < "4.03"]
It says that ocamlbuild is not available before 3.10. Indeed, ocamlbuild was introduced since 3.10. It is likely that the compiler description file 3.08.3.comp has a bug. It is great if you would raise a bug ticket at https://github.com/ocaml/opam-repository/issues for the fix.
For a workaround, I recommend to install OCaml 3.08 by hand, not using OPAM command: I see almost no benefit to use OPAM with 3.08 where ocamlbuild is not available, since most of the OPAM packages assume the existence of ocamlbuild.
You could also create your own copy of OPAM repo with a fixed 3.08.3.comp file without "base-ocamlbuild". See the document of opam repo for more details.

The tools required to build C++ code for R were not found

OS: Ubuntu 14.04
g++: g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
R version: 3.2.0 (2015-04-16) -- "Full of Ingredients"
Rcpp: 0.11.6
Today I apt-get dist-upgrade my system, and the g++ was also been upgraded.
Then when I am trying to use "Rcpp" package in R, the code is the simplest test code >>evalCpp("1+1") . An error as follows occurred:
Error in frameTypes(env) : not a proper evaluation environment
Calls: ::: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
Error in sourceCpp(code = code, env = env, rebuild = rebuild,showOutput = showOutput, :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please install GNU development tools including a C++ compiler.
I have did google for it. The following links are all about Mac OSX:
Error when with Xcode 5.0 and Rcpp (Command Line Tools ARE installed)
g++ errors when trying to compile c++11 with Rcpp
From the answers and comments, I can not tell what is the real problem.
Appreciate your help!
UPDATE: I finally solved this problem by reinstalling all the R related deb packages. And one thing we should keep in mind is that I also did what #Dirk suggested first apt-get build-dep r-base-dev. I can not confirm which one is the key step.
You need
sudo apt-get build-dep r-base
to install the all the build dependencies for R itself.
But we even built an explicitly helper package r-base-dev so in most cases (and in your use case of Rcpp) you just need
sudo apt-get install r-base-dev
There is something wrong/missing in your system configuration. First of all, I doubt that you are really running Ubuntu 14.04 (after the dist-upgrade) because the the other versions that you listed wouldn't be available (unless you have pulled them in from a non-default repository). You might also consider running a full-upgrade to try to straighten out your configuration.
You might gain some insights by running with showOutput=1...
library(Rcpp)
evalCpp("1+1",showOutput=1,rebuild=1)
...but actually, it looks like the problem is related specifically to a parameter called env (Error in frameTypes(env) : not a proper evaluation environment) which is likely evaluated prior-to attempting to compile.
For what it is worth, I was able to run this without r-base-dev installed, but maybe installing r-base-dev will pull in the correct, and updated, versions of what you need. I would be inclined to just reinstall all R-related packages.

Ocaml Opam install camlbz2

Error while installing camlbz2
%opam install camlbz2
...
...
. checking bzlib.h usability... no
. checking bzlib.h presence... no
. checking for bzlib.h... no
awk: line 1: regular expression compile failed (syntax error ^* or ^+)
^+
configure: error: not found 'opam install camlbz2' failed.
I can not find anything for opam to install something like "libbz2" or whatever, any suggestions?
OPAM only deals (currently) with OCaml source packages.
Here, your problem comes from the ./configure script of the OCaml package detecting that a system package is missing, not an OCaml package (you can see that it has searched for files with a .h extension, i.e. a C include file).
To fix your problem, you need to install this system package. As Ontologiae said, the missing package is related to the libbz2 library, and include files are usually provided in development packages, so you should probably try to install libbz2-dev using the system installer of your OS. This package is not in OCaml, so there is no risk of messing up with OPAM installation.
Note that, since you use opam config -env to set your OCaml environment, even if you install OCaml packages with your system installer, there should be no bad interaction with packages installed in your homedir by OPAM.
You need to install the libbz2 C library. So, check your package system and install it.
In Debian, it's the package "libbz2-dev" (so sudo apt-get install libbz2-dev)