I have a Haskell project called taskell I’d like to compile for the Raspberry Pi Buster. It doesn’t seem to have a binary release for ARM, I contacted the author of the project, and he told me to compile it myself.
In the past I have compiled binaries for different architectures on an x86_x64 with the resulting target binary generated for a different architecture;
For instance the target binary might be for something like an IA64 or an ARM processor using make
and gcc
to compile C++ code and copying the resulting binary to a machine of that architecture type would (most of the time; assuming dependencies fulfilled) allow it run.
I do this for different reasons, for instance on an I64 architecture, I didn’t want to install all the dependencies for compilation on a server. And in the case of ARM (that it being for a Raspberry Pi) I wouldn’t want to beause it would take such a long time to compile.
Now that said, I haven’t tired cross-compiling Haskell for ARM though the Haskell wiki appears to mention a docker image for doing so, and also a guide here. The guide seems a little out of date however, since I can’t seem to download build-dep
that it requires.
(I’m running Ubuntu 18.04 LTS)
When I run apt-get update I get errors like this regarding the architecture:
Err:5 http://us.archive.ubuntu.com/ubuntu bionic/main armhf Packages
404 Not Found [IP: 91.189.91.38 80]
Ign:6 http://us.archive.ubuntu.com/ubuntu bionic/restricted armhf Packages
Ign:7 http://us.archive.ubuntu.com/ubuntu bionic/universe armhf Packages
Ign:8 http://us.archive.ubuntu.com/ubuntu bionic/multiverse armhf Packages
Ign:43 http://us.archive.ubuntu.com/ubuntu bionic-backports/main armhf Packages
Ign:44 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe armhf Packages
Err:27 http://us.archive.ubuntu.com/ubuntu bionic-updates/main armhf Packages
404 Not Found [IP: 91.189.91.38 80]
Ign:33 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted armhf Packages
Ign:36 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe armhf Packages
Ign:39 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse armhf Packages
Err:43 http://us.archive.ubuntu.com/ubuntu bionic-backports/main armhf Packages
404 Not Found [IP: 91.189.91.38 80]
Ign:44 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe armhf Packages
Fetched 5,302 kB in 31s (173 kB/s)
Also, what dpkg --add-architecture <armxx>
command should I run to add multiple architectures? I ran armhf
, but I think it caused some issues with the packages…but I tried to compile it anyway…
leeand00@puppetmaster:~/tmp/dev/projects/llvm/build$ cmake -DCMAKE_INSTALL_PREFIX=/home/leeand00/tmp/dev/llvm_bin -DLLVM_TARGET_ARCH=armhf ../
Followed by:
leeand00@puppetmaster:~/tmp/dev/projects/llvm/build$ cmake --build .
But that resulted in the following error after it compiled for quite a while…
[ 33%] Built target LLVMProfileData
Scanning dependencies of target LLVMPasses
[ 33%] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See [<file:///usr/share/doc/gcc-7/README.Bugs>](file:///usr/share/doc/gcc-7/README.Bugs) for instructions.
lib/Passes/CMakeFiles/LLVMPasses.dir/build.make:62: recipe for target 'lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o' failed
make[2]: *** [lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o] Error 4
CMakeFiles/Makefile2:18886: recipe for target 'lib/Passes/CMakeFiles/LLVMPasses.dir/all' failed
make[1]: *** [lib/Passes/CMakeFiles/LLVMPasses.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
I don’t know what the issue is; but I believe LLVM is used to compile Haskell projects, so if I get that compiled, I should be able to compile taskell
Does anybody have any insight into why it doesn’t compile? Is it my apt-get packages, or is there something else I need to install?