Skip to contentSkip to conversation

compile error for handwritten "perl-RPM2", 'RPM_GNUC_NULL_TERMINATED' error

DISCUSSION Robert P. J. Day 2 participants 4 messages Nov 8, 2016

lore
Share & tools
lore
#0 lore raw

following on my earlier post, here's the specific issue i'm
tackling. having found no existing OE recipe equivalent to a centos "perl-RPM2" RPM, i wrote my own. here's the info about that RH RPM on my fedora system, so i know what the final result should look like:

  $ rpm -ql perl-RPM2
  /usr/lib64/perl5/vendor_perl/RPM2.pm
  /usr/lib64/perl5/vendor_perl/auto/RPM2
  /usr/lib64/perl5/vendor_perl/auto/RPM2/RPM2.so
  /usr/share/doc/perl-RPM2
  /usr/share/doc/perl-RPM2/Changes
  /usr/share/doc/perl-RPM2/README
  /usr/share/man/man3/RPM2.3pm.gz
  $

so, as before, track down the source at cpan:

https://metacpan.org/pod/RPM2

and write a boilerplate recipe, "perl-rpm2", containing the following line since it's an older style recipe:

inherit cpan_build

fetching works fine:

  $ bitbake -c fetchall perl-rpm2

but here's the problem:

  $ bitbake perl-rpm2

... snip ...

| DEBUG: Executing shell function do_compile
| Copying lib/RPM2.pm -> blib/lib/RPM2.pm
| lib/RPM2.xs -> lib/RPM2.c
| powerpc-poky-linux-gcc -m32 -mhard-float -mcpu=7400 -mno-spe

--sysroot=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc -I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/lib/perl/5.22.1/CORE
-DVERSION="1.3" -DXS_VERSION="1.3" -fPIC -DRPM2_API=5004 -I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm
-c -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/work/ppc7400-poky-linux/perl/5.22.1-r0=/usr/src/debug/perl/5.22.1-r0 -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc=
-DDEBIAN -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2
-pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/work/ppc7400-poky-linux/perl-rpm2/1.3-r0=/usr/src/debug/perl-rpm2/1.3-r0 -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc=
-O2 -o lib/RPM2.o lib/RPM2.c
| In file included from
/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmcli.h:9:0,
| from lib/RPM2.xs:3:
|
/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:
In function 'rpmExpand':
|
/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:249:2:
error: expected declaration specifiers before
'RPM_GNUC_NULL_TERMINATED'

|   RPM_GNUC_NULL_TERMINATED
|   ^~~~~~~~~~~~~~~~~~~~~~~~
|
/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:260:2:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'RPM_GNUC_NULL_TERMINATED'
|   RPM_GNUC_NULL_TERMINATED
|   ^~~~~~~~~~~~~~~~~~~~~~~~

... big snip, lots more errors ...

that looks like that macro isn't defined -- on my fedora system,
it's defined as part of the "rpm-devel" rpm, which loads up /usr/include/rpm/ with all sorts of rpm-related header files.

so if i pop back to the build directory for "rpm" and check
"deploy-rpms", sure enough:

