Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile Ruby gems with native extensions? #965

Closed
DaniruKun opened this issue Feb 2, 2024 · 3 comments · Fixed by #1162
Closed

How to compile Ruby gems with native extensions? #965

DaniruKun opened this issue Feb 2, 2024 · 3 comments · Fixed by #1162
Labels
question Further information is requested

Comments

@DaniruKun
Copy link

DaniruKun commented Feb 2, 2024

I am trying to compile a bunch of gems with native extensions like grpc, but it fails with:

third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc:26:10: fatal error:
'CoreFoundation/CFTimeZone.h' file not found
#include <CoreFoundation/CFTimeZone.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Makefile:768:
/Users/dpetrovs/ghq/github.com/platogo/pas/.devenv/state/.bundle/ruby/3.2.0/gems/grpc-1.57.0/src/ruby/ext/grpc/objs/opt/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.o]
Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory
'/Users/dpetrovs/ghq/github.com/platogo/pas/.devenv/state/.bundle/ruby/3.2.0/gems/grpc-1.57.0'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/nix/store/jwh59hk8szbi06zgcvshzr9bp7pdwwyx-ruby-3.2.2/bin/$(RUBY_BASE_NAME)

extconf failed, exit code 1

My env:

ProductName:		macOS
ProductVersion:		14.3
BuildVersion:		23D56
devenv: 0.6.3
nix (Nix) 2.19.3

I also had to explicitly set to use clang and clang++ as the compilers so other gems would actually compile.

{
  env.CC = "clang";
  env.CXX = "clang++";

  languages = {
    ruby = {
      enable = true;
      bundler.enable = true;
      version = "3.2.2";
    };
    nix.enable = true;
    java.enable = true;
  };

  # https://devenv.sh/packages/
  packages = [
    pkgs.curl
    pkgs.dynamodb-local
    pkgs.git
    pkgs.git-crypt
    pkgs.gnupg
    pkgs.imagemagick
    pkgs.libffi
    pkgs.libpqxx
    pkgs.lua
    pkgs.nodejs
    pkgs.yarn
    pkgs.gnumake
    pkgs.pkg-config
    pkgs.ruby.devEnv
    pkgs.libyaml
    pkgs.libcxxabi
    pkgs.grpc
    pkgs.openssl
  ] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [
    frameworks.CoreFoundation
    frameworks.Security
    frameworks.SystemConfiguration
  ]);
}

It seems to be complaining that it cannot find CoreFoundation, even though I add it?

@DaniruKun DaniruKun added the question Further information is requested label Feb 2, 2024
@DaniruKun
Copy link
Author

Upd: linking to #966

@domenkozar
Copy link
Member

Does it reproduce with #745?

@domenkozar
Copy link
Member

Could you try with 1.0.1 that was released yesterday?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants