Issue #17947 has been updated by mame (Yusuke Endoh).


Can you confirm that the following patch fixes the issue?

```diff
diff --git a/time.c b/time.c
index a5c00e2aa2..a7ef9d2f47 100644
--- a/time.c
+++ b/time.c
@@ -1623,7 +1623,7 @@ localtime_with_gmtoff_zone(const time_t *t, struct tm *result, long *gmtoff, VAL
 #if defined(HAVE_TM_ZONE)
             *zone = zone_str(tm.tm_zone);
 #elif defined(HAVE_TZNAME) && defined(HAVE_DAYLIGHT)
-# if RUBY_MSVCRT_VERSION >= 140
+# if defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 140
 #  define tzname _tzname
 #  define daylight _daylight
 # endif
```

----------------------------------------
Bug #17947: [SOLARIS11, SPARC] time.c compilation failed
https://bugs.ruby-lang.org/issues/17947#change-92424

* Author: tankf33der (Mike P)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-06-10T23:31:51Z master 9210f8df7f)
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Compilation failed on file time.c, added line to skip error helped to see later compilation progress. 
`miniruby` compiled and crashing, Solaris journey will be long. 
```
#define RUBY_MSVCRT_VERSION 0
```

Latest ruby cant be compiled on latest Solaris 11, SPARC.
```
$ pkg info entire | grep Version
          Version: 11.4 (Oracle Solaris 11.4.33.94.0)
$ git clone https://github.com/ruby/ruby.git
$ cd ruby
$ ./configure --enable-shared --disable-rpath
...
...
---
Configuration summary for ruby version 3.1.0

   * Installation prefix: /usr/local
   * exec prefix:         ${prefix}
   * arch:                sparc-solaris2.11
   * site arch:           ${arch}
   * RUBY_BASE_NAME:      ruby
   * enable shared:       yes
   * ruby lib prefix:     ${libdir}/${RUBY_BASE_NAME}
   * site libraries path: ${rubylibprefix}/${sitearch}
   * vendor path:         ${rubylibprefix}/vendor_ruby
   * target OS:           solaris2.11
   * compiler:            clang
   * with pthread:        yes
   * with coroutine:      ucontext
   * enable shared libs:  yes
   * dynamic library ext: so
   * CFLAGS:              -fdeclspec ${optflags} ${debugflags} ${warnflags}
   * LDFLAGS:             -L. -fstack-protector-strong
   * DLDFLAGS:            -Wl,--compress-debug-sections=zlib
   * optflags:            -O3 -fno-fast-math
   * debugflags:          -ggdb3
   * warnflags:           -Wall -Wextra -Werror=deprecated-declarations \
                          -Werror=division-by-zero \
                          -Werror=implicit-function-declaration \
                          -Werror=implicit-int \
                          -Werror=misleading-indentation \
                          -Werror=pointer-arith -Werror=shorten-64-to-32 \
                          -Werror=write-strings -Wmissing-noreturn \
                          -Wno-constant-logical-operand -Wno-long-long \
                          -Wno-missing-field-initializers \
                          -Wno-overlength-strings -Wno-parentheses-equality \
                          -Wno-self-assign -Wno-tautological-compare \
                          -Wno-unused-parameter -Wno-unused-value \
                          -Wunused-variable -Werror=extra-tokens \
                          -Werror=undef
   * strip command:       llvm-strip -S -x
   * install doc:         rdoc
   * JIT support:         yes
   * man page type:       doc
   * BASERUBY -v:         ruby 2.6.6p146 (2020-03-31 revision 67876) \
                          [sparcv9-solaris2.11]
$ gmake -j 8
        BASERUBY = /usr/bin/ruby --disable=gems
        CC = clang
        LD = /usr/ccs/bin/ld
        LDSHARED = clang -shared
        CFLAGS = -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Werror=deprecated-declarations -Werror=division-by-zero -Werror=implicit-function-declaration -Werror=implicit-int -Werror=misleading-indentation -Werror=pointer-arith -Werror=shorten-64-to-32 -Werror=write-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Werror=extra-tokens -Werror=undef   -fPIC 
        XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -DRUBY_EXPORT -I. -I.ext/include/sparc-solaris2.11 -I./include -I. -I./enc/unicode/12.1.0
        CPPFLAGS = -std=gnu99   
        DLDFLAGS = -Wl,--compress-debug-sections=zlib -Wl,-h,showflags -fstack-protector-strong -R/usr/local/lib  
        SOLIBS = -lz -lpthread -lrt -lrt -lgmp -lsocket -ldl -lcrypt -lm 
        LANG = en_US.UTF-8
        LC_ALL = 
        LC_CTYPE = 
        MFLAGS = 
...
...
compiling time.c
time.c:1626:6: error: 'RUBY_MSVCRT_VERSION' is not defined, evaluates to 0 [-Werror,-Wundef]
# if RUBY_MSVCRT_VERSION >= 140
     ^
1 error generated.
gmake: *** [Makefile:422: time.o] Error 1
gmake: *** Waiting for unfinished jobs....
$
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>