[Kde-bindings] Progress report on Py*5 binding generation
Stephen Kelly
steveire at gmail.com
Wed Apr 20 21:27:49 UTC 2016
Shaheed Haque wrote:
> Specifically, the core logic in sip_generator.py has almost no
> references to anything Qt or KDE specific (there are a few, though I
> expect them to be generally non-intrusive, and they could be factored
> out if anybody cared). The obvious exception is that the CLI defaults
> are Qt and KDE centric, but they are just defaults. For normal sized
> projects with a sane number of files to process, this may be all you
> need, along with your custom rules_XXX.py.
Yes, the defaults got in my way already :).
>> I tried running it on just one header so I can learn some fundamentals of
>> what is happening here. I got an error when I tried to generate:
>>
>> $ ./sip_generator.py /usr/include/KF5/KItemModels/kselectionproxymodel.h
>> > sip/kselectionproxymodel.sip
>> ERROR: Parse error /usr/include/x86_64-linux-
>> gnu/qt5/QtCore/qglobal.h:38[10] 'stddef.h' file not found
>
> Yes; the Clang LLVM compiler front end works like a real compiler :-).
I could get past the above error by specifying on the command line include
directories which are usually built-in when using the clang driver.
However, after that I get more errors:
/usr/include/x86_64-linux-gnu/c++/4.9.3/bits/os_defines.h:44:5: error:
function-like macro '__GLIBC_PREREQ' is not defined
Is there no way to tell libclang to use the built-in includes and defines?
Anyway, we should be able to pass the correct includes to the tool with some
cmake macro.
> However, the specific reason for the failure in your case is that the
> individual SIP files generated from .h files are not intended to be
> compiled standalone (note the bit at the end where it thinks you are
> compiling a C module?). Instead, in each directory, there is a
> <whatever>mod.sip file which collects together all the other files
> into a single compilable unit. Note how the file <whatever>mod.sip
> file is the one that is compiled by default:
Note that I am trying to avoid the built-in KF5 stuff in the tools, so that
1) I can understand the tool and help with the cmake stuff
2) I can know how to use this with non-KF5 libraries
To that end, in addition to sip/kselectionproxymodel.sip I now have:
$ cat sip/kitemmodelsmod.sip
%Module PyKDE5.kitemmodels
%ModuleHeaderCode
#pragma GCC visibility push(default)
%End
%Import QtCore/QtCoremod.sip
%Include kselectionproxymodel.sip
Is this what I am supposed to do? Here is the output I get when attempting
to use it:
$ ./sip_compiler.py --select @kitemmodelsmod.sip sip cxx
INFO: Creating cxx/
ERROR: sip: There is no extract defined with the identifier "includes" while
processing sip/kitemmodelsmod.sip
Traceback (most recent call last):
File "./sip_compiler.py", line 211, in main
d.process_one_module(args.select)
File "./sip_compiler.py", line 145, in process_one_module
self._run_command(cmd)
File "./sip_compiler.py", line 171, in _run_command
raise RuntimeError(stdout)
RuntimeError: sip: There is no extract defined with the identifier
"includes"
The error seems to come from sip. Do you know what it means?
> I believe this is related to needing to link against the underlying
> KF5 library, but I have not automated the hookup needed to test this
> theory:
I can help with the cmake/linking side, but I'm still struggling to get the
tool to work for a trivial case above. Can you help with that?
Thanks,
Steve.
More information about the Kde-bindings
mailing list