falcon
falcon copied to clipboard
build failure with Makefile, various OSX issues - WIP
make
mkdir -p build/opt
cd build/opt && REALBUILD=1 /Applications/Xcode.app/Contents/Developer/usr/bin/make -f ../../Makefile opt
c++ -O3 -funroll-loops -I../../src -I../../src/sparsehash-2.0.2/src -I/usr/include/python2.7 -Wall -pthread -fno-strict-aliasing -fwrapv -Wall -fPIC -ggdb2 -std=c++0x -funroll-loops -c ../../src/falcon/reval.cc -o reval.o
In file included from ../../src/falcon/reval.cc:9:
In file included from ../../src/falcon/reval.h:15:
In file included from ../../src/falcon/rcompile.h:9:
In file included from ../../src/sparsehash-2.0.2/src/google/dense_hash_map:34:
../../src/sparsehash-2.0.2/src/sparsehash/dense_hash_map:106:10: fatal error: 'tr1/functional' file not found
#include HASH_FUN_H // for hash<>
^
../../src/sparsehash-2.0.2/src/sparsehash/internal/sparseconfig.h:10:20: note: expanded from macro 'HASH_FUN_H'
#define HASH_FUN_H <tr1/functional>
^
1 error generated.
make[1]: *** [reval.o] Error 1
make: *** [opt] Error 2
I am not even sure that falcon runs on OSX. It requires gcc-4.8, currently getting linking failures
It does run on OSX
In [5]: sum(v)
Out[5]: 499500
In [6]: _sum(v)
I 0.000 [22413] src/falcon/rcompile.cc:901 COMPILED _sum, 7 registers, 6 operations, 15 stack ops.
Out[6]: 499500
Steps for a mac build
Note: disregard the commented out sparsehash, I installed that via homebrew.
Makefile build
diff --git a/Makefile b/Makefile
index b3853bc..ac0435a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,8 @@
# shelling out to it. Any additions to the setup.py extension should also
# be made here!
+CXX = g++-4.8
+
ifndef REALBUILD
opt:
@@ -27,10 +29,12 @@ VPATH := $(SRCDIR)/falcon
INCLUDES := $(shell find $(SRCDIR) -name '*.h') ../../Makefile
opt : COPT := -O3 -funroll-loops
-opt : CPPFLAGS := -I$(SRCDIR) -I$(SRCDIR)/sparsehash-2.0.2/src -I/usr/include/python2.7
+# opt : CPPFLAGS := -I$(SRCDIR) -I$(SRCDIR)/sparsehash-2.0.2/src -I/usr/include/python2.7
+opt : CPPFLAGS := -I$(SRCDIR) -I/usr/include/python2.7
dbg : COPT := -DFALCON_DEBUG=1 -O0 -fno-omit-frame-pointer
-dbg : CPPFLAGS := -I$(SRCDIR) -I$(SRCDIR)/sparsehash-2.0.2/src -I/usr/include/python2.7
+# dbg : CPPFLAGS := -I$(SRCDIR) -I$(SRCDIR)/sparsehash-2.0.2/src -I/usr/include/python2.7
+dbg : CPPFLAGS := -I$(SRCDIR) -I/usr/include/python2.7
CFLAGS = $(CPPFLAGS) -Wall -pthread -fno-strict-aliasing -fwrapv -Wall -fPIC -ggdb2 -std=c++0x -funroll-loops
CXXFLAGS = $(CFLAGS)
@@ -47,7 +51,8 @@ dbg: _falcon_core.so
# excluded: rlist.o
_falcon_core.so: reval.o rcompile.o rinst.o rmodule_wrap.o util.o oputil.o rexcept.o register_stack.o \
basic_block.o compiler_state.o compiler_op.o
- g++ -shared -o $@ $^ -lrt
+## g++ -shared -o $@ $^ -lrt
+ $(CXX) -shared -o $@ $^ -lpython -lstdc++
$(SRCDIR)/falcon/rmodule_wrap.cpp: $(SRCDIR)/falcon/rmodule.i $(INCLUDES)
swig -python -Isrc -modern -O -c++ -w312,509 -o $(SRCDIR)/falcon/rmodule_wrap.cpp $(SRCDIR)/falcon/rmodule.i
Command line build using setup.py
CC=gcc-4.8 CXX=g++-4.8 python setup.py develop
gcc-4.8 can be installed via https://github.com/Homebrew/homebrew-versions/blob/master/gcc48.rb