I'm new to Unix. I'm trying to compile a shared library in Solaris running on x86. I get "void value not ignored as it ought to be" error when trying "make". But it compiles fine in Fedora. How can this happen? I think both are using the same type of compiler. What can I do to get around this?
Thanks
I think its due to differences in the compilers. However I was able to resolve some of the errors by modifying the source. Now I get the following errors:
In file included from lm-socket.c:26:
/usr/include/arpa/nameser.h:124: error: syntax error before '' token
/usr/include/arpa/nameser.h:126: error: syntax error before '' token
/usr/include/arpa/nameser.h:129: error: syntax error before '' token
/usr/include/arpa/nameser.h:130: error: syntax error before '}' token
/usr/include/arpa/nameser.h:148: error: syntax error before "uint16_t"
/usr/include/arpa/nameser.h:150: error: syntax error before "ttl"
/usr/include/arpa/nameser.h:151: error: syntax error before "rdlength"
/usr/include/arpa/nameser.h:152: error: syntax error before '' token
/usr/include/arpa/nameser.h:153: error: syntax error before '}' token
/usr/include/arpa/nameser.h:233: error: syntax error before "uint8_t"
/usr/include/arpa/nameser.h:235: error: syntax error before "r_class"
/usr/include/arpa/nameser.h:236: error: syntax error before "r_type"
/usr/include/arpa/nameser.h:237: error: syntax error before "r_ttl"
/usr/include/arpa/nameser.h:238: error: syntax error before '*' token
/usr/include/arpa/nameser.h:239: error: syntax error before "r_size"
.
.
.
Actually i just removed some assignment operations so the above mentioned error wouldn't come up. Cos the compiler says the code haven't ignored a void. So i don't think thats the problem. Here, the compiler generates a syntax error which is part of a common library API. Some say for some versions of glibc this error occurs when trying to compile network related libraries. I cannot download the latest version of glibc right now cos our network doesn't allow downloads larger than 5MB. But i can find a way to do that if there's some hope in doing it. Is there anyone who had a similar experience?
As a guess, you have header problems - with the "void" thing. The other errors are just from program changes.
Semantics of some calls change - grep for "XOPEN_SOURCE" and "GNU_SOURCE" and "POSIX_SOURCE". Then consult the gcc info page on the solaris box to see what you have set if any of the above are in a "#define" statement.
It would also help A LOT if you posted a few lines of code where the error occurs.
gcc will point on the line number and module name with the problem.
Oh. And UNIX is not Windows. Each "flavor" has differences, though not usually in POSIX (POSIX 1b is the IEEE's version of what UNIX base standard ought to be) system calls or in standard library calls. And Linux (FC 5, e.g.) is not always POSIX compliant. You can't just assume code that compiles on UNIX flavor A will automatically compile on UNIX flavor B. GNU extensions to C are definitely not
POSIX-compliant.
Back to square one. When you get errors in header files like this, it almost always means one of these things:
One of the defines like _POSIX_SOURCE is "on" for one header file and "off" for another. It doesn't have to be one of those switches I listed for you. Solaris has its own switches. I chose those because they are most likely to have caused a problem.
Somewhere in the code you wrote there is a conflicting declaration of the same object. Or a redefintion that conflicts.
Does the makefile use -D to define something?
If you can, try to compile everything with gcc -E. This produces cpp output - it will show you all of the "stuff" from all the header files. Redirect gcc -E output to a file and grep for "ns_msg".
Can you tell me how to do that? I changed the CC switch in the Makefile to gcc -E but it doesnt seem to have no effect. Btw CPP switch already has gcc -E. How do I redirect the output of gcc -E? Do u mean redirecting the output of make?