Build Mono on Raspberry Pi 3 - build

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.

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).

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.

ocaml batteries unbound toploop error

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.

gcc-c++-4.1.2 (dual) installation on Fedora 21

I would like to install GCC-C++-4.1.2 on my Fedora 21.
I was able to download gcc-4.1.2-33.i386.rpm but I am having difficulty installing it due to dependency problems in multiple steps. When I tried to resolve dependency, I ended up messing up the system, because I installed Fedora 64, while gcc-4.1.2 is 32 bit.
Also, I tried to compile from the source but the build doesn't complete with following errors.
In file included from ../../gcc-4.1.2/gcc/unwind-dw2.c:256:
../../gcc-4.1.2/gcc/config/i386/linux-unwind.h: In function ‘x86_fallback_frame_state’:
../../gcc-4.1.2/gcc/config/i386/linux-unwind.h:141: error: field ‘info’ has incomplete type
libgcc.mk:1135: recipe for target 'libgcc/32/unwind-dw2.o' failed
make[3]: *** [libgcc/32/unwind-dw2.o] Error 1
make[3]: Leaving directory '/home/Yui/Downloads/gcc412build/gcc'
Makefile:1436: recipe for target 'stmp-multilib' failed
make[2]: *** [stmp-multilib] Error 2
make[2]: Leaving directory '/home/Yui/Downloads/gcc412build/gcc'
Makefile:4166: recipe for target 'all-gcc' failed
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory '/home/Yui/Downloads/gcc412build'
Makefile:617: recipe for target 'all' failed
make: *** [all] Error 2
Does anyone have experience installing GCC-C++-4.1.2? I do need C++, not just GCC.
Any help would be appreciated.
Here's the problem.
[root#lizzy ~]# uname -a
Linux lizzy.bromosapien.net 3.17.4-301.fc21.x86_64 #1 SMP Thu Nov 27 19:09:10 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root#lizzy ~]# rpm -qa | grep gcc
gcc-4.9.2-1.fc21.x86_64
See that? Look at that really closely. That's the latest version according to my Fedora 21 x86_64 system. You're trying to install a compiler that is seven years old. I will give you credit for trying to use an rpm, but then you're trying to compile instead which is a huge no-no in the Red Hat world.
The real question is "why" not "how".
Seriously, you cannot justify using that old of a version. There is absolutely no way. Also, you shouldn't be trying to install a 32 bit compiler on a 64 bit machine. Even if yum had it available, you would get library conflicts and it would never install. You can easily do the following and be done with it:
yum install gcc gcc-c++
And that's it. You're done. That's how you install gcc to an RPM based system via yum. If you want 32 bit things going on, away from 64 bit, then install a 32 bit Fedora VM somewhere. Or... you can stay on your 64 bit machine and use this.
export CFLAGS=-m32
# or...
gcc -m32
Have fun.

Error when building OpenCV on my mac: 'Py_ssize_t' issues

I've been following the instructions here: http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port, and have just finished the make -j8 step. Although the make completes to 100%, I am getting errors
make[2]: *** [interfaces/python/CMakeFiles/cvpy.dir/cv.o] Error 1
make[1]: *** [interfaces/python/CMakeFiles/cvpy.dir/all] Error 2
make: *** [all] Error 2
Specific errors I see in the stack trace are all from a file called cv.cpp:
/other/open_cv/opencv/opencv/interfaces/python/cv.cpp:18: error: ‘Py_ssize_t’ does not name a type
/other/open_cv/opencv/opencv/interfaces/python/cv.cpp:206: error: ‘Py_ssize_t’ does not name a type
/other/open_cv/opencv/opencv/interfaces/python/cv.cpp: In function ‘PyObject* iplimage_tostring(PyObject*, PyObject*)’:
/other/open_cv/opencv/opencv/interfaces/python/cv.cpp:282: error: ‘what_size’ was not declared in this scope
/other/open_cv/opencv/opencv/interfaces/python/cv.cpp: In function ‘PyObject* cvmat_tostring(PyObject*, PyObject*)’:
/other/open_cv/opencv/opencv/interfaces/python/cv.cpp:425: error: ‘what_size’ was not declared in this scope
(which continues for a long while). I followed all of the steps and am not sure where I am going wrong. Any help for installing open cv on my mac (Snow Leopard)?
Thanks!
I had an old version of python (MacPython was overriding the default python version). Just get rid of MacPython, and you are good to go.
Make sure you have the most recent svn from the repository.
I could not get the tar ball to build but the svn check out built correctly
"https://code.ros.org/svn/opencv/trunk/opencv"
You will also need the OpenCV.framework for xcode to build the app with.
I found this page to have the best info to get openCV working on an Mac
http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port
So far I have only got this to work on an intel based Mac.