From: "ngoto (Naohisa Goto)" Date: 2012-11-06T16:32:32+09:00 Subject: [ruby-dev:46416] [ruby-trunk - Bug #7287][Open] please rename atomic.h which conflicts with /usr/include/atomic.h in Solaris10 Issue #7287 has been updated by ngoto (Naohisa Goto). Status changed from Closed to Open Priority changed from Normal to Low 回避策はコミットしましたが、根本的解決ではないので再openします。 ---------------------------------------- Bug #7287: please rename atomic.h which conflicts with /usr/include/atomic.h in Solaris10 https://bugs.ruby-lang.org/issues/7287#change-32475 Author: ngoto (Naohisa Goto) Status: Open Priority: Low Assignee: Category: Target version: ruby -v: ruby 2.0.0dev (2012-11-05) [sparc64-solaris2.10] Solaris10にて、ccやfccなどgcc以外を使用してコンパイルする際は、Rubyソース内の atomic.h にて、以下のようにシステムの atomic.h (/usr/include/atomic.h)を#includeしています。 #elif defined(__sun) #include #include "atomic.h" とは違って #include のように<>で囲んでいるので、システムのヘッダファイルが優先されるはず、と思っていたら、実はそうではなく、configureがコンパイル時のオプションとして "-I." を追加しているため、Rubyソース側の atomic.h しか読み込むことができず、どう頑張ってもシステムの /usr/include/atomic.h は読み込まれないことが判明しました。 このため、以下のように"implicit function declaration"の警告が出ます。(行番号はr36984の場合) "gc.c", line 1421: warning: implicit function declaration: atomic_swap_uint "gc.c", line 1902: warning: implicit function declaration: atomic_or_uint "gc.c", line 1952: warning: implicit function declaration: atomic_swap_ulong 幸い、Solaris10およびIllumos(旧OpenSolaris)の現時点の /usr/include/atomic.h は、実質的に 内部で #include しているだけでしたので、#include をRubyの atomic.h に追加することで問題を回避できました。ただし、Solaris10のmanページ(man atomic_ops)では atomic.h を使うように指示がされており、sys/atomic.h はカーネル内ドライバ専用らしいので、OSの将来のバージョン・リビジョンでは最悪コンパイルできなくなる可能性は残っています。根本的解決策としては、Ruby側のatomic.hのファイル名を違う名前に変更するしかないと思います。 ファイル名変更するときは、他のOSやライブラリとも被らないことが望ましいので若干調べたところ、 AIX 6.1 では、#include だそうです。 http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.kerneltechref%2Fdoc%2Fktechrf1%2Ffetch_and_add.htm BoehmGC が要求する libatomic_ops には atomic_ops.h が含まれているようです。 https://github.com/ivmai/libatomic_ops/ -- http://bugs.ruby-lang.org/