$ rpm -qpl rpm-dev-5.4.16-r0.ppc7400.rpm
warning: rpm-dev-5.4.16-r0.ppc7400.rpm: Header V4 DSA/SHA1 Signature,
key ID e638bdb5: NOKEY
/usr
/usr/include
/usr/include/rpm
/usr/include/rpm/argv.h
/usr/include/rpm/mire.h
/usr/include/rpm/pkgio.h
/usr/include/rpm/rpm46compat.h
/usr/include/rpm/rpm4compat.h
/usr/include/rpm/rpmbf.h
/usr/include/rpm/rpmbuild.h
/usr/include/rpm/rpmcb.h
/usr/include/rpm/rpmcli.h
/usr/include/rpm/rpmconstant.h
/usr/include/rpm/rpmdb.h
/usr/include/rpm/rpmds.h
/usr/include/rpm/rpmevr.h
/usr/include/rpm/rpmfi.h
/usr/include/rpm/rpmgi.h
/usr/include/rpm/rpmio.h
/usr/include/rpm/rpmiotypes.h
/usr/include/rpm/rpmlog.h
/usr/include/rpm/rpmmacro.h
/usr/include/rpm/rpmns.h
/usr/include/rpm/rpmpgp.h
/usr/include/rpm/rpmps.h
/usr/include/rpm/rpmrc.h
/usr/include/rpm/rpmspec.h
/usr/include/rpm/rpmsw.h
/usr/include/rpm/rpmtag.h
/usr/include/rpm/rpmte.h
/usr/include/rpm/rpmts.h
/usr/include/rpm/rpmtypes.h
/usr/include/rpm/rpmutil.h
... more ...

so, later this morning, i'm going to take the obvious approach and
install "rpm-dev" to see if that fixes things (and subsequently add that dependency to the perl-rpm2 recipe).

does that make sense? it *seems* clear that to build perl-rpm2, i'll
need the rpm-dev package installed. am i on the right track here?

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw

replying to my earlier post with additional info ... man, i want to
debug this ...

Quoted 72 lines · Robert P. J. Day

following on my earlier post, here's the specific issue i'm
tackling. having found no existing OE recipe equivalent to a centos "perl-RPM2" RPM, i wrote my own. here's the info about that RH RPM on my fedora system, so i know what the final result should look like:

  $ rpm -ql perl-RPM2
  /usr/lib64/perl5/vendor_perl/RPM2.pm
  /usr/lib64/perl5/vendor_perl/auto/RPM2
  /usr/lib64/perl5/vendor_perl/auto/RPM2/RPM2.so
  /usr/share/doc/perl-RPM2
  /usr/share/doc/perl-RPM2/Changes
  /usr/share/doc/perl-RPM2/README
  /usr/share/man/man3/RPM2.3pm.gz
  $

so, as before, track down the source at cpan:

https://metacpan.org/pod/RPM2

and write a boilerplate recipe, "perl-rpm2", containing the following line since it's an older style recipe:

inherit cpan_build

fetching works fine:

  $ bitbake -c fetchall perl-rpm2

but here's the problem:

  $ bitbake perl-rpm2

... snip ...

| DEBUG: Executing shell function do_compile
| Copying lib/RPM2.pm -> blib/lib/RPM2.pm
| lib/RPM2.xs -> lib/RPM2.c
| powerpc-poky-linux-gcc -m32 -mhard-float -mcpu=7400 -mno-spe

--sysroot=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc

(quoted diff) +0 -14
-I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/lib/perl/5.22.1/CORE
-DVERSION="1.3" -DXS_VERSION="1.3" -fPIC -DRPM2_API=5004
-I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm
-c -O2 -pipe -g -feliminate-unused-debug-types
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/work/ppc7400-poky-linux/perl/5.22.1-r0=/usr/src/debug/perl/5.22.1-r0
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/x86_64-linux=
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc=
-DDEBIAN -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2
-pipe -g -feliminate-unused-debug-types
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/work/ppc7400-poky-linux/perl-rpm2/1.3-r0=/usr/src/debug/perl-rpm2/1.3-r0
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/x86_64-linux=
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc=
-O2 -o lib/RPM2.o lib/RPM2.c

| In file included from /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmcli.h:9:0,
| from lib/RPM2.xs:3:
| /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:
In function 'rpmExpand':
| /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:249:2:
error: expected declaration specifiers before
'RPM_GNUC_NULL_TERMINATED'

|   RPM_GNUC_NULL_TERMINATED
|   ^~~~~~~~~~~~~~~~~~~~~~~~
|
/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:260:2:
error: expected '=', ',', ';', 'asm' or '__attribute__' before
'RPM_GNUC_NULL_TERMINATED'
|   RPM_GNUC_NULL_TERMINATED
|   ^~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line

