Skip navigation
Currently Being Moderated

upgrading llvm?

Jul 21, 2009 3:30 PM

I'm trying to compile the Speex library with Alchemy 0.5a, but LLVM is crashing:

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -I..      -g -O2 -fvisibility=hidden -MT quant_lsp.lo -MD -MP -MF ".deps/quant_lsp.Tpo" -c -o quant_lsp.lo quant_lsp.c; \
     then mv -f ".deps/quant_lsp.Tpo" ".deps/quant_lsp.Plo"; else rm -f ".deps/quant_lsp.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -I.. -g -O2 -fvisibility=hidden -MT quant_lsp.lo -MD -MP -MF .deps/quant_lsp.Tpo -c quant_lsp.c -o quant_lsp.o
Constants.cpp:1548: failed assertion `C->getType()->isInteger() && Ty->isInteger() && "Invalid cast"'
quant_lsp.c:382: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.org/bugs> for instructions.
mv: rename .deps/quant_lsp.Tpo to .deps/quant_lsp.Plo: No such file or directory
The LLVM used by alchemy is pretty old (v2.1), so I tried upgrading the llvm-gcc compilers (as mentioned here)  However, this doesn't work, as trying to compile a simple "hello world" code results in
opt: Invalid bitcode signature

Any tips on upgrading Alchemy's LLVM?

 
Replies
  • Currently Being Moderated
    Jul 22, 2009 1:34 PM   in reply to paleozogt

    I'm afraid that's the deal.  Adobe created their own, closed source, llc, to compile from llvm 2.1 bytecode into actionscript.  Open sourcing lcc has been mentioned, but it has not happened.  Hence, there are three, horrible, solutions:

    1. Try to backport the bugfix to llvm 2.1, or a compatible llvm version, and use adobe's llc will the fixed llvm version.
    2. Examine the output of adobe's llc and write your own actionscript compiler for a newer llvm release.
    3. Use some kind of binary commenting search to identify the area of code causing the internal error, and rewrite or remove it so as to get the thing to compile.
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 22, 2009 2:00 PM   in reply to paleozogt

    (1) I haven't managed to fix any of the internal compiler errors llvm 2.1 sometimes spews out.  You could try just using 2.2 -- maybe it's close enough.  Otherwise, I wish you luck -- and would be quite interested in your results.  If doing a full blown patch, you'd probably have to comprehend any bytecode changes and make sure they're not included.

     

     

    (3) What I mean here is, trimming down the code you're asking llvm to compile until you find a very small change which triggers the crash, and then either isolating what causes it or tweaking the change so the code doesn't exist.  I.e. originally I have a massive cpp file referencing a number of .h files which is crashing the compiler.  I comment out half of the entire file with #if 0 / #endif, in such a way that it still compiles.  If the crash still occurs, I delete the commented half and comment out half of what's left.  If the crash doesn't occur, I try commenting out the other half.  Eventually things narrow down to one or more key areas, the presence of which the crash hinges on.  If you're lucky, you don't need one of the things that makes it crash and you can just leave it cut out -- otherwise, you can try to rewrite it in some other way so that there is no crash.

     

    I've done this by hand, but I bet llvm could help somehow.  For example, if you got a stack trace on the crash by running the compilation under gdb, it might help reveal where the code was parsing and what was going on.  Of course, once you start understanding that stuff, #1 and #2 are going to look a little more enticing.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 17, 2009 11:58 AM   in reply to paleozogt

    I tried the Alchemy toolkit on various versions of Ubuntu and 7.10 seems to work the best. I'm guessing 7.10 is the version the llvm tools were built against.  The compile errors seem to be related to specific shared libraries in the newer releases, such as libc (/lib/tls/i686/cmov/libc.so.6).

     

    This may not be your case but going with 7.10 seemed to make a lot of my compile problems go away.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2011 3:06 PM   in reply to paleozogt

    Hi Aaron,

     

      Did you ever got speex to work in Alchemy?

     

      Thanks for your tip, I got it to compile.  Had the same issue you did.  Just changed the lines of code with the "issues" and it compiled fine.

     

      But once I ran it, it didn't produce the proper output.  I'm wondering if you did get it to work.

     

      I took the input from the microphone, converted it to PCM, as it's in float format, and sent it to the encoder.

     

      The enconder runs fine, returns a size that I would expect, but the data isn't just right.

     

      When I compare the output from the encoder built running alchemy, the first 4 bytes of each frame are identical to the bytes returned by the win32 executable supplied by speex, but after the 4th byte of each frame the result varies.

     

      So I'm wondering if you got yours to work properly?

     

    Thanks,

     

    -Art

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2011 9:11 AM   in reply to paleozogt

    Thanks,

     

      Do you mind if I ask you a couple of questions, so that I can avoid lunacy?

     

      So that I can me sure the library is working correctly and I'm the one causing the problem.

     

    1)  What version of Speex did you get it working with?

    2)  Did you have to set any option when you ran the ./configure or did you ran it without options.

     

      Now the Byte order issue.

     

    It's my understanding that the output from the microphone is in float format, and it's also my understanding that the input speex is expecting is short format.

     

    Did you send the Float input to the speex codec without converting it to short PCM?  Just flipping the byte order of the float?

     

    Thank you for your time.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2011 9:03 AM   in reply to paleozogt

    Thanks,

     

    I also convert the big-endian float to little-short first multiplying it by 32767.

     

    I'm getting something that sort of resemples the original sound.

     

    I've flipped byte orders, and the impact is dramatic, so I belive I've got that part fine, and if I save the 16 bit short with a WAVE header, it plays just fine in anything else.

     

      I'm either not doing something right in the implementation, or I'm just not seeing some silly mistake,  Debugging in Alchemy isn't the easiest thing, but I've got traces everywhere and all the pointers are where they "should" be.

     

      So I'm wondering if the  ./configure script breaks something.  I'm going to have to try compiling everything in myself, see if that fixes it.

     

      When I look at the pure raw output, it does resemple's alot the output of the .spx file created by the supplied  binaries, but it's not exactly the same, the first 4 bytes of every frame are identical, and the difference increases as more frames go by.  If I change the byte order or anything else, it's dramatically different.  So I'm thinking that the ./configure script misinterprests something and makes a "wrong" adjustment somewhere.

     

    Thanks again.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2011 5:15 PM   in reply to paleozogt

    Thanks, I got it working.

     

    Turns out that you were correct from the beggining.  My issue was with the byteorder, but not with speex itself, as all the enconding and decoding was fine,  it was when outputing to the audio card.  I recalled something you wrote in a different thread.  Although Alchemy itself is little-endian, the byte arrays returned by Alchemy are big-endian (Flash's default).

     

    Thanks,

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points