[LLVMdev] Requesting Feedback on my LLVM How-To

Rick Mann rmann at latencyzero.com
Thu Jan 10 23:45:06 PST 2013


On Jan 10, 2013, at 22:10 , Sean Silva <silvas at purdue.edu> wrote:

> On Thu, Jan 10, 2013 at 8:25 AM, Rick Mann <rmann at latencyzero.com> wrote:
>> I've been writing up my experience embedding LLVM in a Cocoa app. If anyone would like to see it and give feedback, I'd appreciate it. It's still not finished, but the first part is there:
>> 
>>        http://roderickmann.org/stuff/LLVMTut/HowToEmbedLLVMWithXcode.html
> 
> This is great. People across the net have been begging for tutorials
> of this nature.

Thanks! As was I…

>> If it's worthy, hopefully it'll end up in the LLVM docs.
> 
> The major issue I see is that this tutorial is for a hardcoded version
> (3.2) of LLVM. It would have to be reworked to always be on ToT and be
> integrated into the build so that it gets updated as APIs change (for
> example, the #import "llvm/Module.h" is already broken).

I didn't realize the API was still so much in flux. I guess the only way to deal with that is for automated builds to break and let us know.

> The highly
> platform (even IDE) specific nature of the tutorial makes this
> difficult, but I think it might be workable if we had our Mac
> buildbots include the relevant software to build this, and disable
> building it on other platforms (that might be annoying for developers
> on other platforms though).

I needed two things: one was just, what APIs do I call to embed the LLVM? The other was, how do I build with Xcode? In truth, I'd like to see an LLVM.framework (and a Clang.framework) built; it would make Xcode development much easier, and would remove a big part of the hassle having to do with finding the right libraries to link in. (It would be nice if a namespace level below llvm existed separated by library boundary, so that it would be evident by linker error what library was missing, but I digress.)

> Regardless, this definitely needs a permanent home! I think this
> tutorial is a great start and would help a lot of people.
> Pragmatically, it might be best to make this an externally-hosted
> tutorial that we could link to (we already do this for at least two
> other tutorials). You may want to put this tutorial standalone on
> github with Sphinx and publish it with github-pages. It might be
> convenient to copy the setup that
> <https://github.com/Jonathan2251/lbd> has, which makes it easy to host
> the generated pages on github-pages (see
> <http://jonathan2251.github.com/lbd/> for the generated version).

I'll check those out. My personal blog is fairly permanent, but better it be served somewhere that has more than one person tending to it.

> However, I think that the part of the tutorial that deals just with
> how to coerce Xcode into properly building a project that interfaces
> with LLVM would be very good to extract and put into a document; I
> think that would help a lot of people get started. I remember that
> this last summer I spent a pretty long amount of time fiddling with
> all of Xcode's knobs in order to get it to work (I'm mostly a
> commandline guy).

Undoubtedly the two (or more) aspects of this how-to can be separated, but sometimes an integrated example like this goes a long way toward fostering understanding. The remaining sections I plan to write are not strictly necessary either, and could be argued orthogonal to this example, but they are helpful and useful in the context of building a Cocoa app that uses LLVM.

Once I get it finished, I'm happy to consider splitting out portions into separate articles. I did amend this one a bit with some "tl;dr" stuff at the top to allow a reader to skip over sections. Perhaps a more thorough effort in this regard might be beneficial.

-- 
Rick







More information about the llvm-dev mailing list