Forum: wxRuby Installing from source missing -lruby18 in linking.

Eee774a82313b9081986dba418781adc?d=identicon&s=25 "Svend Haugaard Sørensen" <shs@demosophia.net> (Guest)
on 2012-02-10 20:52
(Received via mailing list)
I am trying to build wxruby from source, but I have encounter an error.

For some reason the 'rake' command fail when it tries to link
lib/wxruby2.so
because it is missing missing -lruby18

resulting in errors like

wx.cpp:(.text+0x1618): undefined reference to `rb_intern'
wx.cpp:(.text+0x165c): undefined reference to `rb_eNotImpError'
wx.cpp:(.text+0x1666): undefined reference to `rb_raise'
wx.cpp:(.text+0x167d): undefined reference to `rb_const_defined'
wx.cpp:(.text+0x1698): undefined reference to `rb_const_get'


could it be a bad expansion of values in the Config::CONFIG hash ?

And if it is, how do I verify that it is the problem?

How does the Config hash get filled with values?

How do I check that  Config::CONFIG["LDFLAGS"] and
Config::CONFIG["LIBS"] contains the right values?

Here is a grep of the config hash --
shs@cybert /store/download/wxruby-2.0.1 $ grep -r 'CONFIG\[' *
rake/rakemswin.rb:lib_ruby =   File.join(Config::CONFIG['libdir'],
Config::CONFIG['LIBRUBY'])
rake/rakemswin.rb:  mv 'msvcp80.dll', Config::CONFIG['bindir']
rake/rakemswin.rb:  mv 'msvcr80.dll', Config::CONFIG['bindir']
rake/rakemswin.rb:  ruby_manifest = File.join(Config::CONFIG['bindir'],
'ruby.exe.manifest')
rake/rakemswin.rb:  rubyw_manifest = File.join(Config::CONFIG['bindir'],
'rubyw.exe.manifest')
rake/rakemingw.rb:  File.join(Config::CONFIG['libdir'],
Config::CONFIG['LIBRUBY'])
rake/rakeconfigure.rb:$ruby_cppflags = Config::CONFIG["CFLAGS"]
rake/rakeconfigure.rb:  includes = [ Config::CONFIG["rubyhdrdir"],
rake/rakeconfigure.rb:               Config::CONFIG["sitehdrdir"],
rake/rakeconfigure.rb:               Config::CONFIG["vendorhdrdir"],
rake/rakeconfigure.rb:
File.join(Config::CONFIG["rubyhdrdir"],
rake/rakeconfigure.rb:                         Config::CONFIG['arch']) ]
rake/rakeconfigure.rb:  $ruby_includes = " -I. -I " +
Config::CONFIG["archdir"]
rake/rakeconfigure.rb:$ruby_ldflags = Config::CONFIG["LDFLAGS"]
rake/rakeconfigure.rb:$ruby_libs  = Config::CONFIG["LIBS"]
rake/rakeconfigure.rb:OBJ_EXT = Config::CONFIG["OBJEXT"]
rake/rakewx.rb:$ruby_exe = Config::CONFIG["ruby_install_name"]
rake/rakewx.rb:  dest_dir = Config::CONFIG['sitelibdir']
rake/rakewx.rb:  cp TARGET_LIB, Config::CONFIG['sitearchdir']
rake/rakewx.rb:  rm_rf
File.join(Config::CONFIG['sitearchdir'],File.basename(TARGET_LIB))
rake/rakewx.rb:  rm_rf File.join(Config::CONFIG['sitelibdir'], 'wx.rb')
rake/rakewx.rb:  rm_rf File.join(Config::CONFIG['sitelibdir'], 'wx')
rakefile:DLL_LIB = "wxruby2.#{Config::CONFIG["DLEXT"]}"

PS. I am working on a linux system.
uname -a
Linux cybert 2.6.31-gentoo-r6 #1 SMP Wed Aug 24 17:09:01 CEST 2011 i686
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz GenuineIntel GNU/Linux
E7f3cbcb69beec85643d1ecc54121460?d=identicon&s=25 David Beswick (davidbeswick)
on 2012-02-10 22:51
(Received via mailing list)
Hello Svend,

I'm not sure about the reasons for the error, but that CONFIG hash is
built
in to ruby. You can query it in IRB by typing "require rbconfig" then
access it with Config::CONFIG.


2012/2/11 Svend Haugaard Srensen <shs@demosophia.net>
85991f138ede6236f35eb98da22b7b01?d=identicon&s=25 Marvin Gülker (quintus)
on 2012-02-11 10:12
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 10.02.2012 20:48, schrieb Svend Haugaard Sørensen:
> wx.cpp:(.text+0x1666): undefined reference to `rb_raise'
> wx.cpp:(.text+0x167d): undefined reference to `rb_const_defined'
> wx.cpp:(.text+0x1698): undefined reference to `rb_const_get'
>

You need to build your Ruby interpreter with --enable-shared,
otherwise the Ruby shared library won’t be built. You can easily test
whether your Ruby interpreter was built with that option:

require "rbconfig"
p Config::CONFIG["configure_args"]

