# \[ruby-trunk - Bug #9658\] \[Open\] configure --with-opt-dir=dir と clang の組合せでビルドに失敗する

**URL:** <https://www.ruby-forum.com/t/ruby-trunk-bug-9658-open-configure-with-opt-dir-dir-clang/239935>\
**Category:** Development\
**Created:** [March 20, 2014, 4:29pm UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-9658-open-configure-with-opt-dir-dir-clang/239935 "2014-03-20T16:29:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [March 20, 2014, 4:29pm UTC](https://www.ruby-forum.com/t/ruby-trunk-bug-9658-open-configure-with-opt-dir-dir-clang/239935/1 "2014-03-20T16:29:37Z")

</div>

Issue #9658 has been reported by Akinori MUSHA.

* * *

Bug #9658: configure --with-opt-dir=dir と clang の組合せでビルドに失敗する

> **[Bug #9658: configure --with-opt-dir=dir と clang の組合せでビルドに失敗する - Ruby master -...](https://bugs.ruby-lang.org/issues/9658)**
>
> Redmine

- Author: Akinori MUSHA
- Status: Open
- Priority: Normal
- Assignee: Nobuyoshi N.
- Category: build
- Target version: current: 2.2.0
- ruby -v: 2.1.0 and later
- Backport: 2.0.0: UNKNOWN, 2.1: REQUIRED

* * *

ruby 2.1以降で configure に --with-opt-dir=/opt/local を指定すると、

- checking for printf prefix for long long… が、 clang の吐く clang:  
warning: argument unused during compilation: ‘-I /opt/local/include’  
のせいで失敗し、 config.h に PRI\_LL\_PREFIX の定義が入らない

- compiling …/ext/-test-/num2int/num2int.c がこけてビルド失敗

という流れです。

パッチを添付します。

cf.  
[https://twitter.com/knu/status/421181635455766529](https://twitter.com/knu/status/421181635455766529)

> <https://gist.github.com/knu/8330662>

> <https://github.com/ruby/ruby/pull/571>
>
> \- configure.in: Fix a build problem with clang and --with-opt-dir.
> If ruby is …configured with --with-opt-dir=dir when using clang
> as compiler, a warning \`clang: warning: argument unused during
> compilation: '-I dir'\` is emitted almost every time clang
> compiles a file. Unfortunately, RUBY\_CHECK\_PRINTF\_PREFIX takes
> any output from the compiler as fatal error, and the check thus
> fails due to the warning. This is an attempt to fix the problem
> by adding a flag -Qunused-arguments to CFLAGS locally in the
> function to suppress the warning.

—Files--------------------------------  
571.patch (2.65 KB)
