Skip to content

Failing to compile on MacOS #17

@cw-bbcoimbra

Description

@cw-bbcoimbra

Gem fails to install on M3 following the evidences:

$ uname -a
Darwin my_host_name 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6030 arm64
$ ruby -v
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin24]
$ gem install tdes
Building native extensions. This could take a while...
ERROR:  Error installing tdes:
        ERROR: Failed to build gem native extension.

    current directory: /Users/user/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/tdes-3.0.7/ext/tdes
/Users/user/.asdf/installs/ruby/3.3.4/bin/ruby extconf.rb
checking for -lssl... *** 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.

and the mkmf.log:

$ cat mkmf.log
DYLD_LIBRARY_PATH=.:/Users/user/.asdf/installs/ruby/3.3.4/lib "clang -o conftest -I/Users/user/.asdf/installs/ruby/3.3.4/include/ruby-3.3.0/arm64-darwin24 -I/Users/user/.asdf/installs/ruby/3.3.4/include/ruby-3.3.0/ruby/backward -I/Users/user/.asdf/installs/ruby/3.3.4/include/ruby-3.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -std=c99 conftest.c  -L. -L/Users/user/.asdf/installs/ruby/3.3.4/lib -l:libcrypto.a  -arch arm64   -lruby.3.3  -lpthread  "
ld: library ':libcrypto.a' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

It was strange when I see ld: library ':libcrypto.a' not found, as it is present on my system.

After some tests I was able to compile and install the gem using the follow:

$ CFLAGS="-I /opt/homebrew/include" LDFLAGS="-L /opt/homebrew/lib -lcrypto" gem install tdes
Building native extensions. This could take a while...
Successfully installed tdes-3.0.7
Parsing documentation for tdes-3.0.7
Installing ri documentation for tdes-3.0.7
Done installing documentation for tdes after 0 seconds
1 gem installed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions