Hello, I'm Nick Fitzgerald. This is my weblog. You can also check out my shared items from Reader and code on GitHub. Feel free to contact me about whatever.
November 4th, 2009
I have had this draft sitting on the back-burner for a while
now, and yesterday's post
encouraged me to finish this one. If more than just the Socket
addon is broken in your install of Io, you may try following these
alternative instructions for building Io and all of the addons.
I stumbled upon the Io language the other day after following a long list of links that started with my reading Paul Graham's list of accumulator-generators in various programming languages. To quote the official Io website verbatim:
Io is a small, prototype-based programming language. Io is inspired by Smalltalk (all values are objects, all messages are dynamic), Self (prototype-based), NewtonScript (differential inheritance), Act1 (actors and futures for concurrency), LISP (code is a runtime inspectable/modifiable tree) and Lua (small, embeddable).
However, what really grabbed my attention was the bits of philosophy from Perspective — Why Another Programming:
The focus of programming language research for the last thirty years has been to combine the expressive power of high level languages like Smalltalk and the performance of low level language like C with little attention paid to advancing expressive power itself. The result has been a series of languages which are neither as fast as C or as expressive as Smalltalk. Io's purpose is to refocus attention on expressiveness by exploring higher level dynamic programming features with greater levels of runtime flexibility and simplified programming syntax and semantics.
It was easy to follow the guide from the docs on building and installing Io,
but most of the addons didn't come out the other end of the process.
Socket in particular was giving me this exception in the Io
interpreter/REPL:
Io> Socket Exception: Failed to load Addon Socket - it appears that the addon exists but was not compiled. You might try running 'make Socket' in the Io source folder. --------- Object Socket Command Line 1
First of all, thanks to all the kind people on the mailing list, and
especially jer on #io, I was able to
get the Socket addon working. In case anyone else has this same
issue, I have gone back through the troubleshooting sessions and derived
exactly what was causing the problem, and made some instructions on how to fix
it cleanly.
sudo aptitude remove libevent and similar commands (depending
on your version of libevent and package manager) did not completely remove it
for me and this was causing issues. I think I ran something like locate
libevent | xargs sudo rm to completely remove everything, but it felt
like a shady command to run then, and it still does now. Hopefully you have
access to someone with more nix experience than me that can give you a better
command to remove libevent completely.
Grab the gzipped tar package
$ wget http://monkey.org/~provos/libevent-1.4.8-stable.tar.gz
and run each the following commands in order.
$ gzip -d libevent-1.4.8-stable.tar.gz && tar -xf libevent-1.4.8-stable.tar && rm libevent-1.4.8-stable.tar $ cd libevent-1.4.8-stable $ ./configure --prefix=/usr $ sudo make
Now run
$ sudo checkinstall -D
which should prompt you for a description, use "libevent". Next, you will be at the main menu for checkinstall. Press "2" to change the name of the package to plain old "libevent", then press "3" to change the version number from "stable" to "1.4.8". Hit enter from the main menu to let checkinstall finish the installation for you.
Call directory back to the dir that has your Io source code and finish up with
$ sudo make clean $ sudo make $ sudo make install
Go ahead and open up the Io REPL and test out Socket!
Io> Socket ==> Socket_0x91d7f10: acceptTimeout = 31536000 appendToWriteBuffer = method(buffer, ...) asyncAccept = Socket_asyncAccept() asyncBind = Socket_asyncBind() asyncConnect = Socket_asyncConnect() asyncListen = Socket_asyncListen() asyncStreamOpen = Socket_asyncStreamOpen() asyncStreamRead = Socket_asyncStreamRead() asyncStreamWrite = Socket_asyncStreamWrite() asyncUdpOpen = Socket_asyncUdpOpen() asyncUdpRead = Socket_asyncUdpRead() asyncUdpWrite = Socket_asyncUdpWrite() bytesPerRead = 4096 bytesPerWrite = 1024 close = Socket_close() connect = method(...) connectTimeout = 60 descriptorId = Socket_descriptorId() errorDescription = Socket_errorDescription() errorNumber = Socket_errorNumber() getSocketReadLowWaterMark = Socket_getSocketReadLowWaterMark() getSocketWriteLowWaterMark = Socket_getSocketWriteLowWaterMark() host = method(...) init = method(...) ipAddress = 0.0.0.0:0 isOpen = Socket_isOpen() isStream = Socket_isStream() isSynchronous = false isValid = Socket_isValid() port = method(...) readBytes = method(numBytes, ...) readListMessage = method(...) readMessage = method(...) readTimeout = 60 readUntilSeq = method(aSeq, ...) serverOpen = method(...) serverWaitForConnection = method(...) setAcceptTimeout = method(...) setBytesPerRead = method(...) setBytesPerWrite = method(...) setConnectTimeout = method(...) setHost = method(ip, ...) setIpAddress = method(...) setIsSynchronous = method(...) setNoDelay = Socket_setNoDelay() setPort = method(port, ...) setReadTimeout = method(...) setSocketReadBufferSize = Socket_setSocketReadBufferSize() setSocketReadLowWaterMark = Socket_setSocketReadLowWaterMark() setSocketWriteBufferSize = Socket_setSocketWriteBufferSize() setSocketWriteLowWaterMark = Socket_setSocketWriteLowWaterMark() setSyncWaitTime = method(...) setWriteTimeout = method(...) streamOpen = method(...) streamRead = method(numBytes, ...) streamReadNextChunk = method(...) streamReadWhileOpen = method(...) streamWrite = method(buffer, writeCallback, ...) syncConnect = method(...) syncStreamRead = method(numBytes, ...) syncStreamReadNextChunk = method(...) syncStreamReadWhileOpen = method(...) syncUdpReadNextChunk = method(...) syncWait = method(...) syncWaitTime = 0.05 syncWriteFromBuffer = method(writeCallback, ...) udpOpen = method(...) udpRead = method(ipAddress, numBytes, ...) udpReadNextChunk = method(ipAddress, ...) udpWrite = Socket_asyncUdpWrite() writeFromBuffer = method(writeCallback, ...) writeListMessage = method(aList, ...) writeMessage = method(aSeq, ...) writeTimeout = 60
Congratulations! Go have fun with Io!
On July 23rd, 2010
On July 19th, 2010
On July 5th, 2010
On June 29th, 2010
On June 25th, 2010
On June 21st, 2010
On June 2nd, 2010
On May 20th, 2010
On May 19th, 2010
On May 2nd, 2010
blog comments powered by Disqus