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”

  1. zedia.net April 21, 2010 at 12:20 pm #

    Keep those coming, this is very interesting. I tried to play with Alchemy yesterday but got stuck on step 8 (of this http://labs.adobe.com/wiki/index.php/Alchemy:Documentation:Getting_Started) , never could get it to work. Anyway I didn’t have the right Flex SDK.

  2. nico April 22, 2010 at 12:22 am #

    For installing/trying Alchemy, don’t focus to compile ZaaIL.The very first step is to compile the stringecho.c sample available in alchemy-sdk. Next you will meet all problems of linking a library with alchemy-gcc…

  3. Aaron Boushley April 22, 2010 at 7:23 am #

    @nico

    For sure. You should definitely start on some of those smaller examples that come in the sdk. However the point of this series is to give an example of how to compile something a little heftier than stringecho. There are quite a few tutorials on how to compile something that is a simple file or two, but when it comes to actually porting large libraries with dependencies there really isn’t much.

Trackbacks/Pingbacks

  1. Tweets that mention Just Blogged: Compiling ZaaIL with Alchemy – Part 1 -- Topsy.com - April 21, 2010

    […] This post was mentioned on Twitter by Nate Beck, Abraham Vázquez , ZaaLabs, topsy_top20k, boushley and others. boushley said: RT @zaalabs: Just Blogged: Compiling ZaaIL with Alchemy – Part 1 http://bit.ly/aCEL42 […]

  2. Compiling ZaaIL with Alchemy – Part 2 | ZaaLabs - April 29, 2010

    […] 2 of our 3 part series on compiling ZaaIL from DevIL using the Adobe Alchemy toolset (you can find Part 1 here). Since Alchemy is at best alpha software… most of what I’m going to explain are fixes […]

  3. Starting out with Alchemy (on a Mac) | Compiling C, C++ to SWC | zedia flash blog - May 13, 2010

    […] Labs and has a detailed list of steps to complete in order to make Alchemy works. The second one is from zaalabs and it gives further information to get it […]

  4. Compiling ZaaIL with Alchemy – Part 3 | ZaaLabs - May 17, 2010

    […] Compiling ZaaIL with Alchemy – Part 1 […]

  5. Alchemy project from Adobe Labs « Tournas Dimitrios - July 17, 2010

    […] Read how to Compile ZaaIL with Alchemy (3-part). […]

Leave a Reply