ocaml batteries unbound toploop error - ocaml

I am trying to install bap required for ropc https://github.com/pakt/ropc as per the instructions given in ropc/bap/INSTALL in Ubuntu 14.04 . I have run these commands successfully .
sudo apt-get install ocaml ocaml-native-compilers ocaml-findlib camlidl \
libocamlgraph-ocaml-dev libextlib-ocaml-dev binutils-dev automake \
libcamomile-ocaml-dev otags libpcre3-dev camlp4-extra bison flex
Now , when I make it inside the bap directory , I get the following Unbound module toploop error, which seems to be a compatibility issue between batteries and ocaml. How do I get around this ? Please see the image for further details
Image uploaded
I read that I should add -I +compiler-libs somewhere. But where exactly? I have no experience working with ocaml and I am just trying to build ropc successfully.

I tried to compile the pact/ropc project, and I can only confirm problems.
Although the ocaml configuration succeeds, the compile shows an undefined error:
Error: Some fatal warnings were triggered (2 occurrences)
../Makefile.shared:84: recipe for target 'nat.cmo' failed
make[2]: *** [nat.cmo] Error 2
make[2]: Leaving directory '/home/strobel/tmp/ropc/bap-0.4/bigint-3.12/otherlibs/num'
Makefile:5: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/strobel/tmp/ropc/bap-0.4/bigint-3.12'
Makefile:356: recipe for target 'all-recursive' failed
The bap component used in ROPC is available in opam but ROPC is not, and it shows signs of bitrot. There are 3 issues opened for the github project telling about compile problems.
I have a quite well provisioned ocaml setup, with packages directly from opam (very up to date versions), and my approach was to see if it would compile here.
What to do?
Maybe uninstall your debian ocaml packages, start anew with opam. There is the possibility to install old ocaml versions, too, so maybe walk back in time to a 3.12 ocaml version. But getting the required packages in corresponding versions might not be so easy, opam is quite new. It will be an advanced ocaml debugging job IMO.

Related

Problem with Ocaml and make: "Error: the file ____.cmxa is not a compilation unit description"

I'm running make in the top level of the UniMath directory and make keeps returning errors. I'm working on fedora 35 and I'm using Ocaml version 4.11.2.
Here is a print out of the errors
make[2]: Entering directory '/home/rymndbkr/UniMath/sub/coq'
OCAMLBEST -o bin/coqdep_boot
File "_none_", line 1:
Error: tools/coqdep_boot.cmx is not a compilation unit description.
OCAMLBEST -o bin/ocamllibdep
File "_none_", line 1:
Error: tools/ocamllibdep.cmx is not a compilation unit description.
COQMKTOP -o bin/coqtop.opt
File "topbin/coqtop_bin.ml", line 11, characters 20-32:
11 | let drop_setup () = Mltop.remove ()
^^^^^^^^^^^^
Error: Unbound module Mltop
make[2]: *** [Makefile.build:422: bin/coqtop.opt] Error 2
make[2]: Leaving directory '/home/rymndbkr/UniMath/sub/coq'
make[1]: *** [Makefile.make:178: submake] Error 2
make[1]: Leaving directory '/home/rymndbkr/UniMath/sub/coq'
Makefile:76: .coq_makefile_output.conf: No such file or directory
make: *** [Makefile:247: sub/coq/bin/coq_makefile] Error 2
I'll describe the process I went through in hopes that it is reproducible. I was following the UniMath installation instructions on their github (https://github.com/UniMath/UniMath/blob/master/INSTALL.md). They did not have any installation instructions for fedora so I attempted to convert their Debian instructions. The main thing they wanted Debian users to do was run the command
sudo apt-get install build-essential git ocaml ocaml-nox ocaml-native-compilers camlp5 libgtk2.0 libgtksourceview2.0 liblablgtk-extras-ocaml-dev ocaml-findlib libnum-ocaml-dev emacs
To convert this, I made sure I had Ocaml version 4.11.2. I just followed the steps on Ocaml's site (https://ocaml.org/docs/install.html). There was a script which prompted me to modify ~/.bash_profile. I said yes. I also said yes when it prompted me to add a hook.
I also installed ocaml-num via the command dnf since this was required for later versions of ocaml.
I also installed #development-tools via dnf since another stack exchange post recommended it as the best fedora equivalent of build-essentials, the latter of which is part of the downloads for prepping a Debian computer for UniMath.
There are some things I did not mention that the UniMath site said to install to prep a Debian computer. I either had these things (or their equivalents installed) or could not figure out if they had equivalents.
I decided to just go ahead and try to finish the installation. I simply ran
git clone https://github.com/UniMath/UniMath
cd \UniMath
make BUILD_COQIDE=yes
It is on the last of these commands that the errors arose.
P.S. - Please let me know if there is information I should add to this question, or any way to improve it.
The error message not a compilation unit description is likely due to a mismatch between the Ocaml version that compiled the file and the one that is trying to read it.
You can use ocamlobjinfo to check that hypothesis.
A possible fix is to use make clean to reinitialize the state, and then rebuild it after ensuring that the environment is consistent with a call to eval $(opam env).

