ruby-build icon indicating copy to clipboard operation
ruby-build copied to clipboard

Build Issues on macOS Sierra

Open tylerjohnst opened this issue 10 years ago • 14 comments

 $ rbenv install 2.3.1                                                                                                                                                          
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...

BUILD FAILED (OS X 10.12 using ruby-build 20160602)

Inspect or clean up the working tree at /var/folders/5y/csxbdjv156n4fl25975s1x4w0000gn/T/ruby-build.20160921163419.48224
Results logged to /var/folders/5y/csxbdjv156n4fl25975s1x4w0000gn/T/ruby-build.20160921163419.48224.log

Last 10 log lines:
        clock_id_t
/usr/include/mach/clock_types.h:53:13: note: 'clock_id_t' declared here
typedef int     clock_id_t;                     /* clock identification type */
                ^
process.c:7500:19: warning: implicit declaration of function 'clock_getres' is invalid in C99 [-Wimplicit-function-declaration]
        int ret = clock_getres(c, &ts);
                  ^
2 warnings and 2 errors generated.
make: *** [process.o] Error 1
make: *** Waiting for unfinished jobs....

It looks like a change to the latest GCC. I see this patch to Ruby trunk has addressed the issue? https://github.com/ruby/ruby/commit/fdaea1596a69997be845907641267cba0c607ad9

tylerjohnst avatar Sep 21 '16 20:09 tylerjohnst

The last 10 log lines are showing a warning, but not the errors.

Could you include the build errors in /var/folders/5y/csxbdjv156n4fl25975s1x4w0000gn/T/ruby-build.20160921163419.48224.log ?

jeremy avatar Sep 21 '16 22:09 jeremy

https://gist.github.com/tylerjohnst/1dd50de462189c8dd34cca5994774536

tylerjohnst avatar Sep 21 '16 22:09 tylerjohnst

process.c:7360:9: error: unknown type name 'clockid_t'; did you mean 'clock_id_t'?
        clockid_t c;
        ^~~~~~~~~
        clock_id_t
/usr/include/mach/clock_types.h:53:13: note: 'clock_id_t' declared here
typedef int     clock_id_t;                     /* clock identification type */
                ^
process.c:7362:15: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
        ret = clock_gettime(c, &ts);
              ^
process.c:7499:9: error: unknown type name 'clockid_t'; did you mean 'clock_id_t'?
        clockid_t c = NUM2CLOCKID(clk_id);
        ^~~~~~~~~
        clock_id_t
/usr/include/mach/clock_types.h:53:13: note: 'clock_id_t' declared here
typedef int     clock_id_t;                     /* clock identification type */
                ^
process.c:7500:19: warning: implicit declaration of function 'clock_getres' is invalid in C99 [-Wimplicit-function-declaration]
        int ret = clock_getres(c, &ts);
                  ^
2 warnings and 2 errors generated.
make: *** [process.o] Error 1

jeremy avatar Sep 21 '16 22:09 jeremy

Puzzling:

checking for clockid_t... no
checking for convertible type of clockid_t... INT

But clockid_t is clearly checked for in time.h:

AC_CHECK_TYPES([clockid_t], [], [], [@%:@ifdef HAVE_TIME_H
@%:@ include <time.h>
@%:@endif
@%:@ifdef HAVE_SYS_TIME_H
@%:@ include <sys/time.h>
@%:@endif])

And it's available in /usr/include/time.h:

typedef enum {
…
} clockid_t;

What the heck?

jeremy avatar Sep 21 '16 23:09 jeremy

Hm, I see the same config locally, but my compile goes through fine too.

jeremy avatar Sep 21 '16 23:09 jeremy

Not seeing that typedef in /usr/include/time.h on a clean install of Sierra. For reference: https://gist.github.com/tylerjohnst/f45a53a9691301aafcdf6cfdb18a78b8

tylerjohnst avatar Sep 21 '16 23:09 tylerjohnst

Fmm, I couldn't reproduce this with macOS Sierra and Xcode 8.0 release version.

hsbt avatar Sep 22 '16 06:09 hsbt

I've figured out the issue:

Theres a bug with the App Store where Apple is pushing out updates to the Xcode7 version of the CLI tools that can update even if the Xcode8 version of the tooling is installed. This was causing the strange behavior in the header files.

Solution: rm -rf /Library/Developer/CommandLineTools and reinstall the command line tools. Ruby builds correctly now.

tylerjohnst avatar Sep 22 '16 15:09 tylerjohnst

screenshot 2016-09-22 11 25 12

For reference, this is what the App Store update looks like. It will go away after a few "refreshes" of the App Store. Hope this issue helps someone else out.

tylerjohnst avatar Sep 22 '16 15:09 tylerjohnst

Whew! Thanks for tracking that down @tylerjohnst.

jeremy avatar Sep 22 '16 18:09 jeremy

thanks 👍

Zeldalink avatar Oct 03 '16 21:10 Zeldalink

Basically, it just didn't have write permission , use sudo rbenv install 2.3.1 and works fine

0xsapra avatar Oct 15 '16 06:10 0xsapra

If it helps anyone, I fixed the error by running rm -rf /Library/Developer/CommandLineTools && xcode-select --install. That installs most recent Command Line Tools (8+) if you're running Sierra.

igolden avatar May 05 '17 16:05 igolden

Great @tylerjohnst, you save my day!

alvesoaj avatar Dec 18 '18 18:12 alvesoaj