Does it work on macOS?
Has Bon been tested on macOS? When I try to run ./build.sh, I get this:
./build.sh: line 5: cmake: command not found
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
Adding ~/.bon//bin to PATH
Run "source ~/.bashrc" to refresh your environment
I then tried source ~/.bashrc, but I'm not sure what the result was.
Then bon/build folder is empty, and I can see no ~/.bon either.
Thanks for testing it out, Jon. I don't have a Mac, so I personally am unable to verify if it works.
Looks like you don't have CMake installed. I forgot to include this dependency in the installation instructions, which I've now updated: https://github.com/FBMachine/bon/blob/master/docs/ch01-01-installation.md
Thanks again! It would be great to be able to support Mac as soon as possible.
I had cmake (version 3.13.2) installed on another Mac, and here is what I got there:
$ ./build.sh
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LLVM 6.0.0
-- Using LLVMConfig.cmake in: /usr/local/opt/llvm/lib/cmake/llvm
-- Configuring done
-- Generating done
-- Build files have been written to: /Volumes/P3/bon/build
Scanning dependencies of target bon
[ 7%] Building CXX object CMakeFiles/bon.dir/bonCodeGenPass.cc.o
[ 15%] Building CXX object CMakeFiles/bon.dir/bonAST.cc.o
[ 23%] Building CXX object CMakeFiles/bon.dir/bonTypeAnalysisPass.cc.o
[ 30%] Building CXX object CMakeFiles/bon.dir/bonDebugASTPass.cc.o
[ 38%] Building CXX object CMakeFiles/bon.dir/bonParser.cc.o
[ 46%] Building CXX object CMakeFiles/bon.dir/bonTokenizer.cc.o
[ 53%] Building CXX object CMakeFiles/bon.dir/bonModuleState.cc.o
[ 61%] Building CXX object CMakeFiles/bon.dir/bonStdLib.cc.o
[ 69%] Building CXX object CMakeFiles/bon.dir/bon.cc.o
[ 76%] Building CXX object CMakeFiles/bon.dir/bonLogger.cc.o
In file included from /Volumes/P3/bon/src/bonAST.cc:6:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h' file
not found
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonModuleState.cc:6:
In file included from /Volumes/P3/bon/src/bonModuleState.h:9:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h' file
not found
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonCodeGenPass.cc:6:
In file included from /Volumes/P3/bon/src/bonCodeGenPass.h:8:
In file included from /Volumes/P3/bon/src/bonCompilerPass.h:7:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h' file
not found
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonDebugASTPass.cc:6:
In file included from /Volumes/P3/bon/src/bonDebugASTPass.h:8:
In file included from /Volumes/P3/bon/src/bonCompilerPass.h:7:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h' file
not found
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonParser.cc:7:
In file included from /Volumes/P3/bon/src/bonParser.h:8:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h' file
not found
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonTypeAnalysisPass.cc:7:
In file included from /Volumes/P3/bon/src/bonTypeAnalysisPass.h:8:
In file included from /Volumes/P3/bon/src/bonCompilerPass.h:7:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h' file
not found
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:115: CMakeFiles/bon.dir/bonModuleState.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
1 error generated.
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:141: CMakeFiles/bon.dir/bonDebugASTPass.cc.o] Error 1
make[2]: *** [CMakeFiles/bon.dir/build.make:89: CMakeFiles/bon.dir/bonAST.cc.o] Error 1
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:128: CMakeFiles/bon.dir/bonCodeGenPass.cc.o] Error 1
1 error generated.
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:102: CMakeFiles/bon.dir/bonTypeAnalysisPass.cc.o] Error 1
make[2]: *** [CMakeFiles/bon.dir/build.make:76: CMakeFiles/bon.dir/bonParser.cc.o] Error 1
In file included from /Volumes/P3/bon/src/bon.cc:6:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h' file
not found
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:167: CMakeFiles/bon.dir/bon.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/bon.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
Adding ~/.bon//bin to PATH
Run "source ~/.bashrc" to refresh your environment
What version do you see when you run llvm-config --version? It appears whatever version you have is not API compatible with the version Bon was developed with (4.0.1). I'm planning on updating the version being built against, but it would be good to know what version you're using to verify that is the problem.
Also, another problem: MacOS's version of grep no longer supports "-P", which is used in the build script. If you would be comfortable switching to GNU grep to fix this, you can run brew install --with-default-names grep.
Thanks for the patience in working through this.
When you get a chance, try to build the fix_macos branch. That missing file (ObjectLinkingLayer.h) was apparently renamed in later versions.
I'm now trying the fix_macos branch, and I have installed the GNU grep as you suggested. This is now what I get:
1x-193-157-175-83:bon jkleiser$ ./clean.sh
1x-193-157-175-83:bon jkleiser$ ./build.sh
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LLVM 6.0.0
-- Using LLVMConfig.cmake in: /usr/local/opt/llvm/lib/cmake/llvm
-- Configuring done
-- Generating done
-- Build files have been written to: /Volumes/P3/bon/build
Scanning dependencies of target bon
[ 7%] Building CXX object CMakeFiles/bon.dir/bonTokenizer.cc.o
[ 23%] Building CXX object CMakeFiles/bon.dir/bonTypeAnalysisPass.cc.o
[ 23%] Building CXX object CMakeFiles/bon.dir/bonParser.cc.o
[ 30%] Building CXX object CMakeFiles/bon.dir/bonAST.cc.o
[ 38%] Building CXX object CMakeFiles/bon.dir/bonModuleState.cc.o
[ 46%] Building CXX object CMakeFiles/bon.dir/bonCodeGenPass.cc.o
[ 53%] Building CXX object CMakeFiles/bon.dir/bonDebugASTPass.cc.o
[ 61%] Building CXX object CMakeFiles/bon.dir/bonStdLib.cc.o
[ 69%] Building CXX object CMakeFiles/bon.dir/bon.cc.o
[ 76%] Building CXX object CMakeFiles/bon.dir/bonLogger.cc.o
In file included from /Volumes/P3/bon/src/bonTypeAnalysisPass.cc:7:
In file included from /Volumes/P3/bon/src/bonTypeAnalysisPass.h:8:
In file included from /Volumes/P3/bon/src/bonCompilerPass.h:7:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm-4.0/llvm/Config/llvm-config.h' file not found
#include "llvm-4.0/llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonDebugASTPass.cc:6:
In file included from /Volumes/P3/bon/src/bonDebugASTPass.h:8:
In file included from /Volumes/P3/bon/src/bonCompilerPass.h:7:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm-4.0/llvm/Config/llvm-config.h' file not found
#include "llvm-4.0/llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonModuleState.cc:6:
In file included from /Volumes/P3/bon/src/bonModuleState.h:9:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm-4.0/llvm/Config/llvm-config.h' file not found
#include "llvm-4.0/llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonAST.cc:6:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm-4.0/llvm/Config/llvm-config.h' file not found
#include "llvm-4.0/llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonParser.cc:7:
In file included from /Volumes/P3/bon/src/bonParser.h:8:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm-4.0/llvm/Config/llvm-config.h' file not found
#include "llvm-4.0/llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Volumes/P3/bon/src/bonCodeGenPass.cc:6:
In file included from /Volumes/P3/bon/src/bonCodeGenPass.h:8:
In file included from /Volumes/P3/bon/src/bonCompilerPass.h:7:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm-4.0/llvm/Config/llvm-config.h' file not found
#include "llvm-4.0/llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
1 error1 generated.
error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:141: CMakeFiles/bon.dir/bonDebugASTPass.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/bon.dir/build.make:115: CMakeFiles/bon.dir/bonModuleState.cc.o] Error 1
make[2]: *** [CMakeFiles/bon.dir/build.make:102: CMakeFiles/bon.dir/bonTypeAnalysisPass.cc.o] Error 1
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:89: CMakeFiles/bon.dir/bonAST.cc.o] Error 1
1 error generated.
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:128: CMakeFiles/bon.dir/bonCodeGenPass.cc.o] Error 1
make[2]: *** [CMakeFiles/bon.dir/build.make:76: CMakeFiles/bon.dir/bonParser.cc.o] Error 1
In file included from /Volumes/P3/bon/src/bon.cc:6:
In file included from /Volumes/P3/bon/src/bonAST.h:10:
In file included from /Volumes/P3/bon/src/bonLLVM.h:2:
/Volumes/P3/bon/src/bonJIT.h:18:10: fatal error: 'llvm-4.0/llvm/Config/llvm-config.h' file not found
#include "llvm-4.0/llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/bon.dir/build.make:167: CMakeFiles/bon.dir/bon.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/bon.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
~/.bon//bin already in PATH
With macports I needed something like this:
CXX=clang++-mp-4.0 CC=clang-mp-4.0 \
LLVM_DIR=/opt/local/libexec/llvm-4.0/lib/cmake cmake ../src \
&& make