[Pharo-project] TalkFFI: automatic FFI generation for Pharo
Happy new year everybody! I am pleased to announce today the initial release of TalkFFI. TalkFFI enables *automatic* FFI generation for Smalltalk. It uses libclang <http://clang.llvm.org> to parse *unmodified* C header files and generate FFI bindings to c libraries. For now it supports the generation of NativeBoost FFI bindings. The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI Please do not hesitate send me your comments/critics/ideas. Best regards, -- Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
That's super awesome. Thanks!! And the documentation answer that I was just going to ask you :) *"The libclang bindings themselves were also generated using TalkFFI (using minimal hand-written binding for bootstrapping)."* sweet :) On Sun, Jan 6, 2013 at 1:22 PM, Ciprian Teodorov <ciprian.teodorov@gmail.com
wrote:
Happy new year everybody!
I am pleased to announce today the initial release of TalkFFI.
TalkFFI enables *automatic* FFI generation for Smalltalk. It uses libclang <http://clang.llvm.org> to parse *unmodified* C header files and generate FFI bindings to c libraries. For now it supports the generation of NativeBoost FFI bindings.
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI
Please do not hesitate send me your comments/critics/ideas.
Best regards, -- Dr. Ciprian TEODOROV Ingénieur Développement CAO
tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
-- Mariano http://marianopeck.wordpress.com
On Jan 6, 2013, at 7:07 PM, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
That's super awesome. Thanks!! And the documentation answer that I was just going to ask you :) "The libclang bindings themselves were also generated using TalkFFI (using minimal hand-written binding for bootstrapping)."
sweet :)
Yes, that looks very interesting! Marcus
Hi guys, I have just uploaded a short presentation video on youtube (generation of LLVM mapping), so that you can get the taste of it. http://youtu.be/y_zfgUh27m0 On Sun, Jan 6, 2013 at 7:18 PM, Marcus Denker <marcus.denker@inria.fr>wrote:
On Jan 6, 2013, at 7:07 PM, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
That's super awesome. Thanks!! And the documentation answer that I was just going to ask you :) *"The libclang bindings themselves were also generated using TalkFFI (using minimal hand-written binding for bootstrapping)."*
sweet :)
Yes, that looks very interesting!
Marcus
-- Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
Thanks Ciprian. It is a nice extension :). we should write a little tutorial :) Stef
Happy new year everybody!
I am pleased to announce today the initial release of TalkFFI.
TalkFFI enables automatic FFI generation for Smalltalk. It uses libclang to parse unmodified C header files and generate FFI bindings to c libraries. For now it supports the generation of NativeBoost FFI bindings.
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI
Please do not hesitate send me your comments/critics/ideas.
Best regards, -- Dr. Ciprian TEODOROV Ingénieur Développement CAO
tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
On Sun, Jan 6, 2013 at 7:31 PM, Stéphane Ducasse <stephane.ducasse@inria.fr>wrote:
Thanks Ciprian. It is a nice extension :). we should write a little tutorial :)
Yes a tutorial will come too ... but first I want to test it a little more, and maybe get some feedback from volunteers ;) I will have to check if it works on other platforms besides my mac. Then figure a way to package/distribute easily with libclang - since compiling libclang might not be trivial for a user. Moreover If any of you guys have comments, different usage scenarios, api improvement ideas please don't hesitate. Cheers, Ciprian
Stef
Happy new year everybody!
I am pleased to announce today the initial release of TalkFFI.
TalkFFI enables automatic FFI generation for Smalltalk. It uses libclang to parse unmodified C header files and generate FFI bindings to c libraries. For now it supports the generation of NativeBoost FFI bindings.
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI
Please do not hesitate send me your comments/critics/ideas.
Best regards, -- Dr. Ciprian TEODOROV Ingénieur Développement CAO
tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
-- Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
Yes a tutorial will come too ... but first I want to test it a little more, and maybe get some feedback from volunteers ;)
excellent! For the video, may be use larger fonts.
I will have to check if it works on other platforms besides my mac. Then figure a way to package/distribute easily with libclang - since compiling libclang might not be trivial for a user.
Moreover If any of you guys have comments, different usage scenarios, api improvement ideas please don't hesitate.
Cheers, Ciprian
Stef
Happy new year everybody!
I am pleased to announce today the initial release of TalkFFI.
TalkFFI enables automatic FFI generation for Smalltalk. It uses libclang to parse unmodified C header files and generate FFI bindings to c libraries. For now it supports the generation of NativeBoost FFI bindings.
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI
Please do not hesitate send me your comments/critics/ideas.
Best regards, -- Dr. Ciprian TEODOROV Ingénieur Développement CAO
tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
-- Dr. Ciprian TEODOROV Ingénieur Développement CAO
tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
Wow.. that's great. Having a way to automatically generate bindings makes life much easier :) Few questions: - did you tried to run it against some libraries around there, except from LLVM? - i saw, in video, you can customize generation a bit.. to what extent? Is there interface (suppose i want to use own naming prefix, suppress generation of certain declaration etc)? -- Best regards, Igor Stasenko.
hi Igor, Yes I have tried some little external libraries, nothing big yet (besides llvm, and libclang). For the moment I did not see any show-stopper problems... But there are still some rough edges. What I have under scrutiny right now are: - adding unions to NB - supporting vectors (and constant arrays, which are flattened right now). Vectors appear to be used in cblas. - there are some problems with my callback naming scheme, which I found trying to map Cairo. Besides these there are some improvements to NB, to simplify code generation and maintenance like: - an unified parser for the simplified c declarations. - unifying fieldDecl, enumDecl, fnSpec under a single naming convention... Maybe nativeSpec, or nativeDecl For the customizations I think right now is to early to say that I have a good interface. But certainly over time we will have different filters. Right now you can customize fct names using a block, and u can specify a prefix for the generated classes. I am also thinking about a graphical interface, somewhat on the lines of the dllcc in vw. Anyways I think using libclang offers nice opportunities, maybe retrieving comments from headers, or even autocomplete-like ffi generation... So yeah for now I will call TalkFFI a tech-preview... We will see how it goes ;) Cheers On Jan 7, 2013 1:13 AM, "Igor Stasenko" <siguctua@gmail.com> wrote:
Wow.. that's great. Having a way to automatically generate bindings makes life much easier :)
Few questions: - did you tried to run it against some libraries around there, except from LLVM?
- i saw, in video, you can customize generation a bit.. to what extent? Is there interface (suppose i want to use own naming prefix, suppress generation of certain declaration etc)?
-- Best regards, Igor Stasenko.
On 7 January 2013 12:38, Ciprian Teodorov <ciprian.teodorov@gmail.com> wrote:
hi Igor,
Yes I have tried some little external libraries, nothing big yet (besides llvm, and libclang). For the moment I did not see any show-stopper problems... But there are still some rough edges. What I have under scrutiny right now are: - adding unions to NB - supporting vectors (and constant arrays, which are flattened right now). Vectors appear to be used in cblas. - there are some problems with my callback naming scheme, which I found trying to map Cairo.
Besides these there are some improvements to NB, to simplify code generation and maintenance like: - an unified parser for the simplified c declarations. - unifying fieldDecl, enumDecl, fnSpec under a single naming convention... Maybe nativeSpec, or nativeDecl
Feel free to discuss the details. Getting NB more feature-complete won't hurt anyone :)
For the customizations I think right now is to early to say that I have a good interface. But certainly over time we will have different filters. Right now you can customize fct names using a block, and u can specify a prefix for the generated classes.
I am also thinking about a graphical interface, somewhat on the lines of the dllcc in vw.
Anyways I think using libclang offers nice opportunities, maybe retrieving comments from headers, or even autocomplete-like ffi generation...
So yeah for now I will call TalkFFI a tech-preview... We will see how it goes ;)
Yes, we should start from somewhere, and it looks like a good starting point. About customizations, i was thinking about SWIG-style customization where you can write-down a list of rules, how you would like to generate bindings to some concrete library + target language etc. Since depending on the library, you will need some adjustments here or there, you will find that we're need that inevitably.
Cheers
On Jan 7, 2013 1:13 AM, "Igor Stasenko" <siguctua@gmail.com> wrote:
Wow.. that's great. Having a way to automatically generate bindings makes life much easier :)
Few questions: - did you tried to run it against some libraries around there, except from LLVM?
- i saw, in video, you can customize generation a bit.. to what extent? Is there interface (suppose i want to use own naming prefix, suppress generation of certain declaration etc)?
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
Hey! Got it installed in a Pharo 2.0 image etc. I am on Ubuntu 12.10 64. You wrote I need libclang.so for 32 bits? And version 3.1 specifically? Also, is there a "sanity test" I can run? That verifies libclang + NB etc. I want to try this on a quite simple little C lib. regards, Göran
Hey! On 01/06/2013 05:22 PM, Ciprian Teodorov wrote:
Happy new year everybody!
I am pleased to announce today the initial release of TalkFFI.
Wow! I have been waiting for something "SWIG" like for Squeak/Pharo since... hell, I dunno, since like ever. ;) This kind of stuff might very well be the most important "piece" of the puzzle when it comes to *really* growing Pharo outside of the general Smalltalk community. regards, Göran
On 01/06/2013 05:22 PM, Ciprian Teodorov wrote:
Happy new year everybody!
I am pleased to announce today the initial release of TalkFFI.
Wow! I have been waiting for something "SWIG" like for Squeak/Pharo since... hell, I dunno, since like ever. ;)
This kind of stuff might very well be the most important "piece" of the puzzle when it comes to *really* growing Pharo outside of the general Smalltalk community.
yes! :) Let us escape the image :)
Repository refuses connection. On 06-01-2013 14:22, Ciprian Teodorov wrote:
Happy new year everybody!
I am pleased to announce today the initial release of TalkFFI.
TalkFFI enables /automatic/ FFI generation for Smalltalk. It uses libclang <http://clang.llvm.org> to parse *unmodified* C header files and generate FFI bindings to c libraries. For now it supports the generation of NativeBoost FFI bindings.
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI <http://smalltalkhub.com/#%21/%7ECipT/TalkFFI>
Please do not hesitate send me your comments/critics/ideas.
Best regards, -- Dr. Ciprian TEODOROV Ingénieur Développement CAO
tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com <mailto:ciprian.teodorov@gmail.com> www.teodorov.ro <http://www.teodorov.ro>
Hi Ciprian: On 06 Jan 2013, at 17:22, Ciprian Teodorov wrote:
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI
I was trying to play with TalkFFI, but it looks like libclang3.1 is not compiled correctly or something. How do you build it? In your code I see you are also targeting OSX, so that doesn't seem to be the problem. I was trying to use the MacPorts version of libclang3.1 without having set any special compiler flags. So, I am not entirely sure whether it is build correctly. Any hints are appreciate. Thanks 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
Hi: On 23 Jan 2013, at 15:28, Stefan Marr wrote:
On 06 Jan 2013, at 17:22, Ciprian Teodorov wrote:
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI
I was trying to play with TalkFFI, but it looks like libclang3.1 is not compiled correctly or something.
How do you build it? In your code I see you are also targeting OSX, so that doesn't seem to be the problem.
I was trying to use the MacPorts version of libclang3.1 without having set any special compiler flags. So, I am not entirely sure whether it is build correctly.
I searched a bit more and found the libclang of Xcode (/Developer/usr/clang-ide/lib/libclang.dylib). With that lib it crashes the VM on a callout to parse the header file (clang_createTranslationUnitFromSourceFile). The MacPorts version already stopped way earlier when trying to use clang_createIndex. So, still not a lot of luck. I am on a OSX 10.6 with the latest NBCog, downloaded today (http://pharo.gforge.inria.fr/ci/vm/nbcog/mac/NBCog-mac-latest.zip) Best regards 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
On Wed, Jan 23, 2013 at 11:51 AM, Stefan Marr <smalltalk@stefan-marr.de>wrote:
Hi:
On 23 Jan 2013, at 15:28, Stefan Marr wrote:
On 06 Jan 2013, at 17:22, Ciprian Teodorov wrote:
The project is released under MIT license, and you can find it on the smalltalkhub site. http://smalltalkhub.com/#!/~CipT/TalkFFI
I was trying to play with TalkFFI, but it looks like libclang3.1 is not compiled correctly or something.
How do you build it? In your code I see you are also targeting OSX, so that doesn't seem to be the problem.
I was trying to use the MacPorts version of libclang3.1 without having set any special compiler flags. So, I am not entirely sure whether it is build correctly.
I searched a bit more and found the libclang of Xcode (/Developer/usr/clang-ide/lib/libclang.dylib).
With that lib it crashes the VM on a callout to parse the header file (clang_createTranslationUnitFromSourceFile). The MacPorts version already stopped way earlier when trying to use clang_createIndex.
So, still not a lot of luck.
Maybe the lib needs to be 32 bits? can you check if the lib you are trying is compiled for 32 or 64?
I am on a OSX 10.6 with the latest NBCog, downloaded today ( http://pharo.gforge.inria.fr/ci/vm/nbcog/mac/NBCog-mac-latest.zip)
Best regards 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
-- Mariano http://marianopeck.wordpress.com
Hi Mariano: On 23 Jan 2013, at 16:59, Mariano Martinez Peck wrote:
Maybe the lib needs to be 32 bits? can you check if the lib you are trying is compiled for 32 or 64?
Yes, it needs to be 32bit, but that's not the problem: smarr@minerva ~/tmp/libgit/libgit2$ file /Developer/usr/clang-ide/lib/libclang.dylib /Developer/usr/clang-ide/lib/libclang.dylib: Mach-O universal binary with 2 architectures /Developer/usr/clang-ide/lib/libclang.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /Developer/usr/clang-ide/lib/libclang.dylib (for architecture i386): Mach-O dynamically linked shared library i386 smarr@minerva ~/tmp/libgit/libgit2$ file /opt/local/libexec/llvm-3.1/lib/libclang.dylib /opt/local/libexec/llvm-3.1/lib/libclang.dylib: Mach-O universal binary with 2 architectures /opt/local/libexec/llvm-3.1/lib/libclang.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /opt/local/libexec/llvm-3.1/lib/libclang.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 Both version I have are universal binaries. Best regards 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
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/ <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* * * *There is also a Getting started guide at: * http://llvm.org/releases/3.1/docs/GettingStarted.html As soon as I get some time I'll try to use osx/macport distribs maybe I can figure out what is the problem... If you guys have any ideas on how to easily distribute an image+vm+libclang i'm very interested. For now I'm thinking of doing something like CMakeVMMaker script, but I don't like that the that package seems tigtly couple with VMMaker... Cheers, ciprian On Wed, Jan 23, 2013 at 5:08 PM, Stefan Marr <smalltalk@stefan-marr.de>wrote:
Hi Mariano:
On 23 Jan 2013, at 16:59, Mariano Martinez Peck wrote:
Maybe the lib needs to be 32 bits? can you check if the lib you are trying is compiled for 32 or 64?
Yes, it needs to be 32bit, but that's not the problem:
smarr@minerva ~/tmp/libgit/libgit2$ file /Developer/usr/clang-ide/lib/libclang.dylib /Developer/usr/clang-ide/lib/libclang.dylib: Mach-O universal binary with 2 architectures /Developer/usr/clang-ide/lib/libclang.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /Developer/usr/clang-ide/lib/libclang.dylib (for architecture i386): Mach-O dynamically linked shared library i386
smarr@minerva ~/tmp/libgit/libgit2$ file /opt/local/libexec/llvm-3.1/lib/libclang.dylib /opt/local/libexec/llvm-3.1/lib/libclang.dylib: Mach-O universal binary with 2 architectures /opt/local/libexec/llvm-3.1/lib/libclang.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /opt/local/libexec/llvm-3.1/lib/libclang.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Both version I have are universal binaries.
Best regards 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
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. 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... 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. 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. 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. 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
Hi: On 23 Jan 2013, at 22:06, Stefan Marr wrote:
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.
So, I am on a recent Pharo 2.0 image and experience problems with the ChangesBrowser. Namely, changes are represented as an unordered set, which leads to problems. Most notably, methods are added to non-existing classes before they are created. You probably want to use an order-preserving data structure. A quick hack, I used is just a work around: ChangesBrowser >> #accept | changes | self okToChange ifFalse: [ ^self ]. changes := self pickedChanges sorted: [:a :b | (a isKindOf: RBAddClassChange) and: [(b isKindOf: RBAddClassChange) not]]. changes do: [:change | RBRefactoryChangeManager instance performChange: change ]. window delete Best regards 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
Do you have a case that we can reproduce and so we fix it? One of the problems I fixed yesterday was that the RecentChangeList did not get notification anymore. Stef On Jan 23, 2013, at 6:35 PM, Stefan Marr wrote:
Hi:
On 23 Jan 2013, at 22:06, Stefan Marr wrote:
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.
So, I am on a recent Pharo 2.0 image and experience problems with the ChangesBrowser.
Namely, changes are represented as an unordered set, which leads to problems. Most notably, methods are added to non-existing classes before they are created.
You probably want to use an order-preserving data structure.
A quick hack, I used is just a work around:
ChangesBrowser >> #accept | changes | self okToChange ifFalse: [ ^self ].
changes := self pickedChanges sorted: [:a :b | (a isKindOf: RBAddClassChange) and: [(b isKindOf: RBAddClassChange) not]].
changes do: [:change | RBRefactoryChangeManager instance performChange: change ]. window delete
Best regards 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
On 23 Jan 2013, at 23:06, Stéphane Ducasse wrote:
Do you have a case that we can reproduce and so we fix it? One of the problems I fixed yesterday was that the RecentChangeList did not get notification anymore.
The following example shows two problems with the current PickListModel: | instance | instance := PickListModel new. instance openWithSpec. instance items: {4. 2. 55. 4. 4. }. ^ instance First, all 4s are the same item, and cannot be selected independently. A bug, I would say. Second, the Set does not preserve the order, so `instance pickedItems` does not have the natural order. The problem is that PickListModel >> #initialize initializes the field 'pickedItemsHolder' with a Set. This set is never exposed and not customizable directly. So well, I would say a Set is an unfortunate choice for a list widget. Lists have a natural order, and it is not obvious to me why that order should not be preserved. I might miss here other tradeoffs of course, but replacing the Set by a OrderedCollection solves my current problem. It does not solve the issue with multiple entries however. Best regards Stefan
Stef
On Jan 23, 2013, at 6:35 PM, Stefan Marr wrote:
Hi:
On 23 Jan 2013, at 22:06, Stefan Marr wrote:
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.
So, I am on a recent Pharo 2.0 image and experience problems with the ChangesBrowser.
Namely, changes are represented as an unordered set, which leads to problems. Most notably, methods are added to non-existing classes before they are created.
You probably want to use an order-preserving data structure.
A quick hack, I used is just a work around:
ChangesBrowser >> #accept | changes | self okToChange ifFalse: [ ^self ].
changes := self pickedChanges sorted: [:a :b | (a isKindOf: RBAddClassChange) and: [(b isKindOf: RBAddClassChange) not]].
changes do: [:change | RBRefactoryChangeManager instance performChange: change ]. window delete
Best regards 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
-- 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
Hello https://code.google.com/p/pharo/issues/detail?id=7310 Hope it can help :) Ben On Jan 23, 2013, at 11:55 PM, Stefan Marr wrote:
On 23 Jan 2013, at 23:06, Stéphane Ducasse wrote:
Do you have a case that we can reproduce and so we fix it? One of the problems I fixed yesterday was that the RecentChangeList did not get notification anymore.
The following example shows two problems with the current PickListModel:
| instance |
instance := PickListModel new. instance openWithSpec. instance items: {4. 2. 55. 4. 4. }. ^ instance
First, all 4s are the same item, and cannot be selected independently. A bug, I would say. Second, the Set does not preserve the order, so `instance pickedItems` does not have the natural order.
The problem is that PickListModel >> #initialize initializes the field 'pickedItemsHolder' with a Set. This set is never exposed and not customizable directly. So well, I would say a Set is an unfortunate choice for a list widget. Lists have a natural order, and it is not obvious to me why that order should not be preserved.
I might miss here other tradeoffs of course, but replacing the Set by a OrderedCollection solves my current problem. It does not solve the issue with multiple entries however.
Best regards Stefan
Stef
On Jan 23, 2013, at 6:35 PM, Stefan Marr wrote:
Hi:
On 23 Jan 2013, at 22:06, Stefan Marr wrote:
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.
So, I am on a recent Pharo 2.0 image and experience problems with the ChangesBrowser.
Namely, changes are represented as an unordered set, which leads to problems. Most notably, methods are added to non-existing classes before they are created.
You probably want to use an order-preserving data structure.
A quick hack, I used is just a work around:
ChangesBrowser >> #accept | changes | self okToChange ifFalse: [ ^self ].
changes := self pickedChanges sorted: [:a :b | (a isKindOf: RBAddClassChange) and: [(b isKindOf: RBAddClassChange) not]].
changes do: [:change | RBRefactoryChangeManager instance performChange: change ]. window delete
Best regards 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
-- 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
Hi Stef, I've added a bug entry on this, a few weeks ago... Issue 7209<http://code.google.com/p/pharo/issues/detail?id=7209> On Wed, Jan 23, 2013 at 11:06 PM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
Do you have a case that we can reproduce and so we fix it? One of the problems I fixed yesterday was that the RecentChangeList did not get notification anymore.
Stef
On Jan 23, 2013, at 6:35 PM, Stefan Marr wrote:
Hi:
On 23 Jan 2013, at 22:06, Stefan Marr wrote:
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.
So, I am on a recent Pharo 2.0 image and experience problems with the ChangesBrowser.
Namely, changes are represented as an unordered set, which leads to problems. Most notably, methods are added to non-existing classes before they are created.
You probably want to use an order-preserving data structure.
A quick hack, I used is just a work around:
ChangesBrowser >> #accept | changes | self okToChange ifFalse: [ ^self ].
changes := self pickedChanges sorted: [:a :b | (a isKindOf: RBAddClassChange) and: [(b isKindOf: RBAddClassChange) not]].
changes do: [:change | RBRefactoryChangeManager instance performChange: change ]. window delete
Best regards 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
Hi Ciprian: On 23 Jan 2013, at 22:06, Stefan Marr wrote:
Well, if I add all the headers manually to the generation, I run into the trouble of the non-existing classes again.
After working around the order issue, I am still running into more issues. Some of the classes for which methods are generated are completely missing in the list of generated classes, and other changes in the list result in colliding renames of callback classes. I will try to generate the bindings step by step, seeing what I actually need. But if you would have a chance to look into these problems, that would be great. Below I added the methods I used to generate the bindings. Thanks a lot Stefan !CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 22:04'! libgit2Headers ^ {'git2.h'. 'git2/version.h'. 'git2/common.h'. 'git2/threads.h'. 'git2/errors.h'. 'git2/types.h'. 'git2/oid.h'. 'git2/signature.h'. 'git2/odb.h'. 'git2/repository.h'. 'git2/revwalk.h'. 'git2/merge.h'. 'git2/graph.h'. 'git2/refs.h'. 'git2/reflog.h'. 'git2/revparse.h'. 'git2/object.h'. 'git2/blob.h'. 'git2/commit.h'. 'git2/tag.h'. 'git2/tree.h'. 'git2/diff.h'. 'git2/index.h'. 'git2/config.h'. 'git2/transport.h'. 'git2/remote.h'. 'git2/clone.h'. 'git2/checkout.h'. 'git2/push.h'. 'git2/attr.h'. 'git2/ignore.h'. 'git2/branch.h'. 'git2/refspec.h'. 'git2/net.h'. 'git2/status.h'. 'git2/indexer.h'. 'git2/submodule.h'. 'git2/notes.h'. 'git2/reset.h'. 'git2/message.h'. 'git2/pack.h'. 'git2/stash.h'.}! ! !CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/3/2013 19:41'! libgit2Mapping | path includeDir options builder hFiles | path := self libgit2Path. includeDir := path / 'include'. options := {('-I' , (path / 'include') fullName). '-D__STDC_CONSTANT_MACROS'. '-D__STDC_LIMIT_MACROS'}. hFiles := self libgit2Headers. builder := (CLForeign2NBGenerator for: #LibGit2) platform: NativeBoostConstants mac32PlatformId libPath: (path / 'build/libgit2.dylib') fullName; compilationOptions: options; includeDir: includeDir; addHeaderFiles: hFiles; classPrefix: 'LG2'; ffiSelectorBlock: [ :selector | (selector beginsWith: 'git_') ifTrue: [ (selector copyFrom: 4 to: selector size) withFirstCharacterDownshifted ] ifFalse: [ selector withFirstCharacterDownshifted ] ]; ignoreUnsupported; generate; openChanges! ! !CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 15:06'! libgit2Path ^ FileReference / 'Users/smarr/tmp/libgit/libgit2'! ! -- 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
On Thu, Jan 24, 2013 at 12:01 AM, Stefan Marr <smalltalk@stefan-marr.de>wrote:
Hi Ciprian:
On 23 Jan 2013, at 22:06, Stefan Marr wrote:
Well, if I add all the headers manually to the generation, I run into the trouble of the non-existing classes again.
After working around the order issue, I am still running into more issues.
Some of the classes for which methods are generated are completely missing in the list of generated classes, and other changes in the list result in colliding renames of callback classes.
yes, renaming classes was a good idea... You can try to update to the latest packages, I've modified this to use subclassing instead of renaming, this way if we have n callback that happen to share the same signature, the each one will be a subclass...
I will try to generate the bindings step by step, seeing what I actually need.
But if you would have a chance to look into these problems, that would be great.
Below I added the methods I used to generate the bindings.
Thanks a lot Stefan
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 22:04'! libgit2Headers ^ {'git2.h'. 'git2/version.h'.
'git2/common.h'. 'git2/threads.h'. 'git2/errors.h'.
'git2/types.h'.
'git2/oid.h'. 'git2/signature.h'. 'git2/odb.h'.
'git2/repository.h'. 'git2/revwalk.h'. 'git2/merge.h'. 'git2/graph.h'. 'git2/refs.h'. 'git2/reflog.h'. 'git2/revparse.h'.
'git2/object.h'. 'git2/blob.h'. 'git2/commit.h'. 'git2/tag.h'. 'git2/tree.h'. 'git2/diff.h'.
'git2/index.h'. 'git2/config.h'. 'git2/transport.h'. 'git2/remote.h'. 'git2/clone.h'. 'git2/checkout.h'. 'git2/push.h'.
'git2/attr.h'. 'git2/ignore.h'. 'git2/branch.h'. 'git2/refspec.h'. 'git2/net.h'. 'git2/status.h'. 'git2/indexer.h'. 'git2/submodule.h'. 'git2/notes.h'. 'git2/reset.h'. 'git2/message.h'. 'git2/pack.h'. 'git2/stash.h'.}! !
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/3/2013 19:41'! libgit2Mapping | path includeDir options builder hFiles | path := self libgit2Path. includeDir := path / 'include'. options := {('-I' , (path / 'include') fullName). '-D__STDC_CONSTANT_MACROS'. '-D__STDC_LIMIT_MACROS'}. hFiles := self libgit2Headers. builder := (CLForeign2NBGenerator for: #LibGit2) platform: NativeBoostConstants mac32PlatformId libPath: (path / 'build/libgit2.dylib') fullName; compilationOptions: options; includeDir: includeDir; addHeaderFiles: hFiles; classPrefix: 'LG2'; ffiSelectorBlock: [ :selector | (selector beginsWith: 'git_') ifTrue: [ (selector copyFrom: 4 to: selector size) withFirstCharacterDownshifted ] ifFalse: [ selector withFirstCharacterDownshifted ] ]; ignoreUnsupported; generate; openChanges! !
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 15:06'! libgit2Path ^ FileReference / 'Users/smarr/tmp/libgit/libgit2'! !
-- 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
On Thu, Jan 24, 2013 at 12:11 AM, Ciprian Teodorov < ciprian.teodorov@gmail.com> wrote:
On Thu, Jan 24, 2013 at 12:01 AM, Stefan Marr <smalltalk@stefan-marr.de>wrote:
Hi Ciprian:
On 23 Jan 2013, at 22:06, Stefan Marr wrote:
Well, if I add all the headers manually to the generation, I run into the trouble of the non-existing classes again.
After working around the order issue, I am still running into more issues.
Some of the classes for which methods are generated are completely missing in the list of generated classes, and other changes in the list result in colliding renames of callback classes.
yes, renaming classes was a good idea... You can try to update to the latest packages, I've modified this to use subclassing instead of renaming, this way if we have n callback that happen to share the same signature, the each one will be a subclass...
I wanted to say bad idea ;)
I will try to generate the bindings step by step, seeing what I actually need.
But if you would have a chance to look into these problems, that would be great.
Below I added the methods I used to generate the bindings.
Thanks a lot Stefan
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 22:04'! libgit2Headers ^ {'git2.h'. 'git2/version.h'.
'git2/common.h'. 'git2/threads.h'. 'git2/errors.h'.
'git2/types.h'.
'git2/oid.h'. 'git2/signature.h'. 'git2/odb.h'.
'git2/repository.h'. 'git2/revwalk.h'. 'git2/merge.h'. 'git2/graph.h'. 'git2/refs.h'. 'git2/reflog.h'. 'git2/revparse.h'.
'git2/object.h'. 'git2/blob.h'. 'git2/commit.h'. 'git2/tag.h'. 'git2/tree.h'. 'git2/diff.h'.
'git2/index.h'. 'git2/config.h'. 'git2/transport.h'. 'git2/remote.h'. 'git2/clone.h'. 'git2/checkout.h'. 'git2/push.h'.
'git2/attr.h'. 'git2/ignore.h'. 'git2/branch.h'. 'git2/refspec.h'. 'git2/net.h'. 'git2/status.h'. 'git2/indexer.h'. 'git2/submodule.h'. 'git2/notes.h'. 'git2/reset.h'. 'git2/message.h'. 'git2/pack.h'. 'git2/stash.h'.}! !
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/3/2013 19:41'! libgit2Mapping | path includeDir options builder hFiles | path := self libgit2Path. includeDir := path / 'include'. options := {('-I' , (path / 'include') fullName). '-D__STDC_CONSTANT_MACROS'. '-D__STDC_LIMIT_MACROS'}. hFiles := self libgit2Headers. builder := (CLForeign2NBGenerator for: #LibGit2) platform: NativeBoostConstants mac32PlatformId libPath: (path / 'build/libgit2.dylib') fullName; compilationOptions: options; includeDir: includeDir; addHeaderFiles: hFiles; classPrefix: 'LG2'; ffiSelectorBlock: [ :selector | (selector beginsWith: 'git_') ifTrue: [ (selector copyFrom: 4 to: selector size) withFirstCharacterDownshifted ] ifFalse: [ selector withFirstCharacterDownshifted ] ]; ignoreUnsupported; generate; openChanges! !
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 15:06'! libgit2Path ^ FileReference / 'Users/smarr/tmp/libgit/libgit2'! !
-- 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
-- Dr. Ciprian TEODOROV Ingénieur Développement CAO tél : 06 08 54 73 48 mail : ciprian.teodorov@gmail.com www.teodorov.ro
Hi Stefan, I've just tried libgit2 mapping generation on my machine, at it seems to work without any problems... (well besides the hack on the ChangesBrowser)... Now the thing is that I have the latest packages of TalkFFI, and LibClang. So I recommend that you retry after updating the packages from the repository... However, I did not have time to compile the library and test if the bindings are usable. Let me know if you still have issues, maybe we could work them out ;) Ciprian Sidenote: LibGit2 project seems very interesting, it will be great if we manage to have a nice OO abstraction over it. On Thu, Jan 24, 2013 at 12:01 AM, Stefan Marr <smalltalk@stefan-marr.de>wrote:
Hi Ciprian:
On 23 Jan 2013, at 22:06, Stefan Marr wrote:
Well, if I add all the headers manually to the generation, I run into the trouble of the non-existing classes again.
After working around the order issue, I am still running into more issues.
Some of the classes for which methods are generated are completely missing in the list of generated classes, and other changes in the list result in colliding renames of callback classes.
I will try to generate the bindings step by step, seeing what I actually need.
But if you would have a chance to look into these problems, that would be great.
Below I added the methods I used to generate the bindings.
Thanks a lot Stefan
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 22:04'! libgit2Headers ^ {'git2.h'. 'git2/version.h'.
'git2/common.h'. 'git2/threads.h'. 'git2/errors.h'.
'git2/types.h'.
'git2/oid.h'. 'git2/signature.h'. 'git2/odb.h'.
'git2/repository.h'. 'git2/revwalk.h'. 'git2/merge.h'. 'git2/graph.h'. 'git2/refs.h'. 'git2/reflog.h'. 'git2/revparse.h'.
'git2/object.h'. 'git2/blob.h'. 'git2/commit.h'. 'git2/tag.h'. 'git2/tree.h'. 'git2/diff.h'.
'git2/index.h'. 'git2/config.h'. 'git2/transport.h'. 'git2/remote.h'. 'git2/clone.h'. 'git2/checkout.h'. 'git2/push.h'.
'git2/attr.h'. 'git2/ignore.h'. 'git2/branch.h'. 'git2/refspec.h'. 'git2/net.h'. 'git2/status.h'. 'git2/indexer.h'. 'git2/submodule.h'. 'git2/notes.h'. 'git2/reset.h'. 'git2/message.h'. 'git2/pack.h'. 'git2/stash.h'.}! !
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/3/2013 19:41'! libgit2Mapping | path includeDir options builder hFiles | path := self libgit2Path. includeDir := path / 'include'. options := {('-I' , (path / 'include') fullName). '-D__STDC_CONSTANT_MACROS'. '-D__STDC_LIMIT_MACROS'}. hFiles := self libgit2Headers. builder := (CLForeign2NBGenerator for: #LibGit2) platform: NativeBoostConstants mac32PlatformId libPath: (path / 'build/libgit2.dylib') fullName; compilationOptions: options; includeDir: includeDir; addHeaderFiles: hFiles; classPrefix: 'LG2'; ffiSelectorBlock: [ :selector | (selector beginsWith: 'git_') ifTrue: [ (selector copyFrom: 4 to: selector size) withFirstCharacterDownshifted ] ifFalse: [ selector withFirstCharacterDownshifted ] ]; ignoreUnsupported; generate; openChanges! !
!CLForeign2NBGenerator class methodsFor: 'libgit2' stamp: 'StefanMarr 1/23/2013 15:06'! libgit2Path ^ FileReference / 'Users/smarr/tmp/libgit/libgit2'! !
-- 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
Hi: On 24 Jan 2013, at 20:29, Ciprian Teodorov wrote:
Hi Stefan,
I've just tried libgit2 mapping generation on my machine, at it seems to work without any problems... (well besides the hack on the ChangesBrowser)... Now the thing is that I have the latest packages of TalkFFI, and LibClang. So I recommend that you retry after updating the packages from the repository...
Aaaah... Well, I update one of the things yesterday manually, and was not aware that there is a second repository. My TalkFFI packages were outdated. Well, and I needed to work the ordering issue, so I added CLForeignLibInterfaceGenerator>>#implement mappingModel model changes execute. Now the generation indeed succeeds :) However, trying to do something simple fails with a NBCog VM crash. I am not entirely sure whether I am doing it correct, and whether this is all GC save etc... So here we go with two examples: "try to get the repo head and its name" | repo repoPath cb branches headHandle | repo := NBExternalHandle new. repoPath := NBExternalAddress fromString: '/Users/smarr/tmp/filetree'. LG2RepositoryH uniqueInstance repository_open: repo path: repoPath. headHandle := NBExternalHandle new. LG2RepositoryH uniqueInstance repository_head: headHandle repo: repo. ^ LG2RefsH uniqueInstance reference_name: headHandle. The second one is a bit more complex, it has to use a callback: "try to read all the names of branches" | repo repoPath cb branches | LibGit2Map initialize. repo := NBExternalHandle new. repoPath := NBExternalAddress fromString: '/Users/smarr/tmp/filetree'. LG2RepositoryH uniqueInstance repository_open: repo path: repoPath. branches := OrderedCollection new. cb := LG2BranchHCb161 on: [:name :type :payload | branches add: name ]. LG2BranchH uniqueInstance branch_foreach: repo list_flags: 1 branch_cb: cb payload: NBExternalAddress null. ^ { repo. branches } So, now I am down to the question of how to use TalkFFI and NativeBoostFFI. Any idea what that could be? And how to diagnose these things? Thanks a lot 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
Hi Stefan, just a comment. I spent quite some time on libgit2 bindings before giving up (at the stage where I could browse repo + do a commit) Better to avoid callbacks at all costs - fortunately there is usually an "iterative" API. Also, you must be very careful when passing in parameters, sometimes the libgit2 remembers pointers and when GC moves them, you know... I had to dig into libgit2 sources/attach GDB to find out. Have fun! Jan On 24/01/13 21:24, Stefan Marr wrote:
branches := OrderedCollection new.
cb := LG2BranchHCb161 on: [:name :type :payload | branches add: name ]. LG2BranchH uniqueInstance branch_foreach: repo list_flags: 1 branch_cb: cb payload: NBExternalAddress null.
^ { repo. branches }
So, now I am down to the question of how to use TalkFFI and NativeBoostFFI.
Any idea what that could be? And how to diagnose these things?
Thanks a lot Stefan
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
participants (10)
-
Benjamin -
Casimiro de Almeida Barreto -
Ciprian Teodorov -
Göran Krampe -
Igor Stasenko -
Jan Vrany -
Marcus Denker -
Mariano Martinez Peck -
Stefan Marr -
Stéphane Ducasse