Compiling ZaaIL with Alchemy – Part 1

This post is to help share the bits of knowledge we gained about Alchemy while porting DevIL to the Flash Platform. Alchemy is an ingenious tool that is used to port C/C++ code onto the Flash platform. There are some great posts out there about how it works, and some great ones about the speed benefits of Alchemy. However, that is not the focus of this series.

As I dove into the project of creating ZaaIL I realized that some more in depth walk-throughs on how Alchemy works may help make this great tool more popular. So in this series, I’m going to walk you through how ZaaIL was created from DevIL.

The first step is to go to the website for DevIL and download the source. Towards the bottom of the download page you’ll notice a section about libraries needed to compile DevIL from source, so we’ll need to download each of these as well.

DevIL Libraries Listing

Here is my folder, I’ve downloaded each of the libraries and unpacked them.

Library Folder Structure

The next step we’ll take is to download Alchemy and get it set up. Adobe’s guide on this is actually pretty good, so here is a link to that guide.

Once you’ve got your environment set up you should have available to you alc-on and alc-off. You’ll notice from the screenshot that these scripts modify your path. They add the directory ALCHEMY_HOME/achacks to the front of your path. The contents of this directory are perl scripts used to circumvent the normal C/C++ compilation tools. [ You heard that right… I think every project starts off as a bunch of perl scripts ].

You also need to note that you should have the bin from Flex SDK version 3.2 in your path. Which can be found here.

[WARNING] Don’t try to be smart and use a different version of the Flex SDK such as the current version 3.5… it won’t work as intended.

Also a special note, all of the paths to your Flex SDK bin and to your ALCHEMY_HOME should not have spaces. If you do have spaces in the path, it may manifest itself as this error “make *** [file_name.o] error 255”.

Path And Achacks Listing

That’s a lot just to get set up, but I promise we’re almost to the good part! In the next post we’ll go into exactly how to compile these libraries using standard C/C++ tools like the configure script and make.

Please feel free to post any questions in the comments. Comments are welcome too 🙂

Tags: , ,

8 Responses to “Compiling ZaaIL with Alchemy – Part 1”