Skip to content

Commit

Permalink
Merge pull request #45 from yoshoku/fix-xcode14
Browse files Browse the repository at this point in the history
Add dynamic_lookup linker option for macOS and Ruby 3.1
  • Loading branch information
masa16 authored Jan 13, 2023
2 parents 1d950a2 + 945d6d6 commit c76099d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/numo/linalg/blas/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
end
end

if RUBY_PLATFORM.match?(/darwin/) && Gem::Version.new('3.1.0') <= Gem::Version.new(RUBY_VERSION)
if try_link('int main(void){return 0;}', '-Wl,-undefined,dynamic_lookup')
$LDFLAGS << ' -Wl,-undefined,dynamic_lookup'
end
end

if have_header("dlfcn.h")
exit(1) unless have_library("dl")
exit(1) unless have_func("dlopen")
Expand Down
6 changes: 6 additions & 0 deletions ext/numo/linalg/lapack/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
end
end

if RUBY_PLATFORM.match?(/darwin/) && Gem::Version.new('3.1.0') <= Gem::Version.new(RUBY_VERSION)
if try_link('int main(void){return 0;}', '-Wl,-undefined,dynamic_lookup')
$LDFLAGS << ' -Wl,-undefined,dynamic_lookup'
end
end

if have_header("dlfcn.h")
exit(1) unless have_library("dl")
exit(1) unless have_func("dlopen")
Expand Down

0 comments on commit c76099d

Please sign in to comment.