Error: ASTConsumer.h not found - clang++

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.

Related

Configuration of LLVM for Haskell on M1 Mac

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.

Problems between fftw-2.1.5 libraries and OpenMPI

I am trying to install the MPI FFTW2 libraries (fftw2.1.5) as I need them for a program that only works with that version. The specific library I need is "drfftw_mpi.h" so I try the followed:
./configure --enable-mpi --enable-type-prefix
But it always gives me the following error:
configure: error: couldn't find mpi library for --enable-mpi
In a previous question they solve it by running sudo ldconfig before, but for me it does not work giving the same error. For other mpi software they solve it in this post by passing mpicc as the right compiler to ./configure, with the CC flag CC=mpicc, something that does not work for me.
I have installed Open MPI version 4.0.3 on a Ubuntu 20.04 LTS, and when --enable-mpi is not used I was able to install "dfftw.h" "drfftw.h" "fftw.h" and "rfftw.h", do you have an idea of what I am doing wrong or what should I do to install "drfftw_mpi.h"?

How to fix error: Cygwin gcc cannot be used with --compiler=mingw32

I'm trying to install this project: https://github.com/drufat/triangle. Unfortunatly, I get the following error:
error: Cygwin gcc cannot be used with --compiler=mingw32
I'm using the lastest version of gcc for Cygwin on Windows 7 64 bit and I'm trying to install that project for python 3.7.1. It's seems to come from my distutil configuration. My distutils.cfg file contains:
[build]
compiler=mingw32
I tried that solution but it doens't helped:
https://stackoverflow.com/a/16740123/5075502
The gcc options to build for MinGW64 is no longer supported by the regular cygqin compiler gcc, aka x86_64-pc-cygwin-gcc. Instead, you should also install the mingw64-x86_64-gcc-core package which provides the GCC for Win64 toolchain (C, OpenMP). This will also install other packages (through dependencies) which provide compatible binutils, headers, libraries, and runtime.
In your Makefile or compiler command line, replace gcc with x86_64-w64-mingw32-gcc. This will allow you to compile and link executables which do not depend on the cygwin1.dll.
A similar problem occured. I fixed it by changing mingw32 by gcc like #phd said.

Can't install Vision Workbench

I am trying to install the Vision Workbench on my computer, following the instructions from this homepage: http://lunokhod.org/?p=13. I have installed all dependencies but I have libboost1.54-all-dev instead since I am using Mint 17 (Ubuntu 14.4).
After that I have created the config.options file I do ./autogen and ./configure.
However, I get the following in the logfile:
configure:20861: /usr/include/boost is missing these required libraries: BOOST_PROGRAM_OPTIONS BOOST_FILESYSTEM BOOST_THREAD
Checking for a boost in /usr/include/boost-*
Checking for a boost in /usr/local/cuda/include
Checking for a boost in /usr/local/cuda/include/boost-*
configure:20875: checking for package BOOST
HAVE_PKG_BOOST=no
However, in /usr/include/boost/ I have booth program_options, filesystem and thread.
The .so files are under /usr/lib/x86_64-linux-gnu/ for opencv, boost and flann, but somehow it can only find flann.
Does anyone have an idea about where the error might be?
EDIT: In the log-file I saw that the program looked for cxcore when it searched for opencv, but in the new version it is called opencv_core so I did a symbolic link from cxcore to opencv_core and then ./configure finds opencv. However, boost is still a problem and is necessary to build the program.
EDIT2:
I have now downloaded an earlier version of boost (1.42), and almost all boost programs are found except BOOST_THREAD. When I install the boost library I get the following messages:
error: #error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"
/ Erik
try running
./configure --with-boost="path/to/boost"
if you have more than one version of boost installed, you may need to also set environment variables
HAVE_PKG_BOOST=yes
PKG_BOOST_CPPFLAGS=/path/to/boost
PKG_BOOST_LDFLAGS=/path/to/boost

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

Resources