This has to contain "--enable-shared" somewhere, otherwise you don’t
have the Ruby shared library wxRuby wants to link against (you can
also simply check whether you have "libruby18.so" in your Ruby
installation’s lib/ subdirectory). If the option isn’t present, you
have to recompile your Ruby interpreter accordingly.

Vale,
Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPNivKAAoJELh1XLHFkqhap4oH/RGgpyqZY0B3ft7hITXixYaY
r5xELHJZM6vsLVK2eehkxzczQepamSLli63HP5DDzL2aXwHqRA5q2gAPh0pd03Aa
uHykDDwwwr8t2iMJq/MSUJ4GnNHwVbVnvm+wG6t2nltbwPAiz+Ls1zoBYG7l5t0j
b/9RToiD68nnqUB6GPuM7Oe1F3AvGi8sbi/GI0ws7q2YXdJPwLRQdxRze6Qpqomr
ccp68ahlwXriZEdlIt8nSOJoFZCdEMyM0u83seqvkSYJCPlKl82jy2JiWtshwaKk
E4N5H9BeLMXvqvS5dmfWXRigdbIGfNXJY9vImvd7Po3yWngMYEOC7xZ+YOQkfKs=
=LjKG
-----END PGP SIGNATURE-----
Eee774a82313b9081986dba418781adc?d=identicon&s=25 "Svend Haugaard Sørensen" <shs@demosophia.net> (Guest)
on 2012-02-11 18:16
(Received via mailing list)
On Sat, 11 Feb 2012 08:32:04 +1100
David Beswick <dlbeswick@gmail.com> wrote:

> Hello Svend,
>
> I'm not sure about the reasons for the error, but that CONFIG hash is
> built in to ruby. You can query it in IRB by typing "require
> rbconfig" then access it with Config::CONFIG.

Here is a printout of the config hash. As you can see "LDFLAGS" and
"LIBS" don't contain -lruby18 (I assume that where the rakeconfig
script should get it from).

Please try this on you machine and show me your listing, so we can
compare.

