[packagekit] Problem running example from FAQ

Dorian Perkins dperkins at google.com
Thu Aug 7 11:33:04 PDT 2008


On Thu, Aug 7, 2008 at 11:23 AM, Dorian Perkins <dperkins at google.com> wrote:

> Hi again,
>
> So I am attempting to compile the system.c example Richard linked me to in
> the previous message. I am using the compile string from the website.
>

Just for clarity, this is the compile command:

gcc -o system -Wall system.c `pkg-config --cflags --libs packagekit`


> At first try, I got the following error:
>
> system.c: In function 'main':
> system.c:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before
> '*' token
> system.c:15: error: 'obj' undeclared (first use in this function)
> system.c:15: error: (Each undeclared identifier is reported only once
> system.c:15: error: for each function it appears in.)
> system.c:60: warning: implicit declaration of function
> 'pk_package_list_get_obj'
>
> Then I tried to find the culprit of the first  error "error: expected '=',
> ',', ';', 'asm' or '__attribute__' before '*' token". I removed the "const"
> from the line "const PkPackageObj *obj;" and tried  to compile, giving me
> the error output:
>
> system.c: In function 'main':
> system.c:18: error: 'PkPackageObj' undeclared (first use in this function)
> system.c:18: error: (Each undeclared identifier is reported only once
> system.c:18: error: for each function it appears in.)
> system.c:18: error: 'obj' undeclared (first use in this function)
> system.c:63: warning: implicit declaration of function
> 'pk_package_list_get_obj'
>
> I then tried to track down which header PkPackageObj was being declared in.
> I grep'd for the string in the libpackagekit directory from the git main
> branch (0.2.3) image and noticed it was used in <pk-package-list.h> and
> <pk-package-obj.h>. Also I searched for "pk_package_list_get_obj" which was
> used in <pk-package-list.h>.
>
> I added those header includes to the file, tried to compile again and got
> the same errors. So I looked in /usr/include/packagekit and noticed that
> 'pk-package-obj.h' does not exist there, but 'pk-package-list.h' does.
>
> [/usr/include/packagekit/]
> pk-catalog.h  pk-client.h  pk-common.h  pk-connection.h  pk-control.h
> pk-debug.h  pk-enum.h  pk-extra.h  pk-package-id.h  pk-package-ids.h
> pk-package-item.h  pk-package-list.h  pk-task-list.h
>
> I grep'd for PkPackageObj here are could not find it. I recursively grep'd
> the entire  /usr/include branch for PkPackageObj and found nothing.
>
> And this is where my ideas ended. HELP! :)
>
> Thanks,
> -Dorian
>
>
> On Thu, Aug 7, 2008 at 2:34 AM, Richard Hughes <hughsient at gmail.com>wrote:
>
>> On Wed, 2008-08-06 at 18:53 -0700, Dorian Perkins wrote:
>> > Hello again,
>> >
>> > So I have another question now. In reference to the example at hand,
>> > the FAQ mentions:
>> >       * InstallPackageName("openoffice-clipart")
>> >       * InstallProvideFile("/usr/share/fonts/sarai/Sarai_07.ttf")
>> >       *
>> InstallLocalFile("/home/dave/Desktop/lirc-0.6.6-4.rhfc1.dag.i686.rpm")
>> >       * InstallMimeType("application/x-rpm")
>> >       * InstallFont("lang(en_GB)")
>> > "
>> >
>> > However, I'd like to do other tasks such as EnableRepo() and
>> > GetRepoList(), etc. How can I do this? Am I approaching this the wrong
>> > way?
>>
>> Well, the problem is that you are using the session "easy" interface.
>> See http://www.packagekit.org/pk-faq.html#session-system for an
>> explanation of why you would want to use the session interface in an
>> trivial application, but the system one for more complex or for
>> integrated use cases.
>>
>> To do RepoEnable you'll need to use the system service -- it's more
>> complicated but much more powerful. Luckily there are some nice GObject
>> bindings that make it a lot easier to work with. Have a look at an
>> example file I just uploaded: http://www.packagekit.org/files/system.c
>> -- all the docs for that are here: http://www.packagekit.org/gtk-doc/
>>
>> That's certainly some reading for you to do! :-)
>>
>> Richard.
>>
>>
>>
>> _______________________________________________
>> PackageKit mailing list
>> PackageKit at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/packagekit
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20080807/516eab3b/attachment-0003.htm>


More information about the PackageKit mailing list