Search code examples
alchemy

How do you generate "l.bc" files?


I have been trying in vain for almost two weeks now to generate a "l.bc" files based on my very own library for building a swc with Alchemy.

I have tried doing (in both alc-on / alc-off modes)

ar rc myOwnLibrary.a myOwnlibraryObj1.o myOwnlibraryObj2.o

But still no l.bc files are generated, instead only .a files are generated.

How do I get the proper l.bc files generated?

PS. I even followed examples in Adobe Alchemy: Compiling a C library to run in Flex/Flash.


Solution

  • You must have alc-on the entire time, when you're using gcc and when using ar. For example:

    $ alc-on
    $ which gcc
    ~/alchemy-darwin-v0.5a/achacks/gcc
    $ which ar
    ~/alchemy-darwin-v0.5a/achacks/ar
    $
    $ ls -l
    total 16
    -rw-r--r--  1   29 May 19 16:59 test1.c
    -rw-r--r--  1   29 May 19 16:59 test2.c
    $
    $ cat test1.c
    int test1() {
       return 0;
    }
    $
    $ cat test2.c
    int test2() {
       return 0;
    }
    $
    $ gcc -c test1.c
    $ gcc -c test2.c
    $ ls -l
    total 32
    -rw-r--r--  1    29 May 19 16:59 test1.c
    -rwxr-xr-x  1   532 May 19 17:17 test1.o
    -rw-r--r--  1    29 May 19 16:59 test2.c
    -rwxr-xr-x  1   532 May 19 17:17 test2.o
    $ ar rc libtest.a test1.o test2.o
    $
    $ ls -l
    total 48
    -rw-------  1   1268 May 19 17:17 libtest.a
    -rw-r--r--  1    668 May 19 17:17 test.l.bc
    -rw-r--r--  1     29 May 19 16:59 test1.c
    -rwxr-xr-x  1    532 May 19 17:17 test1.o
    -rw-r--r--  1     29 May 19 16:59 test2.c
    -rwxr-xr-x  1    532 May 19 17:17 test2.o
    $ 
    

    If this isn't working for you I think you might have a subtly corrupted alchemy installation. I suggest re-installing it.