#47728 compilation failed with ' incomplete struct/union/enum' if not set USE_POSIX_RWLOCKS
Closed: Fixed None Opened 5 years ago by cgrzemba.

without USE_POSIX_RWLOCKS compilation fails with Solaris Studio Compiler:

/opt/solarisstudio12.3/bin/cc -DHAVE_CONFIG_H -I. -DBUILD_NUM=\"2014.065.79\" "-DVENDOR=\"389 Project\"" -DBRAND=\"389\" -DCAPBRAND=\"389\" -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT -I./ldap/include -I./ldap/servers/slapd -I./include -I. -DLOCALSTATEDIR=\"/var/opt/csw\" -DSYSCONFDIR=\"/etc/opt/csw\" -DLIBDIR=\"/opt/csw/lib\" -DBINDIR=\"/opt/csw/bin\" -DDATADIR=\"/opt/csw/share\" -DDOCDIR=\"/opt/csw/share/doc/389-ds-base\" -DSBINDIR=\"/opt/csw/sbin\" -DPLUGINDIR=\"/opt/csw/lib/dirsrv/plugins\" -DTEMPLATEDIR=\"/opt/csw/share/dirsrv/data\" -I/opt/csw/include -I/opt/csw/include/nss -I/opt/csw/include/nspr -I/opt/csw/include/sasl -I/opt/csw/bdb48/include -I/opt/csw/include -I/opt/csw/include/nspr -I/opt/csw/include/nss -I/opt/csw/include -I/opt/csw/include -g -m32 -xarch=sparc -c ldap/servers/slapd/entry.c -KPIC -DPIC -o ldap/servers/slapd/.libs/libslapd_la-entry.o
"ldap/servers/slapd/entry.c", line 2055: incomplete struct/union/enum slapi_rwlock: sizeof()
cc: acomp failed for ldap/servers/slapd/entry.c


PR_RWLock is an opaque data type so it is not intended to calculate the size of.
Maybe guess it as 5(void)+4*unit32_t.?

Compile error on the source code from the master repo (2015/2/10) on F20.
{{{
libtool: compile: gcc -DHAVE_CONFIG_H -I. -DBUILD_NUM=\"2015.041.2044\" "-DVENDOR=\"389 Project\"" -DBRAND=\"389\" -DCAPBRAND=\"389\" -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT -I./ldap/include -I./ldap/servers/slapd -I./include -I. -DLOCALSTATEDIR=\"/var\" -DSYSCONFDIR=\"/etc\" -DLIBDIR=\"/usr/lib64\" -DBINDIR=\"/usr/bin\" -DDATADIR=\"/usr/share\" -DDOCDIR=\"/usr/share/doc/389-ds-base\" -DSBINDIR=\"/usr/sbin\" -DPLUGINDIR=\"/usr/lib64/dirsrv/plugins\" -DTEMPLATEDIR=\"/usr/share/dirsrv/data\" -I/usr/include -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/sasl -I/usr/include/libdb -I/usr/include -I/usr/include -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -c ldap/servers/slapd/entry.c -fPIC -DPIC -o ldap/servers/slapd/.libs/libslapd_la-entry.o
In file included from /usr/include/stdio.h:27:0,
from ldap/servers/slapd/entry.c:45:
ldap/servers/slapd/entry.c: In function 'slapi_entry_size':
ldap/servers/slapd/entry.c:2097:43: error: invalid application of 'sizeof' to incomplete type 'Slapi_RWLock'
if (e->e_virtual_lock) size += sizeof(Slapi_RWLock);
^
}}}

typedef for Slapi_RWLock:
{{{
"slapi-plugin.h"
6100 #ifdef USE_POSIX_RWLOCKS
6101 typedef pthread_rwlock_t Slapi_RWLock;
6102 #else
6103 typedef struct slapi_rwlock Slapi_RWLock;
6104 #endif
}}}
The issue is there is no definition for "struct slapi_rwlock"
{{{
$ find . -name ".[ch]" | xargs egrep "struct slapi_rwlock"
./ldap/servers/slapd/slapi-plugin.h:typedef struct slapi_rwlock Slapi_RWLock;
$
}}}

Reviewed by Mark (Thank you!!)

Pushed to master:
53e3444..dbb5ef5 master -> master
commit dbb5ef5

Pushed to 389-ds-base-1.3.3:
8dc210d..3520ab8 389-ds-base-1.3.3 -> 389-ds-base-1.3.3
commit 3520ab8

Metadata Update from @cgrzemba:
- Issue assigned to nhosoi
- Issue set to the milestone: 1.3.3 backlog

3 years ago

Login to comment on this ticket.

Metadata