Wednesday, January 18, 2012

Shed Skin 0.9.1

I have just released version 0.9.1 of Shed Skin, a restricted-Python (2.4-2.6) to C++ compiler. This is a maintenance release, so no new major features were added. Most interesting perhaps are optimizations for itertools.product and str.join. Other than that, it's mostly bugfixes and a new (hq2x image scaling) example. Please see the release notes for more details.

In the meantime, Paul Boddie has succeeded in getting Shed Skin 0.9 accepted into the Debian repositories, which is awesome for me personally.

17 comments:

Absolon said...

Hello,

First Shed Skin is awesome!!!

Sorry if this is not the channel for ask a question.

How I can made a .o object in Shed Skin that I can link with my python embedded c code?

The make give me a library .so

Thanks,

Alex

Koderok said...

Hello,
I installed Shed Skin 0.9.1 on my Ubuntu 11.04. After setup, I ran "shedskin test.py" which generated C code. Then, on executing "make" command, I am getting the following list of errors :

g++ -O2 -march=native -Wno-deprecated -I. -I/usr/local/lib/python2.7/dist-packages/shedskin/lib test.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/re.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/builtin.cpp -lgc -lpcre -o test
In file included from test.cpp:1:0:
/usr/local/lib/python2.7/dist-packages/shedskin/lib/builtin.hpp:10:29: fatal error: gc/gc_allocator.h: No such file or directory
compilation terminated.
In file included from /usr/local/lib/python2.7/dist-packages/shedskin/lib/re.hpp:9:0,
from /usr/local/lib/python2.7/dist-packages/shedskin/lib/re.cpp:3:
/usr/local/lib/python2.7/dist-packages/shedskin/lib/builtin.hpp:10:29: fatal error: gc/gc_allocator.h: No such file or directory
compilation terminated.
In file included from /usr/local/lib/python2.7/dist-packages/shedskin/lib/builtin.cpp:3:0:
/usr/local/lib/python2.7/dist-packages/shedskin/lib/builtin.hpp:10:29: fatal error: gc/gc_allocator.h: No such file or directory
compilation terminated.
make: *** [test] Error 1

Looking at which, it seems like some file named "gc_allocator.h" is missing. I cannot figure out how to fix this. I have libstdc++6-4.5-dev installed.
Please help !!
I desperately want to try Shed Skin.
Thanks

srepmub said...

sorry for the delayed reply.

@absolon: yeah, I guess the shedskin discussion group (bottom left on the homepage) would be more appropriate. please ask again there, with perhaps an example of what you're trying to do.

@koderok: you need to install the boehm garbage collector. please see the documentation for how to install this on your platform, or look for something called 'libgc'.

Raghavulu said...

Hello,

After installing shedskin, I was trying to run go.py in disco-0.3 as an extension module .

shedskin -brew go.py executed fine.
make is throwing the following error. Please look into this.

