Configuration of LLVM for Haskell on M1 Mac - haskell

I installed Haskell on an M1 Mac following the official guide. During the installation, the following message was prompted:
System requirements
Note: On OS X, in the course of running ghcup you will be given a dialog box to install the command line tools. Accept and the requirements will be installed for you. You will then need to run the command again.
On Darwin M1 you might also need a working llvm installed (e.g. via brew) and have the toolchain exposed in PATH.
I additionally installed LLVM using homebrew:
brew install llvm#12
When trying ...
ghc --make <file>
... I get the following error message:
<no location info>: error:
Warning: Couldn't figure out LLVM version!
Make sure you have installed LLVM between [9 and 13)
ghc: could not execute: opt
How can I fix that? Or how can I go about the "have the toolchain exposed in PATH" part of the alert? I'm using ZSH, in case this is of relevance.

Probably not the best solution, but I got it working by adding /opt/homebrew/Cellar/llvm#12/12.0.1_1/bin to the PATH variable.

Related

Error: ASTConsumer.h not found

I'm using Mac to compile "rewritersample.cpp" from https://github.com/eliben/llvm-clang-samples/tree/master/src_clang with clang and I get the following error,
fatal error: 'clang/AST/ASTConsumer.h' file not found
I don't know why I'm getting this error even though I have clang installed on my Mac.
I was getting the same error and I fixed it by installing the libclang-dev library for the version of clang/llvm I was using.
On Linux with LLVM version 5.0 that was (not sure what the command is on a mac - sorry):
sudo apt-get install libclang-5.0-dev
Note that the documentation suggests that these examples are designed to be run with a version of llvm/clang that you have built from source (either by downloading a tarred release or cloning the llvm repository). I was able to get them to build exclusively from a version of LLVM and Clang I installed via my package manager. I had to set the configuration variables for the Makefile as follows:
CXX := /usr/bin/clang++
LLVM_SRC_PATH := /usr/lib/llvm-5.0
LLVM_BUILD_PATH := /usr/lib/llvm-5.0/build
LLVM_BIN_PATH := /usr/lib/llvm-5.0/bin
Again, it's probably a little different on a mac, but hopefully this can help point you in the right direction.

flexdll error with ocaml on cygwin

I just did a fresh install of cygwin64 on windows 10.1.
I installed ocaml package (4.02.3) from the cygwin repository.
I have strange errors related to flexdll :
$ ocaml
OCaml version 4.02.3
#load "str.cma";;
Cannot load required shared library dllcamlstr.
Reason: /usr/lib/ocaml/stublibs/dllcamlstr.so: flexdll error: cannot relocate RELOC_REL32, target is too far: 0xfffffffc12c2a92a 0x12c2a92a.
Do you know what the problem is and how to circumvent it ? In fact, I encountered a similar issue while trying to compile findlib on cygwin from sources.
Best regards,
François
François,
I faced the same problem when trying to compile findlib under cygwin. I was using cygwin's package for ocaml.
My solution has been to uninstall the ocaml package(s) from cygwin, then download and compile ocaml from sources (that is version 4.03.0, instead of 4.02.3 packaged with cygwin), using the following to have the installation replace cygwin's ocaml software:
./configure -prefix /usr -no-curses
make world.opt
make install
Once ocaml installed from sources, configure and build findlib is successful:
cd findlib-1.7.1
./configure
make all
make opt
make install
I hope that helps,
David.

Cannot compile an OS for ARM on OSX

Github page for the OS is here: https://github.com/rellermeyer/course_os
From the wiki in the Github page, it indicates me to install glib and texinfo. It also indicates me how to build the toolchain.
On my first attempt at building, it told me I needed wget and I installed using HomeBrew. When issuing the command $ brew list, I get:
$ brew list
cloog018 glib make postgresql wget
coreutils gmp4 mpfr2 python
gcc48 isl011 openssl readline
gdbm libffi ossp-uuid sqlite
gettext libmpc08 pkg-config texinfo
Which shows me I have everything I need. However, on the second attempt it gives me an error:
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: Systems/course_os/toolchain/arm-none-eabi
checking build system type... Invalid configuration `Systems/course_os/toolchain/arm-none-eabi': machine `Systems/course_os/toolchain/arm-none' not recognized
configure: error: /bin/sh ../../src/gcc-4.8.1/config.sub Systems/course_os/toolchain/arm-none-eabi failed
I don't understand the warning and what it is it's missing. Additionally, when I try to do the same steps with Ubuntu, it runs perfectly and I'm able to go on to building the kernel and run Hello World. What does Ubuntu have that OSX doesn't that makes the OS run? Could it be an issue with gcc?
Note: I'm running OSX Yosemite 10.10 and Ubuntu 14.04.
I found an answer to my problem. There was an issue with one of my target folders being two words. I changed it from Operating System to OS and it ran perfectly. Thanks!