... big snip, lots more errors ...

ok, here's my wildly-uneducated record of what is going on:

first, unpacking and configuring perl-RPM2 source (and running XS
processor) gives me the source file "lib/RPM2.c" (which is what is generating the first build error above), which includes the header file:

  #include <rpm/rpmcli.h>

next, wander over to the qemuppc sysroot, to usr/include/rpm/, to
check out that header file, which contains (among other things):

  #include <popt.h>
  #include <rpmmacro.h>      <----- there
  #include <rpmtypes.h>
  #include <rpmtag.h>
  #include <rpmps.h>
  #include <rpmrc.h>
  #include <rpmfi.h>      /* XXX rpmfileAttrs */
  #include <rpmts.h>      /* XXX rpmdepFlags *

next, in the same directory, examine rpmmacro.h, which contains:

  #if defined(_MACRO_INTERNAL)
  #include <rpmiotypes.h>
  ... snip ...

at this point, inclusion is now conditional on _MACRO_INTERNAL, so
move on to rpmiotypes.h, which contains:

  #include <rpmutil.h>

and finally visit that header file in the qemuppc sysroot to find:

  #if     __GNUC__ >= 4
  #define RPM_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
  #else
  #define RPM_GNUC_NULL_TERMINATED
  #endif

where we find the definition of that macro.

now, is it my imagination, or could a lot of this compile-time error
be resolved by simply defining the macro "_MACRO_INTERNAL" for the build? and if so, what is the proper way to add that setting to the compile step for this recipe?

would i use the standard EXTRA_* variables? or are there
perl-specific variables one would use when build CPAN recipes? or am i totally off-track here?

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#2 lore raw

NOTE: by convention, OE perl recipes follow debian naming so this should be librpm2-perl_1.3.bb
Obviously, in your own layer you are free to do what you want, but it will require the name change if you want it to go into meta-perl.

For dependencies, since you are looking at CentOS rpms, you can look at, e.g. [0] to see the DEPENDS (BuildRequires:) and RDEPENDS (Requires:). This would have shown you the need for rpm-devel.

I also use metacpan, e.g. [1], to look for dependencies in perl modules. It also has a very slick ElasticSearch JSON API that you can use to automatically query data [2].

To pass in the extra variables, for 'inherit cpan' you probably need to set EXTRA_CPANFLAGS [3] or for 'inherit cpan_build' EXTRA_CPAN_BUILD_FLAGS [4], e.g. [5].

You might want to file a documentation bug for the next release?

[0]
http://pkgs.fedoraproject.org/cgit/rpms/perl-RPM2.git/tree/perl-RPM2.spec?h=epel7
[1] https://metacpan.org/pod/RPM2
[2] https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md
[3]
http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/cpan.bbclass#n20
[4]
http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/cpan_build.bbclass#n21
[5]
http://git.openembedded.org/meta-openembedded/tree/meta-perl/recipes-perl/libxml/libxml-libxml-perl_2.0121.bb#n37

Quoted 164 lines · Robert P. J. Day

replying to my earlier post with additional info ... man, i want to
debug this ...

Quoted 32 lines · Robert P. J. Day

following on my earlier post, here's the specific issue i'm
tackling. having found no existing OE recipe equivalent to a centos "perl-RPM2" RPM, i wrote my own. here's the info about that RH RPM on my fedora system, so i know what the final result should look like:

  $ rpm -ql perl-RPM2
  /usr/lib64/perl5/vendor_perl/RPM2.pm
  /usr/lib64/perl5/vendor_perl/auto/RPM2
  /usr/lib64/perl5/vendor_perl/auto/RPM2/RPM2.so
  /usr/share/doc/perl-RPM2
  /usr/share/doc/perl-RPM2/Changes
  /usr/share/doc/perl-RPM2/README
  /usr/share/man/man3/RPM2.3pm.gz
  $

so, as before, track down the source at cpan:

