$ ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH'
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require': /var/lib/gems/3.1.0/gems/ruzzy-0.6.0/lib/cruzzy/cruzzy.so: undefined symbol: _ZNSt6thread6_StateD2Ev - /var/lib/gems/3.1.0/gems/ruzzy-0.6.0/lib/cruzzy/cruzzy.so (LoadError)
from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /var/lib/gems/3.1.0/gems/ruzzy-0.6.0/lib/ruzzy.rb:7:in `<module:Ruzzy>'
from /var/lib/gems/3.1.0/gems/ruzzy-0.6.0/lib/ruzzy.rb:6:in `<top (required)>'
from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:160:in `require'
from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:149:in `require'
from -e:1:in `<main>'
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- ruzzy (LoadError)
from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in `require'
from -e:1:in `<main>'
Changing the dummy code was necessary because older versions of clang do not set detect_stack_use_after_return=1 by default. Instead of adding this to the environment, I decided to use different ASAN violation code so we don't require ASAN_OPTIONS modification.
There's some debate as to whether we should use -lstdc++ or -lc++. I'm not sure what the right answer is, but -lstdc++ works for me while -lc++ doesn't. These links may help give some context or recommendations:
Using
-lstdc++
fixes issues like:Changing the dummy code was necessary because older versions of clang do not set
detect_stack_use_after_return=1
by default. Instead of adding this to the environment, I decided to use different ASAN violation code so we don't requireASAN_OPTIONS
modification.There's some debate as to whether we should use
-lstdc++
or-lc++
. I'm not sure what the right answer is, but-lstdc++
works for me while-lc++
doesn't. These links may help give some context or recommendations: