[ruby-core:112187] [Ruby master Bug#19403] Unable to Build Native Gems on Mac with Ruby 3.1.0+

Issue #19403 has been reported by jcouball@yahoo.com (James Couball). ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403 * Author: jcouball@yahoo.com (James Couball) * Status: Open * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by jcouball@yahoo.com (James Couball). I have also reported this in the `asdf` issue tracker [asdf-vm/asdf#1468](https://github.com/asdf-vm/asdf/issues/1468) ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101624 * Author: jcouball@yahoo.com (James Couball) * Status: Open * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by hsbt (Hiroshi SHIBATA). FYI: https://github.com/rbenv/ruby-build/discussions/2123#discussioncomment-46436... ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101626 * Author: jcouball@yahoo.com (James Couball) * Status: Open * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by hsbt (Hiroshi SHIBATA). @jcouball@yahoo.com Can you share your environmental variable of `SDKROOT`? In my environment, I couldn't look it. ``` $ env | rg SDKROOT (nothing result) ``` ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101627 * Author: jcouball@yahoo.com (James Couball) * Status: Open * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by nobu (Nobuyoshi Nakada). I think it is fixed by commit:3a7367ccc319499127ead147e5a08f769e44208e. ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101628 * Author: jcouball@yahoo.com (James Couball) * Status: Open * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Closed Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED I confirmed to fix installation error with `SDKROOT` environmental variable. ``` $ env | rg SDKROOT SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk ``` Before result with `make install` at `ruby_3_1` branch. ``` (snip) installing extension objects: /Users/hsbt/.local/share/rbenv/versions/ruby_3_1/lib/ruby/vendor_ruby/3.1.0/arm64-darwin22 installing extension headers: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/hsbt/.local/share/rbenv/versions/ruby_3_1/include/ruby-3.1.0/arm64-darwin22 /Users/hsbt/Documents/github.com/ruby/ruby.github/lib/fileutils.rb:240:in `mkdir': Permission denied @ dir_s_mkdir - /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users (Errno::EACCES) from /Users/hsbt/Documents/github.com/ruby/ruby.github/lib/fileutils.rb:240:in `fu_mkdir' from /Users/hsbt/Documents/github.com/ruby/ruby.github/lib/fileutils.rb:221:in `block (2 levels) in mkdir_p' ``` After: ``` (snip) installing extension objects: /Users/hsbt/.local/share/rbenv/versions/ruby_3_1/lib/ruby/vendor_ruby/3.1.0/arm64-darwin22 installing extension headers: /Users/hsbt/.local/share/rbenv/versions/ruby_3_1/include/ruby-3.1.0/arm64-darwin22 installing extension scripts: /Users/hsbt/.local/share/rbenv/versions/ruby_3_1/lib/ruby/3.1.0 (snip) ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101631 * Author: jcouball@yahoo.com (James Couball) * Status: Closed * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by jcouball@yahoo.com (James Couball). Hello @hsbt! It looks like you solved the problem before I could respond :) Thank you! For what it's worth, my value of SDKROOT was: ```shell $ env | grep SDKROOT SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk ``` It is unclear to me ... will the change [3a7367c](https://github.com/ruby/ruby/commit/3a7367ccc319499127ead147e5a08f769e44208e) in be backported to 3.1 and 3.2? ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101639 * Author: jcouball@yahoo.com (James Couball) * Status: Closed * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by hsbt (Hiroshi SHIBATA). Yes. commit:3a7367ccc319499127ead147e5a08f769e44208e will be backported to 3.1 and 3.2. ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101643 * Author: jcouball@yahoo.com (James Couball) * Status: Closed * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by naruse (Yui NARUSE). Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE ruby_3_2 3decf7df6f678ff6386c5c1888642d76f49dc147 merged revision(s) 3a7367ccc319499127ead147e5a08f769e44208e. ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-101692 * Author: jcouball@yahoo.com (James Couball) * Status: Closed * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/

Issue #19403 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE ruby_3_1 485e0e46a58ff1a28eecd63b804b3dbea4b95b98 merged revision(s) 3a7367ccc319499127ead147e5a08f769e44208e. ---------------------------------------- Bug #19403: Unable to Build Native Gems on Mac with Ruby 3.1.0+ https://bugs.ruby-lang.org/issues/19403#change-102490 * Author: jcouball@yahoo.com (James Couball) * Status: Closed * Priority: Normal * ruby -v: 3.2.0 * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE ---------------------------------------- # Unable to Build Native Gems on Mac with Ruby 3.1.0+ ## Problem In Ruby 3.1 and later installed by `rvm` or `asdf` on a Mac, `require 'mkmf'` aborts the script and reports the following error (the reported path is different depending on the Ruby install manager and the version of Ruby): ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` and `RbConfig::CONFIG["rubyhdrdir"]` is set to an incorrect path: ```text "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Expected Behavior Running `require 'mkmf'` should not abort and for my system/user using `asdf` installed Ruby 3.2.0 `RbConfig::CONFIG["rubyhdrdir"]` should be set to: ```text "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Details In Ruby 3.1 and later I can no longer build native gems (like nokoguru or redcarpet) on my Mac. I have tried this by installing Ruby with both `rvm` and `asdf`, both which have the same results. I receive the following error when trying to install (and build) these gems. For example, here is the error message when I try to run `gem install redcarpet`: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` I found that this error could be triggered just by running a Ruby script that requires `mkmf`. If `test.rb` contains this: ```ruby require 'mkmf' ``` Running this script: `ruby test.rb` Results in this output: ```text mkmf.rb can't find header files for ruby at /Users/couballj/.asdf/installs/ruby/3.2.0/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. ``` Curiously, the reported directory does not exist. On my system, the path to `ruby.h` is `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0/ruby.h` I found where in the Ruby code this error is reported in [mkmf.rb line 233](https://github.com/ruby/ruby/blob/master/lib/mkmf.rb#L224-L233). This code is trying to find `ruby.h` based on the value of `RbConfig::CONFIG["rubyhdrdir"]`. On my system, this value is: ```ruby "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` This value is a concatenation of `ENV['SDKROOT']` (which on my system is `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk`) and the correct include directory path `/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0`. When I run the same code with Ruby 2.7.7, `RbConfig::CONFIG["rubyhdrdir"]` is set to the correct path: ```ruby "/Users/couballj/.asdf/installs/ruby/3.2.0/include/ruby-3.2.0" ``` ## Possible Cause I have found a possible cause in [commit fd97862](https://github.com/ruby/ruby/commit/fd978621ccbc9519afc05ad031ba2518e9a6f379...) in line 127 of mkconfig.rb. This change prepends `ENV['SDKROOT']` to the include directory that is used to build `RbConfig::CONFIG["rubyhdrdir"]`. While there may have been good reason for that change, in my case this change causes `require 'mkmf'` to fail in my use case. ## Work Around I have been able to work around this issue by creating a symbolic link from `/Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users` to `/Users` with the following command: ```shell sudo ln -s /Users /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Users ``` This change will works for both `rvm` and `asdf` no matter what version of Ruby is installed. -- https://bugs.ruby-lang.org/
participants (5)
-
hsbt (Hiroshi SHIBATA)
-
jcouball@yahoo.com (James Couball)
-
nagachika (Tomoyuki Chikanaga)
-
naruse (Yui NARUSE)
-
nobu (Nobuyoshi Nakada)