Hi, On Wed, Jan 23, 2013 at 10:06 PM, Stefan Marr <smalltalk@stefan-marr.de>wrote:
Hi:
On 23 Jan 2013, at 18:51, Ciprian Teodorov wrote:
The libs should be 32 bits... but it seems it is not this the issue... I have compiled clang+llvm from sources using the source distribution at: http://www.llvm.org/releases/
then I have built the whole llvm distribution (using the getting started guide): ../src/configure --prefix=<path-to-install-dir> --enable-optimized --enable-jit --target=i686-apple-darwin10
I don't know what the issue is, but building it myself was indeed the solution.
cool...
So, for everyone who likes to use it: (from memory)
wget http://www.llvm.org/releases/3.1/llvm-3.1.src.tar.gz wget http://www.llvm.org/releases/3.1/clang-3.1.src.tar.gz
tar xvf llvm-3.1.src.tar.gz tar xvf clang-3.1.src.tar.gz
mv clang-3.1.src llvm-3.1.src/tools/clang
cd llvm-3.1.src mkdir build cd build ../configure --enable-optimized --enable-jit --target=i686-apple-darwin10 make -j2 # or -j or -j8 or so, compiling takes quite a while...
thank you for putting it all down
If everything compiles well, you'll have a compatible `llvm-3.1.src/build/Release+Asserts/lib/libclang.dylib`
Now I am running in some bugs, I think. I get a change browser which tells me that it is going to create a class with stuff. But then I get a RBAddMethodChange, which doesn't have a `changeClass`. The reason is that the class is not actually created before the method is supposed to be added, I think.
If I manually create the class, it seems to work properly.
This is a problem with Pharo 2.0 ChangesBrowser which does not keep the
items Ordered. My quick fix is to change the underlying structure used by PickListModel. In PickListModel>>initialize replace: *pickedItemsHolder := Set new asValueHolder.* by: *pickedItemsHolder := **OrderedCollection new asValueHolder.* and it will work. Beside that cosmetic problem:
How is the generator supposed to work exactly, does it also load indirectly referenced header classes? Doesn't seem to do that.
No it doesn't... at least not for now. The C to AST conversion supports that, however I've run into some problems with system includes, which use "bizzare" constructs. Besides in my opinion, recursivelly visiting all includes is not a good idea since It my pull lots of definitions that are not necessary. But if you really want it, you can do it by changing CLForeignLibInterfaceGenerator>>wrapperForHeader: aHeaderSpec to send the #everything message to the CLHeaderParser. Such as: CLForeignLibInterfaceGenerator>>wrapperForHeader: aHeaderSpec headerAST := (CLHeaderParser builder: CLNodeBuilder new) headerFile: aHeaderSpec fileName; compilationOptions: aHeaderSpec compilationOptions; everything ; parseHeader. But then will really get everything, getc, time, lchmod ??? you know everything... The example I am experimenting with is:
https://github.com/libgit2/libgit2/blob/development/include/git2.h which includes all the required stuff.
Well, if I add all the headers manually to the generation, I run into the trouble of the non-existing classes again.
So in my opinion the nicest way to do it is just create a list of the headers we really want, and use that such in my LLVM example Happy hacking, Ciprian
Will try to work around that.
Thanks so far Stefan
-- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525
-- Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro