Bug 74257
Summary: | rpm 4.1 compile fails on Solaris 8 | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Public Beta | Reporter: | David Breitzmann <david.breitzmann> | ||||||
Component: | rpm | Assignee: | Jeff Johnson <jbj> | ||||||
Status: | CLOSED WORKSFORME | QA Contact: | |||||||
Severity: | medium | Docs Contact: | |||||||
Priority: | medium | ||||||||
Version: | null | CC: | herrold, wtogami | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | sparcv9 | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2003-01-09 14:27:24 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Attachments: |
|
Description
David Breitzmann
2002-09-18 19:43:27 UTC
Yup. Edit rpmio/fts.c, add to the #if defined(hpux) test as appropriate (|| defined(sun) is a start), tell me what else breaks: ... #if defined(hpux) # define _INCLUDE_POSIX_SOURCE # define __errno_location() (&errno) # define dirfd(dirp) -1 # define stat64 stat # define _STAT_VER 0 # define __fxstat64(_stat_ver, _fd, _sbp) fstat((_fd), (_sbp)) #endif #include "system.h" #include "fts.h" #include "rpmio.h" #include "rpmurl.h" # define __set_errno(val) (*__errno_location ()) = (val) # define __open open # define __close close # define __fchdir fchdir #endif I changed #if defined(hpux) to #if defined(hpux)||defined(sun) in fts.c as suggested. The compilation now fails on fts.c with the following errors. gcc -DHAVE_CONFIG_H -I. -I. -I.. -I. -I.. -I../popt -I../zlib -g -O2 -D_GNU_SOURCE -D_REENTRANT -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -c fts.c -MT fts.lo -MD -MP -MF .deps/fts.TPlo -fPIC -DPIC -o .libs/fts.lo In file included from ../system.h:25, from fts.c:56: /usr/include/sys/stat.h:297: redefinition of `struct stat' fts.c: In function `fts_build': fts.c:762: warning: implicit declaration of function `_D_EXACT_NAMLEN' make[2]: *** [fts.lo] Error 1 Hmmm, dunno what the redefinition of struct stat is, that needs some investigation. Look for the DIR structure in /usr/include/sys grep DIR /usr/include/sys/* | grep typedef and then find the structure definition. What will be needed is a #define _D_EXACT_NAMLEN(d) some_number_or_variable Here's what glibc does, solaris may very well do the same: # define _D_EXACT_NAMLEN(d) ((d)->d_namlen) From its definition in /usr/include/sys/dirent.h, the dirent structure in Solaris 8 has no name length member. The structure does include a d_reclen member, but Solaris 8 defines this length (according to the dirent manpage) to be the number of bytes between the current entry and the next one. Since the d_name member is a null terminated string of at most MAXNAMLEN characters, I don't see how computing a length of the d_name member would thus be possible using simple arithmetic on the sizes of the members in struct dirent. With _D_EXACT_NAMLEN(d) defined to be (strlen((d)->d_name)) in the #if defined(hpux) || defined(sun) clause in fts.c, gcc gets past the _D_EXACT_NAMLEN error. From the other code in fts.c, I'm assuming that _D_EXACT_NAMLEN is supposed to return the exact length of the directory entry's name. The make then dies with the "redefinition of struct stat" error. OK, strlen will probably work. Can you paste the solaris struct stat definition here? All I can think of is that some manifest constant is being redefined. And apologies for this clunky debugging, but I have not immediate access to a solaris box ... Created attachment 76728 [details]
Solaris 8 /usr/include/sys/stat.h
From /usr/include/sys/dirent.h typedef struct dirent { ino_t d_ino; /* "inode number" of entry */ off_t d_off; /* offset of disk directory entry */ unsigned short d_reclen; /* length of this record */ char d_name[1]; /* name of file */ } dirent_t; Also, /usr/include/sys/stat.h defines struct stat once at line 236 because _LP64 is not defined and then again at line 303 because _LARGEFILE64_SOURCE is defined (but _LP64 is not). I have attached /usr/include/sys/stat.h from Solaris 8 for reference. So what happens if you do #define _LP64 before the "system.h" include (which drags in stat.h) FWIW, rpm does not (yet) support large file systems, but only rpmcache.c needs/uses rpmio/fts.c ATM. Defining _LP64 errors that both _ILP32 and _LP64 are defined. If I use the following #define _LARGEFILE64_SOURCE #define _FILE_OFFSET_BITS 64 #undef __PRAGMA_REDEFINE_EXTNAME for Sun, then I no longer get the "redefinition of struct stat'. I now get fts.c: In function `fts_safe_changedir': fts.c:1179: storage size of `sb' isn't known fts.c:1179: warning: unused variable `sb' Somehow, it's not picking up the #define stat64 stat. Check fts.h, there's another hpux turdlet that may need "|| defined(sun)". I'll try to get on a solaris box and figger what's up in the next couple of days ... Created attachment 79844 [details]
Patch to get rpm 4.1 to compile on Solaris
I attached a patch I made to this bug report above. I used ideas from previous comments and some see-compile-error-and-fix changes. I do not guarantee this patch does not break other things, but it lets me compile rpm and it appears to work. I checked in a patch for solaris compilation recently that is probably what you need/want. See changes in rpm-4.2-0.54.src.rpm, or checkout from cvs.rpm.org |