Build Mono on Raspberry Pi 3

I try desperately to build Mono on a Raspberry Pi 3.
I installed Mono from the Repo first. Then I tried to build the newest tarball or the git master. Neither worked.
I always end up with this message:
make install-local
make[7]: Entering directory '/home/pi/mono-5.9.0.415/mcs/class/corlib'
CSC [basic] mscorlib.dll
/home/pi/mono-5.9.0.415/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs(5918,45): error CS0246: The type or namespace name 'Task<>' could not be found (are you missing a using directive or an assembly reference?)
/home/pi/mono-5.9.0.415/external/corefx/src/System.Memory/src/System/ReadOnlySpan.cs(85,42): warning CS3001: Argument type 'void*' is not CLS-compliant
/home/pi/mono-5.9.0.415/external/corefx/src/System.Memory/src/System/Span.cs(90,34): warning CS3001: Argument type 'void*' is not CLS-compliant
../../build/library.make:329: recipe for target '../../class/lib/basic/mscorlib.dll' failed
make[7]: *** [../../class/lib/basic/mscorlib.dll] Error 1
make[7]: Leaving directory '/home/pi/mono-5.9.0.415/mcs/class/corlib'
../../build/rules.make:211: recipe for target 'do-install' failed
make[6]: *** [do-install] Error 2
make[6]: Leaving directory '/home/pi/mono-5.9.0.415/mcs/class/corlib'
../build/rules.make:232: recipe for target 'install-recursive' failed
make[5]: *** [install-recursive] Error 1
make[5]: Leaving directory '/home/pi/mono-5.9.0.415/mcs/class'
build/rules.make:232: recipe for target 'install-recursive' failed
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory '/home/pi/mono-5.9.0.415/mcs'
Makefile:54: recipe for target 'profile-do--basic--install' failed
make[3]: *** [profile-do--basic--install] Error 2
make[3]: Leaving directory '/home/pi/mono-5.9.0.415/mcs'
Makefile:50: recipe for target 'profiles-do--install' failed
make[2]: *** [profiles-do--install] Error 2
make[2]: Leaving directory '/home/pi/mono-5.9.0.415/mcs'
Makefile:600: recipe for target 'install-exec' failed
make[1]: *** [install-exec] Error 2
make[1]: Leaving directory '/home/pi/mono-5.9.0.415/runtime'
Makefile:541: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
This is the Script I used for the Tarball build:
PREFIX=/home/pi/.myMono
VERSION=5.9.0.415
tar xvf mono-$VERSION.tar.bz2
cd mono-$VERSION
./configure --prefix=$PREFIX
make
make install
Does anyone have the same problem?
Or some suggestions how to make it build correctly?
Since it isn't clear if the question is particularly about getting mono version 5.9.0.415 running on Raspberry Pi 3 or mono in general, I will presume that the question is about mono in general.
From my experience there appears to be a compatibility issue with mono 5 and the armv7l platform (armv7l-unknown-linux-gnueabihf).
I have tried to build the following mono release packages:
5.0.0.100
5.0.1.1
5.2.0.104
5.2.0.224
5.9.0.398
5.9.0.415
Compilation fails at the point where build process tires to use the generated csc binary. There appears to be a NullPointerException in the compile section somewhere in a call made from CompileMethodBodies.
The problem first appears in Mono 5 with the introduction of Roslyn. The good news is that mono release 4.8.1 is not affected by the new Roslyn code and will compile and run without significant issues on Raspberry Pi 3.
You can compile mono like this:
wget https://download.mono-project.com/sources/mono/mono-4.8.1.0.tar.bz2
tar xvf mono-4.8.1.0.tar.bz2
cd mono-4.8.1.0
./configure --prefix=/home/pi/.myMono
make
make install
Additionally it is worth mentioning that if you wish to take advantage of all the 4 CPU cores during mono compile on your Raspberry Pi 3, you can do so by starting make like this: make -j4. This will cut down the compile time significantly.
And if you wish to skip the generation of libmono you can do so by configuring the build with the --disable-libraries parameter: ./configure --disable-libraries --prefix=/home/pi/.myMono. But as you will need the libraries to run any application... This will only help with consecutive rebuilds of the mono runtime only (once you have already once installed the monolib).
What I noticed, but wasn't able to verify is that there may be some mono 5 packages for Raspberry Pi 3 out there after all. This post claims there is a 5.2 package available for download. As does the mono download page.
As a side note I would like to mention that installation of mono into /home/pi/.myMono may be a bad choice. But I guess it should still work... A more classical approach would be the /usr/local or the /opt folders. Here are some thoughts on these alternate locations.

