Problem writting bindings

E

Erwan Loisant

Hello.

I am writing Ruby bindings for a C library that I wrote myself. I have
a problem when running extconf.

My library uses glib so I added glib also.

----
erwan@bourricot Galois $ cat extconf.rb
require 'mkmf'

dir_config('libGalois')
dir_config('glib')

have_library('glib')
have_library('libGalois')

create_makefile('GaloisNode')
----

Then I launch extconf.rb:

----
erwan@bourricot Galois $ ruby extconf.rb
--with-libGalois-dir=/usr/local/
checking for main() in -lglib... yes
checking for main() in -llibGalois... no
creating Makefile
----

The problem is in the generated Makefile, "-lglib" is added but not
"-llibGalois". I guess the "checking for main() in -llibGalois... no"
is the error message related to the problem but I can't figure what it
means. A library is not supposed to have main() loop, right?
 
T

ts

E> checking for main() in -llibGalois... no

You must give him a symbol which is exported, for example bz2 has

svg% ruby -rmkmf -e 'p have_library("bz2", "BZ2_bzWriteOpen")'
checking for BZ2_bzWriteOpen() in -lbz2... yes
true
svg%

svg% nm /usr/lib/libbz2.so | grep BZ2_bzWriteOpen
0000bc20 T BZ2_bzWriteOpen
svg%



Guy Decoux
 
P

Paul Duncan

--UljtkXebtcviItgt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Erwan Loisant ([email protected]) said:
Hello.
=20
I am writing Ruby bindings for a C library that I wrote myself. I have
a problem when running extconf.
=20
My library uses glib so I added glib also.
=20
----
erwan@bourricot Galois $ cat extconf.rb
require 'mkmf'
=20
dir_config('libGalois')
dir_config('glib')
=20
have_library('glib')
have_library('libGalois')
=20
create_makefile('GaloisNode')
----
=20
Then I launch extconf.rb:
=20
----
erwan@bourricot Galois $ ruby extconf.rb
--with-libGalois-dir=3D/usr/local/
checking for main() in -lglib... yes
checking for main() in -llibGalois... no
creating Makefile
----
=20
The problem is in the generated Makefile, "-lglib" is added but not
"-llibGalois". I guess the "checking for main() in -llibGalois... no"
is the error message related to the problem but I can't figure what it
means. A library is not supposed to have main() loop, right?

You should pass a function in the library to the have_library method,
like this:

have_library('glib', 'g_timer_start')

My guess is you'll want the other have_library call to look like this:

have_library('Galois', 'func_name') # note the omitted 'lib' prefix

Hope that helps...

--=20
Paul Duncan <[email protected]> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

--UljtkXebtcviItgt
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBeS/AzdlT34LClWIRAjwyAJwJpx8ZqvNkosDJovFYhvgaWqp8ZACgyWSr
z5rKifMNINzF5vfWjwj6LYw=
=PlBv
-----END PGP SIGNATURE-----

--UljtkXebtcviItgt--
 
N

nobu.nokada

Hi,

At Sat, 23 Oct 2004 00:54:13 +0900,
Erwan Loisant wrote in [ruby-talk:117376]:
erwan@bourricot Galois $ cat extconf.rb
require 'mkmf'

dir_config('libGalois')
dir_config('glib')

have_library('glib')
have_library('libGalois')

have_library('Galois')

"lib" prefix is automatically prepended.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top