Build error on Solaris 9 Sparc w/64 bit #1752
The latest Curl 7.55.0 fails to build on Sparc V9 (64 bit) with
I did this
The previous versions were building fine, this was just a rebuild.
I expected the following
I wonder why this wasn't caught by the autobuilds (on second thought, I vaguely remember I changed something in the builedbot configuration and got sidetracked before fixing some issues).
[curl -V output]
Does not build yet.
Solaris 10 Sparc 64 bit with Sun Studio 12.
This seems to fix the issue:
Found the issue, these are the values after preprocessing:
So in this code
the error message is just misleading because it is defined but does not match any of the above cases.
Also I find it strange that
That's certainly the bug. The idea is that sparc 64bit should match system.h line 415-422, which should define both
Do you know of any preprocessor directive to detect it running in 64 bit mode?
We usually use this to differentiate between 32 and 64 bit on Solaris and it works on Sparc and x86, GCC and Sun/Oracle Studio:
See also here for specific definitions for the Oracle Studio compiler: https://docs.oracle.com/cd/E18752_01/html/816-5138/dev-env-2.html
For gcc I'm pretty sure the header is already fine, this bug is for the sunpro compiler.
What do you think about this patch?
--- a/include/curl/system.h +++ b/include/curl/system.h @@ -368,10 +368,35 @@ # define CURL_SUFFIX_CURL_OFF_TU ULL # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t # define CURL_PULL_SYS_TYPES_H 1 # define CURL_PULL_SYS_SOCKET_H 1 +#elif defined(__SUNPRO_C) /* Oracle Solaris Studio */ +# if !defined(__LP64) && (defined(__ILP32) || \ + defined(__i386) || defined(__sparcv8)) +# define CURL_SIZEOF_LONG 4 +# define CURL_TYPEOF_CURL_OFF_T long long +# define CURL_FORMAT_CURL_OFF_T "lld" +# define CURL_FORMAT_CURL_OFF_TU "llu" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T LL +# define CURL_SUFFIX_CURL_OFF_TU ULL +# elif defined(__LP64) || \ + defined(__amd64) || defined(__sparcv9) +# define CURL_SIZEOF_LONG 8 +# define CURL_TYPEOF_CURL_OFF_T long +# define CURL_FORMAT_CURL_OFF_T "ld" +# define CURL_FORMAT_CURL_OFF_TU "lu" +# define CURL_SIZEOF_CURL_OFF_T 8 +# define CURL_SUFFIX_CURL_OFF_T L +# define CURL_SUFFIX_CURL_OFF_TU UL +# endif +# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t +# define CURL_SIZEOF_CURL_SOCKLEN_T 4 +# define CURL_PULL_SYS_TYPES_H 1 +# define CURL_PULL_SYS_SOCKET_H 1 + /* ===================================== */ /* KEEP MSVC THE PENULTIMATE ENTRY */ /* ===================================== */ #elif defined(_MSC_VER)