Error when building frama-clang: Unbound module Parameter_sig

I downloaded frama-clang from here, installed opam and used it to install Ocaml 2.02.3. Then I built frama-c Aluminium (which went fine) and following that I ran ./configure and then make.
In the latter step, I get an error saying:
File "frama_Clang_option.mli", line 26, characters 22-42:
Error: Unbound module Parameter_sig
make: *** [frama_Clang_option.cmi] Error 2
I've been googling for hours now but I didn't find out how to install that (seemingly) missing module Parameter_sig. I am sure I have installed every required software (llvm, ocaml etc.) so what is missing and how can I solve that problem?

Can't install local-build gcc-4.9.0 because of libgmp.so.3

I am trying to install gcc-4.9.0 in local-build on linux along with gmp-4.3.2, mpfr-3.1.4 and mpc-1.0.3 (I am following this tutorial).
But when I run make install in the gcc build directory, I get this error :
test -z "/home/k.masson/gcc-4.9.0/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0" || /usr/bin/mkdir -p "/home/k.masson/gcc-4.9.0/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0"
Installing dummy lib libgcj_bc.so.1.0.0
/home/k.masson/build/gcc-4.9.0/host-x86_64-unknown-linux-gnu/gcc/cc1:
Mainly this :
error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory
It seems that libgmp.so.3 is not correctly installed but it is ('make install'didn't failed for gmp) and I checked many times if the links were correct but nothing to do, I don't know why the make file don't find it.
Before running make install, I run these commands in the following order :
LD_LIBRARY_PATH=/home/k.masson/gmp-4.3.2/lib:/home/k.masson/mpfr-2.4.2/lib:/home/k.masson/mpc-0.8.1/lib ./configure --prefix=/home/k.masson/gcc-4.9.0 --with-gmp=/home/k.masson/gmp-4.3.2 --with-mpfr=/home/k.masson/mpfr-2.4.2 --with-mpc=/home/k.masson/mpc-0.8.1 --disable-multilib
And this (I don't know why but this is in the tutorial):
LD_LIBRARY_PATH=/home/k.masson/gmp-4.3.2/lib:/home/k.masson/mpfr-2.4.2/lib:/home/k.masson/mpc-0.8.1/lib nice -n 19 time make -j8
libgmp.so.3 is in /home/k.masson/gmp-4.3.2/lib as well as libgmp.so.3.5.2. I even tried to create the link myself with ln -s libgmp.so.3.5.2 libgmp.so.3 but it doesn't fix the problem.
To install gmp in local-build, I used these commands :
./configure --prefix=/home/k.masson/gmp-4.3.2 --enable-cxx
nice -n 19 time make -j8
make install
make check
echo $? # Returns 2
But one test fail :
====================================
1 of 58 tests failed
Please report to gmp-bugs#gmplib.org
====================================
make[4]: *** [check-TESTS] Error 1
make[4]: Leaving directory `/home/k.masson/build/gmp-4.3.2/tests/mpz'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/home/k.masson/build/gmp-4.3.2/tests/mpz'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/home/k.masson/build/gmp-4.3.2/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/k.masson/build/gmp-4.3.2'
make: *** [check] Error 2
Also, I got these few lines above when I'm running the tests:
/bin/sh: line 4: 20956 Segmentation fault (core dumped) ${dir}$tst
So I tried to install gmp-6.1.0 to avoid this test issue and it works, all tests are Ok but now, this is a gcc issue, I can't run make install anymore because the make file doesn't exists.. Should I keep the new gmp ? And change my gcc ? Or not at all ?
Thanks for your help
The short way
To fix the test issue when installing gmp, I just choosed a newer version to install, it looked as a compatibility issue. So I picked up gmp-6.1.0 and install and test processes were successful.
But this brought a new problem when installing gcc-4.9.0, the ./configure wasn't able to generate a make file with a install procedure. So I had to get a newer version, I chose gcc-4.9.3 instead of gcc-4.9.0 and everything works perfectly.
The clean way
As #piyush made me noticed, the short way is not recommended at all. See Installing GCC.
If you want to do a local-build, the best is to download the gcc version you want here and before installing it, run the ./contrib/download_prerequisites script in the gcc source.
If not, you can use your package manager, which is much better.

makefile compilation error for compiling on Arm board

I wanted to install rt8192cu driver on my ubuntu 12.0.4 LTS based OS (xillinux) running on an ARM processor (microzed board, zynq processor).
git clone https://github.com/dz0ny/rt8192cu.git
After I enter the above command and enter into the directory, and type make , i get the following error.
make[1]: Entering directory `/usr/src/kernels/3.12.0-xillinux-1.3'
Makefile:579: /usr/src/kernels/3.12.0-xillinux-1.3/arch/armv7l/Makefile: No such file or directory
make[1]: *** No rule to make target `/usr/src/kernels/3.12.0-xillinux-1.3/arch/armv7l/Makefile'. Stop.
make[1]: Leaving directory `/usr/src/kernels/3.12.0-xillinux-1.3'
make: *** [modules] Error 2
The makefile can be found at https://github.com/dz0ny/rt8192cu/blob/master/Makefile
The ubuntu based OS I am using is, http://xillybus.com/downloads/doc/xillybus_getting_started_zynq.pdf
How do I modify the makefile to compile directly on my platform ?
even with linux-headers installed sometimes it fails, a quick workaround is this:
ln -s /lib/modules/`uname -r`/build/arch/arm /lib/modules/`uname -r`/build/arch/armv7l
a long workaround is to compile your own config from source with the same dot-config file and install all the stuff.
If I understand correctly you are trying to compile a Linux Kernel Module for the RT8192CU Wi-Fi IC.
Moreover, you are running Ubuntu directly on the Zynq and you are trying to compile in place.
The error you receive is given by the lack of the Kernel headers, namely '3.12.0-xillinux-1.3', which should be the same kernel version you are using (try write uname -r in terminal).
The quickest way to solve is to let Ubuntu install the required sources/headers (provided the Kernel Module is targeting distribution-provided sources and you are running that specific kernel when issuing the following command) with
$ sudo apt-get install linux-headers-$(uname -r)