naver / lispe

An implementation of a full fledged Lisp interpreter with Data Structure, Pattern Programming and High level Functions with Lazy Evaluation à la Haskell.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Had to install python@3.8 to compile

avioli opened this issue · comments

This is not really an issue, but a heads-up - I wasn't able to compile this with the default config.

TL;DR;

I had to install python@3.8 and change my Makefile.in to have these:

INCLUDEPYTHON = -I/usr/local/Cellar/python@3.8/3.8.7/Frameworks/Python.framework/Headers
PYTHONLIB = /usr/local/Cellar/python@3.8/3.8.7/Frameworks/Python.framework/Python

OS: macOS 10.14.6 (18G7016) Mojave
Built-in python: 2.7.16

~/repos/lispe ▶ python configure.py 
This is a Mac OS platform

~/repos/lispe ▶ make all libs
mkdir -p bin
mkdir -p objs
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/lispe.cxx -o objs/lispe.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/jagget.cxx -o objs/jagget.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/eval.cxx -o objs/eval.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/elements.cxx -o objs/elements.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/tools.cxx -o objs/tools.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/systems.cxx -o objs/systems.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/maths.cxx -o objs/maths.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/strings.cxx -o objs/strings.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/randoms.cxx -o objs/randoms.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/rgx.cxx -o objs/rgx.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/sockets.cxx -o objs/sockets.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/composing.cxx -o objs/composing.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/jag.cxx -o objs/jag.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/main.cxx -o objs/main.o
g++ -fPIC -std=c++11 -w -c -O3 -DPOSIXREGEX -DUNIX -Iinclude src/lispeditor.cxx -o objs/lispeditor.o
g++ -o bin/lispe objs/lispe.o objs/jagget.o objs/eval.o objs/elements.o objs/tools.o objs/systems.o objs/maths.o objs/strings.o objs/randoms.o objs/rgx.o objs/sockets.o objs/composing.o objs/jag.o objs/main.o objs/lispeditor.o -ldl -lpthread -L/usr/lib/
ar rcs bin/liblispe.a objs/lispe.o objs/jagget.o objs/eval.o objs/elements.o objs/tools.o objs/systems.o objs/maths.o objs/strings.o objs/randoms.o objs/rgx.o objs/sockets.o objs/composing.o
ranlib bin/liblispe.a
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C curl clean all
rm -f ../objs/curl/*.o
mkdir -p ../objs/curl
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I../include -Iinclude -Iinclude/linux src/lispe_curl.cxx -o ../objs/curl/lispe_curl.o
g++ -shared -o ../bin/liblispe_curl.so ../objs/curl/lispe_curl.o -L../bin -llispe -ldl -L/usr/lib/ -lcurl -lpthread
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C xml clean all
rm -f ../objs/xml/*.o
mkdir -p ../objs/xml
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I../include -Iinclude src/lispe_xml.cxx -o ../objs/xml/lispe_xml.o
g++ -shared -o ../bin/liblispe_xml.so ../objs/xml/lispe_xml.o -L../bin -lxml2 -llispe -ldl -pthread -L/usr/lib/
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C sqlite clean all
rm -f ../objs/sqlite/*.o
mkdir -p ../objs/sqlite
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_THREADSAFE -I../include -Iinclude src/lispe_sqlite.cxx -o ../objs/sqlite/lispe_sqlite.o
g++ -shared -o ../bin/liblispe_sqlite.so ../objs/sqlite/lispe_sqlite.o -L../bin -L/usr/lib/ -lsqlite3 -llispe -ldl -lpthread
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C pythonlispe clean all
rm -f ../objs/python/*.o
mkdir -p ../objs/python
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I/Library/Frameworks/Python.framework/Versions/3.8/Headers -I../include -Iinclude src/lispe_python.cxx -o ../objs/python/lispe_python.o
src/lispe_python.cxx:24:10: fatal error: 'Python.h' file not found
#include <Python.h>
         ^~~~~~~~~~
1 error generated.
make[1]: *** [../objs/python/lispe_python.o] Error 1
make: *** [libs] Error 2

Both /Library/Frameworks/Python.framework/Versions/3.8/Headers and /Library/Frameworks/Python.framework/Versions/3.8/Python do not exist.

So I assumed I have to install Python 3.8 - since I'm on macOS and have Homebrew installed I ran brew install python@3.8, then edited my Makefile.in to replace these lines:

- INCLUDEPYTHON = -I/Library/Frameworks/Python.framework/Versions/3.8/Headers
- PYTHONLIB = /Library/Frameworks/Python.framework/Versions/3.8/Python
+ INCLUDEPYTHON = -I/usr/local/Cellar/python@3.8/3.8.7/Frameworks/Python.framework/Headers
+ PYTHONLIB = /usr/local/Cellar/python@3.8/3.8.7/Frameworks/Python.framework/Python

then re-ran make:

~/repos/lispe ▶ make all libs
mkdir -p bin
mkdir -p objs
g++ -o bin/lispe objs/lispe.o objs/jagget.o objs/eval.o objs/elements.o objs/tools.o objs/systems.o objs/maths.o objs/strings.o objs/randoms.o objs/rgx.o objs/sockets.o objs/composing.o objs/jag.o objs/main.o objs/lispeditor.o -ldl -lpthread -L/usr/lib/
ar rcs bin/liblispe.a objs/lispe.o objs/jagget.o objs/eval.o objs/elements.o objs/tools.o objs/systems.o objs/maths.o objs/strings.o objs/randoms.o objs/rgx.o objs/sockets.o objs/composing.o
ranlib bin/liblispe.a
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C curl clean all
rm -f ../objs/curl/*.o
mkdir -p ../objs/curl
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I../include -Iinclude -Iinclude/linux src/lispe_curl.cxx -o ../objs/curl/lispe_curl.o
g++ -shared -o ../bin/liblispe_curl.so ../objs/curl/lispe_curl.o -L../bin -llispe -ldl -L/usr/lib/ -lcurl -lpthread
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C xml clean all
rm -f ../objs/xml/*.o
mkdir -p ../objs/xml
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I../include -Iinclude src/lispe_xml.cxx -o ../objs/xml/lispe_xml.o
g++ -shared -o ../bin/liblispe_xml.so ../objs/xml/lispe_xml.o -L../bin -lxml2 -llispe -ldl -pthread -L/usr/lib/
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C sqlite clean all
rm -f ../objs/sqlite/*.o
mkdir -p ../objs/sqlite
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_THREADSAFE -I../include -Iinclude src/lispe_sqlite.cxx -o ../objs/sqlite/lispe_sqlite.o
g++ -shared -o ../bin/liblispe_sqlite.so ../objs/sqlite/lispe_sqlite.o -L../bin -L/usr/lib/ -lsqlite3 -llispe -ldl -lpthread
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C pythonlispe clean all
rm -f ../objs/python/*.o
mkdir -p ../objs/python
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I/usr/local/Cellar/python@3.8/3.8.7/Frameworks/Python.framework/Headers -I../include -Iinclude src/lispe_python.cxx -o ../objs/python/lispe_python.o
g++ -shared -o ../bin/pylispe.so ../objs/python/lispe_python.o /usr/local/Cellar/python@3.8/3.8.7/Frameworks/Python.framework/Python -L../bin -llispe -ldl -lpthread -L/usr/lib/
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C transducer clean all
rm -f ../objs/transducer/*.o
mkdir -p ../objs/transducer
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I../include -Iinclude src/lispe_transducer.cxx -o ../objs/transducer/lispe_transducer.o
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I../include -Iinclude src/automaton.cxx -o ../objs/transducer/automaton.o
g++ -std=c++11 -fPIC -w -c -O3 -DUNIX -I../include -Iinclude src/conversion.cxx -o ../objs/transducer/conversion.o
g++ -shared -o ../bin/liblispe_transducer.so ../objs/transducer/lispe_transducer.o ../objs/transducer/automaton.o ../objs/transducer/conversion.o -L../bin -llispe -ldl -lpthread -L/usr/lib/

And now I have ./bin/lispe to run:

Lisp Elémentaire (1.2021.1.27.14.31/40201)

help: display available commands

<> 1> 

Hello,

thank you for your remark. Actually, the Python Library is compiled as a .so library and is not required to run the language... On most Linux platforms, I check which version of Python is installed, while on Mac OS, I simply over-write the existing Makefile.in , which alas, imposes Python 3.8... I should have been more careful... I will try to amend the configure script to take this into account. By the way, in the directory binaries already contain compiled version of the language for Mac OS... :-)