Bug #17947
closed[SOLARIS11, SPARC] time.c compilation failed
Description
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....
$
Updated by xtkoba (Tee KOBAYASHI) over 3 years ago
I suppose that the Ruby build system is not maintained for the combination of Solaris + Clang/LLVM. You may want to use Sun C or GCC instead unless intended to use Clang specifically. Of course patches are always welcome.
Updated by tankf33der (Mike P) over 3 years ago
I can not imagine how llvm-clang ecosystem can mess define values as subject of this report.
Updated by mame (Yusuke Endoh) over 3 years ago
Can you confirm that the following patch fixes the issue?
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
Updated by tankf33der (Mike P) over 3 years ago
Confirmed. Fixed.
Updated by mame (Yusuke Endoh) over 3 years ago
- Status changed from Open to Closed
Applied in changeset git|688b217706546c2bc9a0926de246dc29d0935261.
time.c: Check if defined(RUBY_MSVCRT_VERSION) to build on Solaris
Fixes [Bug #17947]