Project

General

Profile

Actions

Bug #19585

closed

Ruby Fails to Build on macOS with --enable-shared and --with-jemalloc

Added by eviljoel (evil joel) about 1 year ago. Updated 10 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
3.2.2, 3.1.3
[ruby-core:113160]

Description

Ruby fails to build on macOS 12.6.4 when configured with --enable-shared and --with-jemalloc. I receive the following linking error:

building spec/ruby/optional/capi/ext/bignum_spec.bundle
Undefined symbols for architecture x86_64:
  "_je_free", referenced from:
      _bignum_spec_rb_big_pack_array in bignum_spec-f7dc36.o
  "_je_malloc", referenced from:
      _bignum_spec_rb_big_pack_array in bignum_spec-f7dc36.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spec/ruby/optional/capi/ext/bignum_spec.bundle] Error 1

It appears that the bignum C API spec requires "-undefined dynamic_lookup" to be enabled. I can get the build to succeed with:

./configure --enable-shared --with-jemalloc DLDFLAGS='-Wl,-undefined,dynamic_lookup'

I’ve created several bash scripts to demonstrate that:

  1. This is an error with the current production release of Ruby. Running jemallocBug-ruby3.2.2-20230407.sh demonstrates that building Ruby with these parameters fails in Ruby 3.2.2.
  2. This is a regression in at least the Ruby 3.1 branch. Running jemallocSucceeds-ruby3.1.2-20230407.sh demonstrates that building Ruby with these parameters worked with Ruby 3.1.2 and running jemallocBug-ruby3.1.3-20230407.sh demonstrates that building Ruby with these parameters fails in Ruby 3.1.3.

In the Ruby 3.1 branch, the first commit where this broke appears to be 2244fc9aa7ef8e03ac966e59b581baa021106b46.

ld version information:

$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-820.1
BUILD 20:07:01 Nov  7 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.29.202) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)
$

clang version information:

$ clang -v
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$

I’m using jemalloc version 5.3.0.

MacBook Specs are:

Model: MacBook Pro (16-inch, 2019)
Processor: 2.4 GHz 8-Core Intel Core i9
Memory: 32 GB 2667 MHz DDR4
Graphics: AMD Radeon Pro 5300M 4 GB and Intel UHD Graphics 630 1536 MB

I’ve attached the config.log and config.status for the failed Ruby 3.2.2 build.

Please let me know if you need any more information.


Files

jemallocSucceeds-ruby3.1.2-20230407.sh (804 Bytes) jemallocSucceeds-ruby3.1.2-20230407.sh eviljoel (evil joel), 04/07/2023 11:27 PM
jemallocBug-ruby3.2.2-20230407.sh (804 Bytes) jemallocBug-ruby3.2.2-20230407.sh eviljoel (evil joel), 04/07/2023 11:27 PM
jemallocBug-ruby3.1.3-20230407.sh (804 Bytes) jemallocBug-ruby3.1.3-20230407.sh eviljoel (evil joel), 04/07/2023 11:27 PM
ruby-3.2.2-config.status (34.4 KB) ruby-3.2.2-config.status eviljoel (evil joel), 04/07/2023 11:27 PM
ruby-3.2.2-config.log (1.57 MB) ruby-3.2.2-config.log eviljoel (evil joel), 04/07/2023 11:27 PM

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed
  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED

Updated by usa (Usaku NAKAMURA) 10 months ago

  • Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: DONE, 3.2: REQUIRED

ruby_3_1 c87bf4d8e96819010942a00372ee518e22c76bac merged revision(s) 038f9ade3c4d965415e4956561975454cf9eeb21.

Updated by nagachika (Tomoyuki Chikanaga) 10 months ago

  • Backport changed from 3.0: REQUIRED, 3.1: DONE, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: DONE, 3.2: DONE

ruby_3_2 35cf3a5f8d01aad07762eb824c3107bee9ae7fdd merged revision(s) 038f9ade3c4d965415e4956561975454cf9eeb21.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0