[ruby-dev:47242] [Backport 200 - Backport #8227] addr2line.c compile error on Solaris since r39887

From: "ngoto (Naohisa Goto)" <ngotogenome@...>
Date: 2013-04-10 09:03:07 UTC
List: ruby-dev #47242
Issue #8227 has been updated by ngoto (Naohisa Goto).


r40170 is fine on Solaris with Oracle Solaris Studio 12.3.
----------------------------------------
Backport #8227: addr2line.c compile error on Solaris since r39887
https://bugs.ruby-lang.org/issues/8227#change-38414

Author: ngoto (Naohisa Goto)
Status: Assigned
Priority: Normal
Assignee: nagachika (Tomoyuki Chikanaga)
Category: 
Target version: 


r39887以降、Solarisで以下のようなコンパイルエラーが発生します。
Solaris では、quad_t は別の意味の構造体が割り当てられており、u_quad_t は定義されおらず、
また、__inline は、GCC か Sun Studio 12 Update 1 以降でないと使えないためです。
(GCCは未確認)

 fcc -O -KV9 -KVIS2  -DRUBY_EXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/u
sr/local/64/include   -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -o
addr2line.o -c addr2line.c
 "addr2line.c", line 691: error: syntax error near `int'
 "addr2line.c", line 691: error: function type is required for `__inline'
 "addr2line.c", line 915: error: assignment from `int' to `quad_t': operator `='
 "addr2line.c", line 988: error: undeclared identifier `u_quad_t'
 "addr2line.c", line 988: error: syntax error near `)'
 "addr2line.c", line 988: error: syntax error near `)'
 "addr2line.c", line 1006: error: assignment from `quad_t' to `uintmax_t': operator `='

以下のようなパッチでコンパイルは通るようになります。

===================================================================
--- addr2line.c (revision 40156)
+++ addr2line.c (working copy)
@@ -646,6 +646,19 @@
     free(lines);
 }

+#if defined(__sun)
+/* Solaris has different quad_t and does not have u_quad_t */
+# include "ruby/defines.h"
+# define quad_t LONG_LONG
+# define u_quad_t unsigned LONG_LONG
+/* __inline can only be used with GCC or Sun Studio 12 Update 1 or later */
+# if defined(__GNUC__)
+# elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
+# else
+#  define __inline inline
+# endif
+#endif /* defined(__sun) */
+
 /* From FreeBSD's lib/libstand/printf.c */
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
===================================================================



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

In This Thread

Prev Next