[Apt-Rpm] 0.5.15lorg3.93 Solaris build issue

David Halik dhalik at jla.rutgers.edu
Wed Sep 19 12:59:33 PDT 2007


Anders F Björklund wrote:
> Actually those weren't added by the patch, it's a little flaw
> in RPM 4.4.9 that makes the headers work as C but not as C++.
>
> GCC says:
> rpmevr.h:21: error: use of enum 'evrFlags_e' without previous
> declaration
> rpmevr.h:21: error: invalid type in declaration before ';' token
> rpmevr.h:22: error: use of enum 'evrFlags_e' without previous
> declaration
> rpmevr.h:22: error: invalid type in declaration before ';' token
>
> In MacPorts, it was fixed with another patch to the RPM install:
> http://svn.macports.org/repository/macports/trunk/dports/sysutils/rpm/ 
> files/patch-rpmevr.h
>
> That's from upstream, BTW. So the fix is scheduled for RPM 4.5:
> http://rpm5.org/cvs/filediff?f=rpm/lib/rpmevr.h&v1=1.2&v2=1.2.2.1
>
> --anders
>
>   

Awesome Anders, thank you so much. That pointed me in the right 
direction and actually I found what was the main issue with suncc. First 
off, this was what was ripping the compiler up. I'm not that great with 
c++, but that definitely looked like a typo and it completes now.

diff -ruN apt-0.5.15lorg3.93/apt-pkg/rpm/rpmpackagedata.h 
apt-0.5.15lorg3.93.new/apt-pkg/rpm/rpmpackagedata.h
--- apt-0.5.15lorg3.93/apt-pkg/rpm/rpmpackagedata.h     2007-05-14 
05:01:55.000000000 -0400
+++ apt-0.5.15lorg3.93.new/apt-pkg/rpm/rpmpackagedata.h 2007-09-19 
15:09:01.633396000 -0400
@@ -39,7 +39,7 @@
    map<string,vector<string>*> FakeProvides;
    map<string,int> IgnorePackages;
    map<string,int> DuplicatedPackages;
-   map<string,bool> > CompatArch;
+   map<string,bool> CompatArch;
    typedef map<string,pkgCache::VerIterator> VerMapValueType;
    typedef map<unsigned long,VerMapValueType> VerMapType;
    typedef map<const char*,int,cstr_lt_pred> ArchScoresType;

Second, your patch was not completely the answer for me, but it was 
close. evrFlags_e was still being used a couple lines before it was even 
being defined. I switched the usage to below the definition and that 
succesfully passes now:

--- rpmevr.h    2007-09-19 15:46:32.265742000 -0400
+++ /usr/local/include/rpm/rpmevr.h     2007-09-19 15:39:09.619640000 -0400
@@ -6,6 +6,10 @@
  * Structure(s) and routine(s) used for EVR parsing and comparison.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  */
 /*@-exportlocal@*/
@@ -15,12 +19,6 @@
 
 typedef        /*@abstract@*/ struct EVR_s * EVR_t;
 
-/**
- * Dependency Attributes.
- */
-typedef        enum evrFlags_e rpmsenseFlags;
-typedef        enum evrFlags_e evrFlags;
-
 /*@-matchfields@*/
 enum evrFlags_e {
 #if defined(_RPMEVR_INTERNAL)
@@ -67,6 +65,9 @@
 };
 /*@=matchfields@*/
 
+typedef        enum evrFlags_e rpmsenseFlags;
+typedef        enum evrFlags_e evrFlags;
+
 #define        RPMSENSE_SENSEMASK      0x0e     /* Mask to get senses, 
ie serial, */
                                          /* less, greater, 
equal.          */
 #define        RPMSENSE_NOTEQUAL       (RPMSENSE_EQUAL ^ 
RPMSENSE_SENSEMASK)
@@ -117,10 +118,6 @@
 #define        isErasePreReq(_x)       ((_x) & _ERASE_ONLY_MASK)
 #endif /* _RPMEVR_INTERNAL */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /** \ingroup rpmds
  * Segmented string compare.
  * @param a            1st string

So that's fixed. Running into another c++ error though:

"../include/apt-pkg/pkgcachegen.h", line 62: Error: Multiple declaration 
for Pkg.

I pulled the code out and it does look to be defined twice. I'm not sure 
how I'm going to get around this though, if its actually coded this way 
against c++ standards then there must be a reason. I'm guessing what I'm 
seeing here is the older suncc being extremely strict with its rules :/ 
I'm interested to see if gcc trips up on this same error.

// CNC:2003-02-27 - We need this in rpmListParser.
bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);

Thoughts?

-- 
================================
David Halik
Student Programmer
OSS/NBCS - OIT Rutgers
dhalik at jla.rutgers.edu
================================ 




More information about the Apt-Rpm mailing list