Project

General

Profile

Actions

Bug #15070

closed

configure fails with (probably spurious) 'something wrong with CFLAGS="-g -O2 "' on macOS High Sierra

Added by dmolesuc3 (David Moles) over 5 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:88836]

Description

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

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.

Updated by dmolesuc3 (David Moles) over 5 years ago

Oops, the config.log I linked there was from the rvm attempt. But the tarball version here is basically identical.

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • Status changed from Open to Feedback

dmolesuc3 (David Moles) wrote:

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]

From where does this -L option come?
It is a linker option and doesn't need to be in CFLAGS.
(and include path doesn't seem a library directory).

Updated by dmolesuc3 (David Moles) over 5 years ago

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.

Actions #4

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0