iStats: Fails to install in 10.14

BuildVersion: 18A391, ProductVersion: 10.14

Building native extensions. This could take a while...
ERROR:  Error installing iStats:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.5.0/gems/iStats-1.6.1/ext/osx_stats
/usr/local/opt/ruby/bin/ruby -r ./siteconf20181015-34693-1vpa299.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.5.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.5.0/gems/iStats-1.6.1/ext/osx_stats
make "DESTDIR="
compiling smc.c
In file included from smc.c:23:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
/usr/local/include/Block.h:16:3: error: Never include this file directly. Use <lzma.h> instead.
#       error Never include this file directly. Use <lzma.h> instead.
        ^
/usr/local/include/Block.h:93:2: error: unknown type name 'lzma_check'
        lzma_check check;
        ^
/usr/local/include/Block.h:148:2: error: unknown type name 'lzma_vli'
        lzma_vli compressed_size;
        ^
/usr/local/include/Block.h:172:2: error: unknown type name 'lzma_vli'
        lzma_vli uncompressed_size;
        ^
/usr/local/include/Block.h:200:2: error: unknown type name 'lzma_filter'
        lzma_filter *filters;
        ^
/usr/local/include/Block.h:217:20: error: use of undeclared identifier 'LZMA_CHECK_SIZE_MAX'
        uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
                          ^
/usr/local/include/Block.h:231:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int3;
        ^
/usr/local/include/Block.h:232:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int4;
        ^
/usr/local/include/Block.h:233:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int5;
        ^
/usr/local/include/Block.h:234:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int6;
        ^
/usr/local/include/Block.h:235:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int7;
        ^
/usr/local/include/Block.h:236:2: error: unknown type name 'lzma_vli'
        lzma_vli reserved_int8;
        ^
/usr/local/include/Block.h:237:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum1;
        ^
/usr/local/include/Block.h:238:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum2;
        ^
/usr/local/include/Block.h:239:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum3;
        ^
/usr/local/include/Block.h:240:2: error: unknown type name 'lzma_reserved_enum'
        lzma_reserved_enum reserved_enum4;
        ^
/usr/local/include/Block.h:261:2: error: unknown type name 'lzma_bool'
        lzma_bool ignore_check;
        ^
/usr/local/include/Block.h:263:2: error: unknown type name 'lzma_bool'
        lzma_bool reserved_bool2;
        ^