https://metacpan.org/pod/RPM2

and write a boilerplate recipe, "perl-rpm2", containing the following line since it's an older style recipe:

inherit cpan_build

fetching works fine:

  $ bitbake -c fetchall perl-rpm2

but here's the problem:

  $ bitbake perl-rpm2
Quoted 8 lines

... snip ...

| DEBUG: Executing shell function do_compile
| Copying lib/RPM2.pm -> blib/lib/RPM2.pm
| lib/RPM2.xs -> lib/RPM2.c
| powerpc-poky-linux-gcc -m32 -mhard-float -mcpu=7400 -mno-spe

--sysroot=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc -I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/

usr/lib/perl/5.22.1/CORE

Review

Quoted 2 lines
(quoted diff) +0 -2
-DVERSION="1.3" -DXS_VERSION="1.3" -fPIC -DRPM2_API=5004
-I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/

usr/include/rpm

Review

Quoted 2 lines
(quoted diff) +0 -2
-c -O2 -pipe -g -feliminate-unused-debug-types
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/

tmp/work/ppc7400-poky-linux/perl/5.22.1-r0=/usr/src/debug/perl/5.22.1-r0

Quoted 1 line

-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/

tmp/sysroots/x86_64-linux=

Quoted 1 line

-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/

tmp/sysroots/qemuppc=

Review

Quoted 4 lines
(quoted diff) +0 -4
-DDEBIAN -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2
-pipe -g -feliminate-unused-debug-types
-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/

tmp/work/ppc7400-poky-linux/perl-rpm2/1.3-r0=/usr/src/ debug/perl-rpm2/1.3-r0

Quoted 1 line

-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/

tmp/sysroots/x86_64-linux=

Quoted 1 line

-fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/

tmp/sysroots/qemuppc=

Quoted 3 lines

-O2 -o lib/RPM2.o lib/RPM2.c
| In file included from /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/

usr/include/rpm/rpmcli.h:9:0,

Quoted 3 lines

| from lib/RPM2.xs:3:
| /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/

usr/include/rpm/rpmmacro.h:

Quoted 3 lines

In function 'rpmExpand':
| /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/

usr/include/rpm/rpmmacro.h:249:2:

Quoted 6 lines

error: expected declaration specifiers before
'RPM_GNUC_NULL_TERMINATED'

|   RPM_GNUC_NULL_TERMINATED
|   ^~~~~~~~~~~~~~~~~~~~~~~~
|

/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/

usr/include/rpm/rpmmacro.h:260:2:

Quoted 6 lines

error: expected '=', ',', ';', 'asm' or '__attribute__' before 'RPM_GNUC_NULL_TERMINATED'

|   RPM_GNUC_NULL_TERMINATED
|   ^~~~~~~~~~~~~~~~~~~~~~~~

... big snip, lots more errors ...

ok, here's my wildly-uneducated record of what is going on:

first, unpacking and configuring perl-RPM2 source (and running XS
processor) gives me the source file "lib/RPM2.c" (which is what is generating the first build error above), which includes the header file:

  #include <rpm/rpmcli.h>

next, wander over to the qemuppc sysroot, to usr/include/rpm/, to
check out that header file, which contains (among other things):

  #include <popt.h>
  #include <rpmmacro.h>      <----- there
  #include <rpmtypes.h>
  #include <rpmtag.h>
  #include <rpmps.h>
  #include <rpmrc.h>
  #include <rpmfi.h>      /* XXX rpmfileAttrs */
  #include <rpmts.h>      /* XXX rpmdepFlags *

next, in the same directory, examine rpmmacro.h, which contains:

  #if defined(_MACRO_INTERNAL)
  #include <rpmiotypes.h>
  ... snip ...

at this point, inclusion is now conditional on _MACRO_INTERNAL, so
move on to rpmiotypes.h, which contains:

  #include <rpmutil.h>