g++ -O2 -march=native -Wno-deprecated -I. -I/usr/local/lib/python2.7/dist-packages/shedskin/lib -D__SS_NOWRAP -D__SS_NOBOUNDS -D__SS_FASTRANDOM -g -fPIC -D__SS_BIND -I/usr/include/python2.7 -I/usr/include/python2.7 go.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/time.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/sys.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/re.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/random.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/math.cpp /usr/local/lib/python2.7/dist-packages/shedskin/lib/builtin.cpp -lgc -lpcre -shared -Xlinker -export-dynamic -lpthread -ldl -lutil -lm -lpython2.7 -L/usr/lib/python2.7/config -o go.so
go.cpp: In member function ‘__shedskin__::__ss_bool __go__::Board::useful(__shedskin__::__ss_int)’:
go.cpp:408:33: error: could not convert ‘(__shedskin__::__ss_int)__shedskin__::True.__shedskin__::__ss_bool::operator bool()’ from ‘__shedskin__::__ss_int {aka int}’ to ‘__shedskin__::__ss_bool’
go.cpp:451:12: error: could not convert ‘(__shedskin__::___bool [with T = __shedskin__::__ss_bool](__52.__shedskin__::__ss_bool::operator=(((__shedskin__::__ss_int)__shedskin__::__mbool(((int)dupe.__shedskin__::__ss_bool::operator!())).__shedskin__::__ss_bool::operator bool()))).__shedskin__::__ss_bool::operator!() ? ((__shedskin__::__ss_int)__52.__shedskin__::__ss_bool::operator bool()) : (__shedskin__::___bool [with T = int]((__53 empties)).__shedskin__::__ss_bool::operator bool() ? __53 : (__shedskin__::___bool [with T = int]((__54 weak_opps)).__shedskin__::__ss_bool::operator bool() ? __54 : (__shedskin__::___bool [with T = int]((__55 strong_neighs)).__shedskin__::__ss_bool::operator!() ? __55 : (__shedskin__::___bool [with T = int]((__56 strong_opps)).__shedskin__::__ss_bool::operator bool() ? __56 : weak_neighs)))))’ from ‘__shedskin__::__ss_int {aka int}’ to ‘__shedskin__::__ss_bool’
make: *** [go.so] Error 1

srepmub said...

@raghavalu: this is because disco 0.3 mixes ints and bools, which is not allowed anymore. please see go.py in the shedskin examples package, which changes a single line so it works again. I should probably put out a disco 0.4 with this line changed! thanks for mentioning in any case.

Raghavulu said...

Thank you for your quick reply. I appreciate that. After installing I tried to open GoGui from applications menu, but its not opening up. Please suggest what to do next??

srepmub said...

are you using windows..? the following worked for me last time:

> Label: Disco
> Command: c:\python27\python.exe disco.py
> Working directory: c:\disco

srepmub said...

oh wait, you mean gogui doesn't work at all..? I'm afraid I can't really help with that..

Raghavulu said...

I use ubuntu 12.04.

Raghavulu said...

Please help to find the solution, GoGui is installed, but clicking on GoGui not opening up the game. I use ubuntu 12.04

srepmub said...

grum :P

from a terminal, this works here:

unzip gogui-1.4.6.zip
sudo ./install.sh
gogui

to add disco, for example the version in shedskin/examples on my pc:

Label: Disco
Command: python disco.py
Working directory: /home/srepmub/shedskin/examples

Raghavulu said...

I followed as you suggested, but when I type gogui in terminal its throwing following error

java.awt.HeadlessException
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
at java.awt.Window.(Window.java:535)
at java.awt.Frame.(Frame.java:420)
at java.awt.Frame.(Frame.java:385)
at javax.swing.JFrame.(JFrame.java:174)
at net.sf.gogui.gogui.GoGui.(GoGui.java:159)
at net.sf.gogui.gogui.Main$2.run(Main.java:146)
at java.lang.Thread.run(Thread.java:722)

Exception: java.awt.HeadlessException thrown from the UncaughtExceptionHandler in thread "Thread-2"


Working directory is gogui-1.4.6

srepmub said...

what does 'java -version' say? not openjdk?

Raghavulu said...

java -version command gives following output

java version "1.7.0_09"
OpenJDK Runtime Environment (IcedTea7 2.3.4) (7u9-2.3.4-0ubuntu1.12.04.1)
OpenJDK Server VM (build 23.2-b09, mixed mode)

srepmub said...

if you google for this, you'll find that others see the same error.. perhaps you could try another java version? (java-sun..?) I dunno.

Raghavulu said...

I'm able to run gogui finally. In disco installation instructions I see the following note

In the Program menu, connect it to engine.py. Set the board size to 9x9, and hand the first turn to the computer.

Where do I find engine.py???

srepmub said...

good to hear!

yeah, the instructions in disco 0.3 are wrong. I uploaded a 0.4 version in the meantime with the one-line improvement and better instructions. you have to use 'python disco.py' as the command, and set the working dir to where disco.py etc. are located. don't forget to set the board to 9x9. perhaps you also have to give disco black at this point, not sure.