How to install wxHaskell on Windows with MinGW/MSYS

I was trying to install wxHaskell into a machine running Windows XP64, with MinGW/MSYS and wxWidget 3.0 built from source using gcc. I did:
cabal install wx
and got an error:
...
Configuring wxc-0.90.0.4...
setup.exe: wx-config: does not exist
Failed to install wxc-0.90.0.4
cabal.exe: Error: some packages failed to install:
wx-0.90.0.1 depends on wxc-0.90.0.4 which failed to install.
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
wxcore-0.90.0.3 depends on wxc-0.90.0.4 which failed to install.
I had successfully used wxWidgets to write an sample application in C++ (gcc). So I do have a working wxWidget installation. And I have wx-config at:
$ which wx-config
/usr/local/bin/wx-config
The problem is that wx-config is a unix shell script, and cabal (called from MSYS) somehow refuses to recognize it even if it's on the system path. If I run wx-config in MSYS, I get something like:
$ wx-config --cxxflags
-I/usr/local/lib/wx/include/msw-unicode-3.0 -I/usr/local/include/wx-3.0 -D_LARGE
FILE_SOURCE=unknown -DWXUSINGDLL -D__WXMSW__ -mthreads
I have asked a question https://stackoverflow.com/questions/21998763/how-to-convert-msys-shell-scripts-to-windows-exe-files to see if it's possible to convert the script to an exe, but no one responded with any solutions.
There is also a related question here, wxHaskell installation on windows , and another here wx 0.90.0.1 fails to install on Haskell Platform 2012.2.0.0 (WinXP). In fact, I couldn't found an answer that's confirmed to work. Also, the errors/settings here seem to be different, or the answers therein don't seem solve my problem. In particular, I downloaded an external wx-config.exe from https://sourceforge.net/projects/wxhaskell/files/wx-config-win/ per http://www.haskell.org/haskellwiki/WxHaskell/Windows. But running wx-config.exe can't recognize my wxWidget installation and always gives me an error about cannot find wxWidgets, like this:
$ ./wx-config.exe --prefix=/usr/local/
wx-config Error: wxWidgets hasn't been found installed at 'C:\MinGW\msys\1.0\loc
al'.
Please use the --prefix flag (as in wx-config --prefix=C:\wxWidgets)
or set the environment variable WXWIN (as in WXWIN=C:\wxWidgets)
to specify where is your installation of wxWidgets.
Any idea how to work around this issue?
Thanks,
-- Update --
#JP I tried:
C:\temp\wxdirect-0.90.0.1>runhaskell Setup configure --extra-lib-dirs=c:\MinGW\lib --extra-include-dirs=c:\MinGW\include --extra-include-dirs=c:\MinGW\msys\1.0\local\include
Configuring wxdirect-0.90.0.1...
and got
Setup: At least the following dependencies are missing:
containers >=0.2 && <0.5, strict -any
I tweaked wxdirect.cabal to bypass containers >=0.2 && <0.5, but can't get pass strict.
I've written a powershell script that automates the setup of MinGW and the downloading/building of wxWidgets in order to build wxHaskell for Windows 7.
https://github.com/cessationoftime/wxHaskell-Windows-Builder

Mac OS X 10.9, Cannot find appropriate C compiler on this system when install cmake

I'm trying to install cmake in MAC OS X 10.9, and get error log below:
Error when bootstrapping CMake:
Cannot find appropriate C compiler on this system.
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
but i've installed gcc in my os:
localhost:cmake-2.8.11.2 markyoung$ gcc --help
Usage: i686-apple-darwin11-llvm-gcc-4.2 [options] file...
Options:
-pass-exit-codes Exit with highest error code from a phase
--help Display this information
--target-help Display target specific command line options
...
How can I solve the problem?
Use homebrew if that's an option for you. After that:
brew install cmake
worked for me. Caveat: I had already installed gcc-4.8 via brew install gcc48 before that.

Resources