and finally visit that header file in the qemuppc sysroot to find:

  #if     __GNUC__ >= 4
  #define RPM_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
  #else
  #define RPM_GNUC_NULL_TERMINATED
  #endif

where we find the definition of that macro.

now, is it my imagination, or could a lot of this compile-time error
be resolved by simply defining the macro "_MACRO_INTERNAL" for the build? and if so, what is the proper way to add that setting to the compile step for this recipe?

would i use the standard EXTRA_* variables? or are there
perl-specific variables one would use when build CPAN recipes? or am i totally off-track here?

rday

--

========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday

========================================================================

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 4 lines · Tim Orling

NOTE: by convention, OE perl recipes follow debian naming so this should be librpm2-perl_1.3.bb. Obviously, in your own layer you are free to do what you want, but it will require the name change if you want it to go into meta-perl.

i had noticed the naming convention after i started writing those
recipes, it won't be hard to go back and rename. i hadn't planned submitting anything upstream, but maybe after all that work, i might as well, so no one else has to go through the same effort.

Quoted 3 lines

For dependencies, since you are looking at CentOS rpms, you can look at, e.g. [0] to see the DEPENDS (BuildRequires:) and RDEPENDS (Requires:). This would have shown you the need for rpm-devel.

true enough ... it didn't take long to realize i needed the rpm
devel package installed for this.

Quoted 3 lines

I also use metacpan, e.g. [1], to look for dependencies in perl modules. It also has a very slick ElasticSearch JSON API that you can use to automatically query data [2].

i'd noticed that as well ... still playing with it.

Quoted 3 lines

To pass in the extra variables, for 'inherit cpan' you probably need to set EXTRA_CPANFLAGS [3] or for 'inherit cpan_build' EXTRA_CPAN_BUILD_FLAGS [4], e.g. [5].

except i'm not sure what those variables are for ... it *appears*
they're for Perl-related settings, not simple toolchain-related settings. i will have to read further to understand precisely what the purpose of those variables is.

Quoted 1 line

You might want to file a documentation bug for the next release?

not sure what this means, i'm still trying to debug this issue
before i try to submit anything official. :-)

Quoted 164 lines

[0] http://pkgs.fedoraproject.org/cgit/rpms/perl-RPM2.git/tree/perl-RPM2.spec?h=epel7
[1] https://metacpan.org/pod/RPM2
[2] https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md
[3] http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/cpan.bbclass#n20
[4] http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/cpan_build.bbclass#n21
[5] http://git.openembedded.org/meta-openembedded/tree/meta-perl/recipes-perl/libxml/libxml-libxml-perl_2.0121.bb#n37