irb(main):006:0> (Config::CONFIG.sort).each {|p| puts p.inspect}
["ALLOCA", ""]
["AR", "i686-pc-linux-gnu-ar"]
["ARCHFILE", ""]
["ARCH_FLAG", ""]
["AS", "i686-pc-linux-gnu-as"]
["ASFLAGS", ""]
["CC", "i686-pc-linux-gnu-gcc"]
["CCDLFLAGS", " -fPIC"]
["CFLAGS", "-O2 -march=prescott -pipe -fno-strict-aliasing  -fPIC  "]
["COMMON_HEADERS", ""]
["COMMON_LIBS", ""]
["COMMON_MACROS", ""]
["CP", "cp"]
["CPP", "i686-pc-linux-gnu-gcc -E"]
["CPPFLAGS", " -D_FILE_OFFSET_BITS=64 "]
["CPPOUTFILE", "-o conftest.i"]
["DEFS", "-D_FILE_OFFSET_BITS=64"]
["DESTDIR", ""]
["DLDFLAGS", ""]
["DLDLIBS", " -lc"]
["DLEXT", "so"]
["DLEXT2", ""]
["DLLWRAP", ""]
["ECHO_C", ""]
["ECHO_N", "-n"]
["ECHO_T", ""]
["EGREP", "/bin/grep -E"]
["ENABLE_SHARED", "yes"]
["EXEEXT", ""]
["EXPORT_PREFIX", ""]
["EXTOUT", ".ext"]
["EXTSTATIC", ""]
["GNU_LD", "yes"]
["GREP", "/bin/grep"]
["INSTALL", "/usr/bin/install -c"]
["INSTALL_DATA", "/usr/bin/install -c -m 644"]
["INSTALL_PROGRAM", "/usr/bin/install -c"]
["INSTALL_SCRIPT", "/usr/bin/install -c"]
["LDFLAGS", "-L. -Wl,-O1 -Wl,--as-needed -rdynamic -Wl,-export-dynamic
-Wl,--no-undefined"]
["LDSHARED", "i686-pc-linux-gnu-gcc -shared"]
["LIBEXT", "a"]
["LIBPATHENV", "LD_LIBRARY_PATH"]
["LIBPATHFLAG", " -L%1$-s"]
["LIBRUBY", "libruby18.so.1.8.7"]
["LIBRUBYARG", "-Wl,-R -Wl,/usr/lib -L/usr/lib -lruby18"]
["LIBRUBYARG_SHARED", "-Wl,-R -Wl,/usr/lib -L/usr/lib -lruby18"]
["LIBRUBYARG_STATIC", "-lruby18-static"]
["LIBRUBY_A", "libruby18-static.a"]
["LIBRUBY_ALIASES", "libruby18.so.1.8 libruby18.so"]
["LIBRUBY_DLDFLAGS", "-Wl,-soname,libruby18.so.1.8"]
["LIBRUBY_LDSHARED", "i686-pc-linux-gnu-gcc -shared"]
["LIBRUBY_SO", "libruby18.so.1.8.7"]
["LIBS", "-lrt -ldl -lcrypt -lm "]
["LINK_SO", ""]
["LN_S", "ln -s"]
["MAINLIBS", ""]
["MAJOR", "1"]
["MAKEDIRS", "mkdir -p"]
["MAKEFILES", "Makefile"]
["MANTYPE", "doc"]
["MINOR", "8"]
["NM", ""]
["NROFF", "/usr/bin/nroff"]
["OBJDUMP", ""]
["OBJEXT", "o"]
["OUTFLAG", "-o "]
["PACKAGE_BUGREPORT", ""]
["PACKAGE_NAME", ""]
["PACKAGE_STRING", ""]
["PACKAGE_TARNAME", ""]
["PACKAGE_URL", ""]
["PACKAGE_VERSION", ""]
["PATCHLEVEL", "352"]
["PATH_SEPARATOR", ":"]
["PREP", "miniruby"]
["RANLIB", "i686-pc-linux-gnu-ranlib"]
["RDOCTARGET", "install-doc"]
["RM", "rm -f"]
["RPATHFLAG", " -Wl,-R%1$-s"]
["RUBYW_INSTALL_NAME", ""]
["RUBY_INSTALL_NAME", "ruby18"]
["RUBY_SO_NAME", "ruby18"]
["SET_MAKE", ""]
["SHELL", "/bin/sh"]
["SOLIBS", "-lrt -ldl -lcrypt -lm "]
["STATIC", ""]
["STRIP", "strip -S -x"]
["TEENY", "7"]
["TRY_LINK", ""]
["WINDRES", ""]
["YACC", "bison -y"]
["YFLAGS", ""]
["arch", "i686-linux"]
["archdir", "/usr/lib/ruby/1.8/i686-linux"]
["bindir", "/usr/bin"]
["build", "i686-pc-linux-gnu"]
["build_alias", "i686-pc-linux-gnu"]
["build_cpu", "i686"]
["build_os", "linux-gnu"]
["build_vendor", "pc"]
["cflags", " "]
["configure_args", " '--prefix=/usr' '--build=i686-pc-linux-gnu'
'--host=i686-pc-linux-gnu' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc'
'--localstatedir=/var/lib' '--program-suffix=18' '--enable-shared'
'--disable-socks' '--enable-install-doc' '--disable-pthread'
'--enable-ipv6' '--disable-debug' '--with-dbm' '--with-gdbm'
'--with-openssl' '--without-tk' '--with-curses'
'--with-lookup-order-hack=INET' '--with-readline'
'--with-sitedir=/usr/lib/ruby/site_ruby' '--enable-option-checking=no'
'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu'
'CFLAGS=-O2 -march=prescott -pipe -fno-strict-aliasing' 'LDFLAGS=-Wl,-O1
-Wl,--as-needed' 'CPPFLAGS='"]
["cppflags", ""]
["datadir", "/usr/share"]
["datarootdir", "/usr/share"]
["debugflags", ""]
["docdir", "/usr/share/doc/$(PACKAGE)"]
["dvidir", "/usr/share/doc/$(PACKAGE)"]
["exec_prefix", "/usr"]
["host", "i686-pc-linux-gnu"]
["host_alias", "i686-pc-linux-gnu"]
["host_cpu", "i686"]
["host_os", "linux-gnu"]
["host_vendor", "pc"]
["htmldir", "/usr/share/doc/$(PACKAGE)"]
["includedir", "/usr/include"]
["infodir", "/usr/share/info"]
["libdir", "/usr/lib"]
["libexecdir", "/usr/libexec"]
["localedir", "/usr/share/locale"]
["localstatedir", "/var/lib"]
["mandir", "/usr/share/man"]
["oldincludedir", "/usr/include"]
["optflags", ""]
["pdfdir", "/usr/share/doc/$(PACKAGE)"]
["prefix", "/usr"]
["psdir", "/usr/share/doc/$(PACKAGE)"]
["ruby_install_name", "ruby18"]
["ruby_version", "1.8"]
["rubylibdir", "/usr/lib/ruby/1.8"]
["rubyw_install_name", ""]
["sbindir", "/usr/sbin"]
["setup", "Setup"]
["sharedstatedir", "/usr/com"]
["sitearch", "i686-linux"]
["sitearchdir", "/usr/lib/ruby/site_ruby/1.8/i686-linux"]
["sitedir", "/usr/lib/ruby/site_ruby"]
["sitelibdir", "/usr/lib/ruby/site_ruby/1.8"]
["sysconfdir", "/etc"]
["target", "i686-pc-linux-gnu"]
["target_alias", ""]
["target_cpu", "i686"]
["target_os", "linux"]
["target_vendor", "pc"]
["topdir", "/usr/lib/ruby/1.8/i686-linux"]
["vendorarchdir", "/usr/lib/ruby/vendor_ruby/1.8/i686-linux"]
["vendordir", "/usr/lib/ruby/vendor_ruby"]
["vendorlibdir", "/usr/lib/ruby/vendor_ruby/1.8"]
This topic is locked and can not be replied to.