Difference between revisions of "Compiling MegaHAL on OS X"

(Created page with "Edited from these instructions - http://blog.marc-seeger.de/2008/03/04/compiling-megahal-on-osx/ *Download MegaHAL: http://sourceforge.net/project/showfiles.php?group_id=10585&r...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Home | <<< back to Wiki Home]]
 +
 +
=Build on OS X=
 +
 
Edited from these instructions - http://blog.marc-seeger.de/2008/03/04/compiling-megahal-on-osx/
 
Edited from these instructions - http://blog.marc-seeger.de/2008/03/04/compiling-megahal-on-osx/
 +
*Download MegaHAL: http://sourceforge.net/project/showfiles.php?group_id=10585&release_id=15640
 +
*Search-replace command that worked for me to fix malloc problem:
 +
<code>perl -pi -w -e 's/\#include <malloc.h>/\#include <\/usr\/include\/malloc\/malloc.h>/g;' megahal-9.1.1/*.c</code>
 +
*Force to compile 32 bit
 +
<pre>sed -i .bak 's/CFLAGS=/CFLAGS=-m32 /g' megahal-9.1.1/Makefile </pre>
  
*Download MegaHAL: http://sourceforge.net/project/showfiles.php?group_id=10585&release_id=15640
+
gugh
*Search-replace command that worked for me:
+
 
<pre>perl -pi -w -e 's/\#include <malloc.h>/\#include <\/usr\/include\/malloc\/malloc.h>/g;' megahal-9.1.1/*.c</pre>
+
=Install mh_python=
 +
*<code>make pythonmodule</code> doesn't work
 +
<code>python setup.py build</code>
 +
 
 +
<code>sudo python setup.py build install</code>
 +
 
 +
=Using mh_python=
 +
<pre>
 +
Type "copyright", "credits" or "license()" for more information.
 +
>>> import mh_python as mh
 +
>>> mh.initbrain()
 +
>>> mh.learn("learn from this sentence")
 +
>>> mh.doreply("hello what have you learned?")
 +
'Hello what'
 +
>>> mh.learn("learn from this sentence as well.")
 +
>>> mh.doreply("i am well.")
 +
'Learn from this sentence as well.'
 +
>>>
 +
</pre>

Latest revision as of 08:58, 18 October 2012

Build on OS X

Edited from these instructions - http://blog.marc-seeger.de/2008/03/04/compiling-megahal-on-osx/

perl -pi -w -e 's/\#include <malloc.h>/\#include <\/usr\/include\/malloc\/malloc.h>/g;' megahal-9.1.1/*.c

  • Force to compile 32 bit
sed -i .bak 's/CFLAGS=/CFLAGS=-m32 /g' megahal-9.1.1/Makefile 

gugh

Install mh_python

  • make pythonmodule doesn't work

python setup.py build

sudo python setup.py build install

Using mh_python

Type "copyright", "credits" or "license()" for more information.
>>> import mh_python as mh
>>> mh.initbrain()
>>> mh.learn("learn from this sentence")
>>> mh.doreply("hello what have you learned?")
'Hello what'
>>> mh.learn("learn from this sentence as well.")
>>> mh.doreply("i am well.")
'Learn from this sentence as well.'
>>>