On Tue, Nov 8, 2016 at 3:17 AM, Robert P. J. Day <[email protected]> wrote:

        replying to my earlier post with additional info ... man, i want to
      debug this ...

      On Tue, 8 Nov 2016, Robert P. J. Day wrote:

      >   following on my earlier post, here's the specific issue i'm
      > tackling. having found no existing OE recipe equivalent to a centos
      > "perl-RPM2" RPM, i wrote my own. here's the info about that RH RPM on
      > my fedora system, so i know what the final result should look like:
      >
      >   $ rpm -ql perl-RPM2
      >   /usr/lib64/perl5/vendor_perl/RPM2.pm
      >   /usr/lib64/perl5/vendor_perl/auto/RPM2
      >   /usr/lib64/perl5/vendor_perl/auto/RPM2/RPM2.so
      >   /usr/share/doc/perl-RPM2
      >   /usr/share/doc/perl-RPM2/Changes
      >   /usr/share/doc/perl-RPM2/README
      >   /usr/share/man/man3/RPM2.3pm.gz
      >   $
      >
      > so, as before, track down the source at cpan:
      >
      >   https://metacpan.org/pod/RPM2
      >
      > and write a boilerplate recipe, "perl-rpm2", containing the following
      > line since it's an older style recipe:
      >
      >   inherit cpan_build
      >
      > fetching works fine:
      >
      >   $ bitbake -c fetchall perl-rpm2
      >
      > but here's the problem:
      >
      >   $ bitbake perl-rpm2
      >
      > ... snip ...
      >
      > | DEBUG: Executing shell function do_compile
      > | Copying lib/RPM2.pm -> blib/lib/RPM2.pm
      > | lib/RPM2.xs -> lib/RPM2.c
      > | powerpc-poky-linux-gcc -m32 -mhard-float -mcpu=7400 -mno-spe
      > --sysroot=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc
      > -I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/lib/perl/5.22.1/CORE
      > -DVERSION="1.3" -DXS_VERSION="1.3" -fPIC -DRPM2_API=5004
      > -I/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm
      > -c -O2 -pipe -g -feliminate-unused-debug-types
      >
      -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/work/ppc7400-poky-linux/perl/5.22.1-r0=/usr/src/debug/perl/5.22.1-r0
      > -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/x86_64-linux=
      > -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc=
      > -DDEBIAN -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe
      > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2
      > -pipe -g -feliminate-unused-debug-types
      >
      -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/work/ppc7400-poky-linux/perl-rpm2/1.3-r0=/usr/src/debug/perl-rpm2/1.3-r0
      > -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/x86_64-linux=
      > -fdebug-prefix-map=/home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc=
      > -O2 -o lib/RPM2.o lib/RPM2.c
      > | In file included from
      > /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmcli.h:9:0,
      > |                  from lib/RPM2.xs:3:
      > |
      > /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:
      > In function 'rpmExpand':
      > |
      > /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:249:2:
      > error: expected declaration specifiers before
      > 'RPM_GNUC_NULL_TERMINATED'
      > |   RPM_GNUC_NULL_TERMINATED
      > |   ^~~~~~~~~~~~~~~~~~~~~~~~
      > |
      > /home/rpjday/oe/builds/msm_qemuppc/tmp/sysroots/qemuppc/usr/include/rpm/rpmmacro.h:260:2:
      > error: expected '=', ',', ';', 'asm' or '__attribute__' before
      > 'RPM_GNUC_NULL_TERMINATED'
      > |   RPM_GNUC_NULL_TERMINATED
      > |   ^~~~~~~~~~~~~~~~~~~~~~~~
      >
      > ... big snip, lots more errors ...

  ok, here's my wildly-uneducated record of what is going on:

  first, unpacking and configuring perl-RPM2 source (and running XS processor) gives me the source file "lib/RPM2.c" (which is what is generating the first build error above), which includes the header file:

  #include <rpm/rpmcli.h>

  next, wander over to the qemuppc sysroot, to usr/include/rpm/, to check out that header file, which contains (among other things):

  #include <popt.h>
  #include <rpmmacro.h>      <----- there
  #include <rpmtypes.h>
  #include <rpmtag.h>
  #include <rpmps.h>
  #include <rpmrc.h>
  #include <rpmfi.h>      /* XXX rpmfileAttrs */
  #include <rpmts.h>      /* XXX rpmdepFlags *

  next, in the same directory, examine rpmmacro.h, which contains:

  #if defined(_MACRO_INTERNAL)
  #include <rpmiotypes.h>
  ... snip ...

  at this point, inclusion is now conditional on _MACRO_INTERNAL, so move on to rpmiotypes.h, which contains:

  #include <rpmutil.h>

and finally visit that header file in the qemuppc sysroot to find:

  #if     __GNUC__ >= 4
  #define RPM_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) #else
  #define RPM_GNUC_NULL_TERMINATED
  #endif

where we find the definition of that macro.

  now, is it my imagination, or could a lot of this compile-time error be resolved by simply defining the macro "_MACRO_INTERNAL" for the build? and if so, what is the proper way to add that setting to the compile step for this recipe?

  would i use the standard EXTRA_* variables? or are there perl-specific variables one would use when build CPAN recipes? or am i totally off-track here?

rday

--

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================