/usr/local/include/Block.h:264:2: error: unknown type name 'lzma_bool'
        lzma_bool reserved_bool3;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [smc.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.5.0/gems/iStats-1.6.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0/iStats-1.6.1/gem_make.out

lzma was install through the xz formula via brew. This error is produced with and without ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

solution for me: 1: sudo xcode-select --switch /Library/Developer/CommandLineTools 2: sudo gem install iStats

reference: https://stackoverflow.com/a/58226876/2506135

I had the same issue before, my solution is:

  1. Make sure you have installed xcode-select

  2. Install following package.

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pk

After installed macOS_SDK_headers_for_macOS_10.14.pkg, it generated the folder universal-darwin18

Then you can install iStats.

➜  ruby-2.3.0 sudo gem install iStats
Building native extensions.  This could take a while...
Successfully installed iStats-1.6.1
Parsing documentation for iStats-1.6.1
Done installing documentation for iStats after 0 seconds
1 gem installed
➜  ruby-2.3.0 istats cpu
CPU temp:               63.13°C     ▁▂▃▅▆▇
➜  ruby-2.3.0

Just adding my 2 cents here: It worked for me

I’m on a new MBP 15" 2018, so everything is freshly installed from scratch. I’ve installed things, more or less in this order:

  • macOS Mojave 10.14.2 (18C54)
  • full Xcode
  • using brew for the first time in my life, but I think it’s not involved here because of next point:
  • latest ruby from the latest RVM: rvm install 2.5.1 (it compiled from sources, so I guess it used the Xcode installation from the first point)
  • gem install iStats
  • istats scan it took a while but found lots of “unknown” sensors that were not present in my old machine
  • istats enable all

Just FYI, I’m copying the output of the all --no-graphs command

$ istats all --no-graphs
--- CPU Stats ---
CPU temp:               58.25°C     

--- Fan Stats ---
Total fans in system:   2           
Fan 0 speed:            2975 RPM    
Fan 1 speed:            2729 RPM    

--- Battery Stats ---
Battery health:         Good        
Cycle count:            4             0.4%
Max cycles:             1000        
Current charge:         7055 mAh      100%
Maximum charge:         7311 mAh      99.7%
Design capacity:        7336 mAh    
Battery temp:           36.59°C     

--- Extra Stats ---
Th1H NB/CPU/GPU HeatPipe 1 Proximity temp: 58.5°C      
Th2H Unknown temp:      57.25°C     
Tsqf Unknown temp:      0.0°C       
Ts0P Palm rest L temp:  35.06°C     
Ts0S Memory Bank Proximity temp: 43.23°C     
Ts1S Unknown temp:      42.94°C     
TA0P Ambient temperature temp: 0.0°C       
TB0T Battery TS_MAX temp: 36.59°C     
TB1T Battery 1 temp:    35.8°C      
TB2T Battery 2 temp:    36.59°C     
TCGC PECI GPU temp:     64.0°C      
TCSA PECI SA temp:      64.0°C      
TCXC PECI CPU temp:     65.08°C     
TC0E CPU 0 ?? temp:     63.92°C     
TC0F CPU 0 ?? temp:     66.28°C     
TC0P CPU 0 Proximity temp: 58.25°C     
TC1C Core 1 temp:       64.0°C      
TC2C Core 2 temp:       65.0°C      
TC3C Core 3 temp:       63.0°C      
TC4C Core 4 temp:       64.0°C      
TC5C Core 5 temp:       63.0°C      
TC6C Core 6 temp:       63.0°C      
TGTC Unknown temp:      0.0°C       
TGTD Unknown temp:      0.0°C       
TG0D GPU 0 Die temp:    0.0°C       
TG0P GPU 0 Proximity temp: 58.63°C     
TG1d Unknown temp:      0.0°C       
TG1D GPU 1 Die temp:    0.0°C       
TG1F Unknown temp:      0.0°C       
TM0P Memory Slot Proximity temp: 52.56°C     
TM0S Memory Slot 1 temp: 0.0°C       
TPCD Platform Controller Hub Die temp: 56.0°C      
TP0P Unknown temp:      0.0°C       
TaLC Unknown temp:      46.38°C     
TaRC Unknown temp:      45.19°C     
Tm0P Unknown temp:      58.63°C     
Tm1P Unknown temp:      -127.0°C    
Ts1P Unknown temp:      33.0°C      
Ts2S Unknown temp:      40.88°C     
TA0V Unknown temp:      27.39°C     
TCMX Unknown temp:      65.08°C     
TF0S Unknown temp:      5.42°C      
TGDD Unknown temp:      63.0°C      
TGDF Unknown temp:      63.34°C     
TGVP Unknown temp:      56.06°C     
TH0a Unknown temp:      36.63°C     
TH0b Unknown temp:      39.53°C     
TH0F Unknown temp:      46.19°C     
TH0X Unknown temp:      46.2°C      
TH1a Unknown temp:      46.2°C      
TH1b Unknown temp:      39.78°C     
TTLD Unknown temp:      54.88°C     
TTRD Unknown temp:      48.94°C     
TW0P AirPort Proximity temp: 50.5°C      


Now our friend @Chris911 can tell us what all those new unknow keys refer to. I notice that many of them return 0.0°C so they may not apply to my machine. Many others return what look like sensible values, but I have no idea what they are measuring.

I had the same problem as @Bunn, and I found another solution from https://github.com/vmg/redcarpet/issues/668#issuecomment-444283767.

  • MacBook Air 2017
  • MacOS Mojave 10.14.3
  • ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18] (ruby --version)
  • Gem 2.5.2.3 (gem --version)
  • Xcode is not installed but command-line tools are installed.
  • xcode-select version 2354. (xcode-select --version)
  • IMPORTANTLY the folder /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ DOES NOT EXIST.

From similar issues elsewhere, the problem seems to be that make can not find the file /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h. This is because the file is located at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h.

From the information at these other links, it seems like this is a mistake in MacOS, and this file is supposed to be located in darwin18.

This due to a change from 10.13.3, which was Darwin 17 (unname -a) and 10.14.3 which is Darwin 18. This file directory is supposed to reflect the change, but it does not.

Fix

I was able to fix this by disabling system integrity and copying the folder /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ as universal-darwin18.

This command would also work:

cd /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/
cp -R universal-darwin17 universal-darwin18

This worked for me, though I could not find a simpler way to do this. If the Makefile is edited to reference darwin17, I believe this script will work. However, I am not how to make that install script.

Also, may I suggest that this be reopened, as there would be a fix, even though the error is not in iStat, but MacOS?

solution for me: 1: sudo xcode-select --switch /Library/Developer/CommandLineTools 2: sudo gem install iStats

reference: https://stackoverflow.com/a/58226876/2506135

This worked perfectly. You don’t need sudo for the gem install iStats line.

Also fix this issue by using brew insatll ruby to upgrade ruby to 2.5.3

Also needs to check your terminal is using the correct version of ruby. image

Thanks you @pscott-au