[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
compilation error
Trying to compile openldap-2.2.23 on Solaris 9 using Sun ONE Studio 8 cc
in 64-bits.
When the build gets to making memcmp.o, it dies with the following.
/opt/SUNWspro/bin/cc -O -xtarget=ultra -xarch=v9 -I../../include -I../../include -I/usr/local/openssl/include -I/usr/local/include/64 -I/usr/local/include -c memcmp.c
"memcmp.c", line 25: identifier redeclared: memcmp
current : function(pointer to const void, pointer to const void, int) returning int
previous: function(pointer to const void, pointer to const void, unsigned long) returning int : "/usr/include/iso/string_iso.h", line 60
cc: acomp failed for memcmp.c
*** Error code 2
make: Fatal error: Command failed for target `memcmp.o'
A little investigation shows that, effectively, while in
libraries/liblutil/ memcmp.c includes ../../include/ac/string.h which
includes /usr/include/string.h which includes
/usr/include/iso/string_iso.h
My first question is as to why is there a memcmp.c at all and why does it
redefine memcmp.
The second question is what to do about it.
The standard C library uses a type of size_t for the third parameter to
memcmp to avoid this type of type conflict. "unsigned long" and "unsigned
int" are the common choices for the size_t type, with "unsigned int"
labeled as "historical version"). It would take some digging to see
exactly where the size_t typedef in effect is coming from, but suffice it
to say the "unsigned long" is the one found.
Is this simply an oversight warranting a patch submission (see below) or
am I missing something?
--
Eric Irrgang - UT Austin ITS Unix Systems - (512)475-9342
-- openldap-2.2.23.orig/libraries/liblutil/memcmp.c Thu Jan 20 11:01:04 2005
+++ openldap-2.2.23/libraries/liblutil/memcmp.c Thu Mar 3 18:57:03 2005
@@ -21,7 +21,7 @@
* Memory Compare
*/
int
-(memcmp)(const void *v1, const void *v2, int n)
+(memcmp)(const void *v1, const void *v2, size_t n)
{
if (n != 0) {
const unsigned char *s1=v1, *s2=v2;