abinashmeher999@JARVIS:~/gsoc/symengine/src/ruby$ irb
2.2.0 :001 > require 'symengine'
=> true
2.2.0 :002 > a = SymEngine::Basic.new
irb: symbol lookup error: /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so: undefined symbol: basic_init
abinashmeher999@JARVIS:~/gsoc/symengine/src/ruby$ irb
2.2.0 :001 > require 'symengine'
LoadError: /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so: undefined symbol: __cxa_pure_virtual - /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine.rb:1:in `<top (required)>'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from (irb):1
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
Then I found this question, Ruby C Extensions, loading external libraries. I followed that, but the have_library function always returned false because there's no main in libsymengine.a. Therefore, I set the function to look for to basic_init. Still no progress. I have commented the part where I tried that in extconf.rb. Can anyone please help in what am I doing wrong?Hi everyone,I am stuck at an error with the ruby_wrappers for SymEngine. I have a module SymEngine, under which I have a class Basic. As described here. ext/symengine/symengine.cWith the current extconf.rb. I get an error like thisabinashmeher999@JARVIS:~/gsoc/symengine/src/ruby$ irb
2.2.0 :001 > require 'symengine'
=> true
2.2.0 :002 > a = SymEngine::Basic.new
irb: symbol lookup error: /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so: undefined symbol: basic_init
If I skip that part and directly use append_library, I get an error like thisabinashmeher999@JARVIS:~/gsoc/symengine/src/ruby$ irb
2.2.0 :001 > require 'symengine'
LoadError: /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so: undefined symbol: __cxa_pure_virtual - /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine.rb:1:in `<top (required)>'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from (irb):1
from /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'Any idea what might be wrong?
--
You received this message because you are subscribed to the Google Groups "SciRuby Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sciruby-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Can you do:
ldd /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so
to see if it is linked. Did you compile symengine as static or dynamic
library? If static (the default), then ldd will not show anything. One
would need to examine how the symengine.so was linked --- if you can
post the gcc command that linked it, all would become clear.
ldd /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so
linux-vdso.so.1 => (0x00007ffe44cee000)
libruby.so.2.2 => /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/libruby.so.2.2 (0x00007f31288af000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3128577000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f31281b2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3127f9b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3127d7d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3127b79000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f312793f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3129115000)
This symbol is defined in the C++ standard library. You have to
compile the C wrappers using a C++ compiler to link against it.
You'll also want to do a append_library call
# File lib/mkmf.rb, line 837 def have_library(lib, func = nil, headers = nil, &b) func = "main" if !func or func.empty? lib = with_config(lib+'lib', lib) checking_for checking_message("#{func}()", LIBARG%lib) do if COMMON_LIBS.include?(lib) true else libs = append_library($libs, lib) if try_func(func, libs, headers, &b) $libs = libs true else false end end end end
Hi Ondrej,Can you do:
ldd /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so
to see if it is linked. Did you compile symengine as static or dynamic
library? If static (the default), then ldd will not show anything. One
would need to examine how the symengine.so was linked --- if you can
post the gcc command that linked it, all would become clear.Yes. symengine.so are the wrappers. This is the outputldd /home/abinashmeher999/.rvm/gems/ruby-2.2.0/gems/symengine-0.0.0.pre/lib/symengine/symengine.so
linux-vdso.so.1 => (0x00007ffe44cee000)
libruby.so.2.2 => /home/abinashmeher999/.rvm/rubies/ruby-2.2.0/lib/libruby.so.2.2 (0x00007f31288af000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3128577000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f31281b2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3127f9b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3127d7d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3127b79000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f312793f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3129115000)And I compiled it as static library, which was the default. Is there a preference of one over the other? I tried what Isuru suggested, and this(mkmf.log) is the output. It also contains the gcc commands. It did achieve in a way what Isuru suggested. But there are many more errors.
The errors in the gist you posted are caused by compiling with gcc instead of g++.
Sent from my mobile phone.