Issue #15070 has been updated by dmolesuc3 (David Moles).


Thanks for the clue -- it looks like I had `CPPFLAGS=-L /usr/local/opt/mysql / 5.7/include` set globally for some reason (probably having to do with building the mysql gem). Removing that allows `configure` to succeed.

That said, it seems as though maybe the check is still too sensitive, since this warning isn't related to CFLAGS, and is only a warning? Also, I believe I've had that environment variable set for some time, and it probably only started causing this problem with a more recent version of clang.

----------------------------------------
Bug #15070: configure fails with (probably spurious) 'something wrong with CFLAGS="-g -O2 "' on macOS High Sierra
https://bugs.ruby-lang.org/issues/15070#change-73914

* Author: dmolesuc3 (David Moles)
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
## Description

`./configure` fails for Ruby 2.5.1 on macOS High Sierra (10.13.6) with Xcode 9.4.1 (clang-902.0.39.2).

(**Note:** I've seen the same error trying to install 2.4.1 and 2.4.4 with rvm, but haven't bothered downloading a source tarball to test upstream.)

## Steps to reproduce

1. On a Mac running macOS High Sierra (10.13.6) with Xcode 9.4.1 (clang-902.0.39.2), download and unpack `ruby-2.5.1.tar.gz`.
2. In `ruby-2.5.1`, run `./configure`.

## Expected behavior

`./configure` succeeds.

## Actual behavior

- `./configure` fails with
   ```
   configure: error: something wrong with CFLAGS="-g -O2 "
   ```
- [config.log](https://gist.github.com/dmolesUC3/75354e60812b7b9429261ed5994527df)

Examining `config.log`, I see:

```
configure:7249: checking whether CFLAGS is valid
configure:7262: gcc -c -g -O2  -L /usr/local/opt/mysql / 5.7/include conftest.c >&5
clang: warning: argument unused during compilation: '-L/usr/local/opt/mysql / 5.7/include' [-Wunused-command-line-argument]
configure:7262: $? = 0
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define CANONICALIZATION_FOR_MATHN 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:7267: result: no
configure:7269: error: something wrong with CFLAGS="-g -O2 "
```

If I create a file with that source, and compile it with that command line, it succeeds; and if I comment out the check (lines 7262-7272) from `./configure` and re-execute it with the arguments given in the `rvm install` output, it succeeds.

My bash skills aren't up to debugging the `ac_fn_c_try_compile()` function to see exactly why it thinks the test is failing, but it looks to me like the failure is spurious, i.e., there's nothing wrong with these flags and this check should not prevent ruby from being configured or compiled.





-- 
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>