Re: glib not building on Solaris 64Bit w/ Workshop 5.0 cc



Mark Ashley wrote:

> This should probably be a faq since it's so prevalent in google, though
> no-one seems to have come up with a solution.

I don't have pkg-config and I don't know what else I would need, so I
can't actually try to compile it.

> cc -xtarget=ultra -xarch=v9 -xcode=pic32 -DHAVE_CONFIG_H -I. -I. -I. 
> -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG -DG_DISABLE_DEPRECATED 
> -DGLIB_COMPILATION -g -D_REENTRANT -c ghash.c  -KPIC -DPIC -o ghash.o

[warnings deleted]

> "ghash.c", line 504: operands have incompatible types:
>          pointer to function(pointer to void) returning void ":" pointer to void
> "ghash.c", line 505: operands have incompatible types:
>          pointer to function(pointer to void) returning void ":" pointer to void
> "ghash.c", line 512: operands have incompatible types:
>          pointer to function(pointer to void) returning void ":" pointer to void
> "ghash.c", line 513: operands have incompatible types:
>          pointer to function(pointer to void) returning void ":" pointer to void
> "ghash.c", line 544: warning: operands have incompatible pointer types: op "!="

> What else can I try to resolve this problem? It's stopping me building
> gtk+ and therefore the whole gnome and gimp tools.

This might be a compiler bug, but I'm not sure. I don't have the standard,
so all I can quote is the latest C9X draft, which is still freely
available. I guess the relevant part is the same as in C89, but consult
some expert, if in doubt.

       6.3.15  Conditional operator

       [#2] The first operand shall have scalar type.

       [#3] One of the following shall  hold  for  the  second  and
       third operands:

          - both operands have arithmetic type;

          - both operands have compatible structure or union types;

          - both operands have void type;

          - both operands are pointers to qualified or  unqualified
            versions of compatible types;

this one>>- one operand is a  pointer  and  the  other  is  a  null
            pointer constant; or

          - one operand is a pointer to  an  object  or  incomplete
            type  and  the  other  is  a  pointer to a qualified or
            unqualified version of void.

Since the error message says your second argument (NULL) is "pointer to void",
I think this didn't come from Solaris headers. It probably came from
gmacros.h:

#ifndef NULL
#  ifdef __cplusplus
#    define NULL        (0L)
#  else /* !__cplusplus */
#    define NULL        ((void*) 0)
#  endif /* !__cplusplus */
#endif

This is most likely because ghash.c (and everything it includes) doesn't
include any of the Solaris headers which define NULL, so you got NULL
definition from glib. That definition is a proper null pointer constant.
Another quote from the draft:

   An integer constant expression with the value 0, or such  an
   expression cast to type void *, is called a null pointer constant.


You'll get the same error with the following code (compile with cc -xarch=v9):

#define NULL ((void *)0)

extern int (*foo)();

int
main(int argc, char **argv)
{
        printf("%p\n", atoi(argv[1]) ? foo : NULL);
	return 0;
}

However, if you define NULL to be 0 or 0L, then you won't get an error
(you'd get a linker error, because there is no function foo in libc).

OTOH, if you keep NULL defined as above, but put "&foo" instead of "foo",
there is no compiler error. But then the second operand becomes "pointer
to pointer to function," not "pointer to function."

So, try compiling with -DNULL=0L and see what happens. If it works, file a
bug against the compiler and see what happens with that. I'm rather
interested in the outcome.

> I don't see why inlines are being used and such dependancies on the
> continual use of the same compiler (who uses $exec_prefix in real life?)
> is built into the glib code. Some people have posted about it but it
> seems to be a showstopper for so many others. Any insights welcome.

I don't understand what you mean. Could you elaborate?

-- 
 .-.   .-.    Sarcasm is just one more service we offer.
(_  \ /  _)
     |        dave arsdigita com
     |




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]