error compiling with rubyinline

O

OliverMarchand

Dear Rubyists,

I am encountering trouble compiling with RubyInline. Inside rubyinline
there is a construction of the command to create the library file:

cmd = "#{Config::CONFIG['LDSHARED']} #{flags}
#{Config::CONFIG['CFLAGS']} -I #{hdrdir} -o #{so_name} #{src_name}
#{libs}" [line 368 in inline.rb]

On my machine/installation this command fails with:

Building /users/obroeker/.ruby_inline/Inline_Example_58ed.so with
'/apps/gnu/bin/ld -shared -g -O2 -I
/users/obroeker/lib/ruby/1.8/mips-irix6.5 -o
/users/obroeker/.ruby_inline/Inline_Example_58ed.so
/users/obroeker/.ruby_inline/Inline_Example_58ed.c '
/users/obroeker/.ruby_inline/Inline_Example_58ed.c: file not
recognized: File format not recognized

which seems logical to me, because the construction of the command
includes the src_name of the file and thus assumes that the whole
compilation is also done in this command. If I would have written this,
I would have had two parts: one for compiling, one for linking. Can it
be done in one step with ld? Must be so, otherwise the code would have
never worked. Unfortunately I have found no way by hand to do all at
the same time.

Thanks for any help.

greetings, Oliver
 
D

Dominik Bathon

Dear Rubyists,

I am encountering trouble compiling with RubyInline. Inside rubyinline=
there is a construction of the command to create the library file:

cmd =3D "#{Config::CONFIG['LDSHARED']} #{flags}
#{Config::CONFIG['CFLAGS']} -I #{hdrdir} -o #{so_name} #{src_name}
#{libs}" [line 368 in inline.rb]

On my machine/installation this command fails with:

Building /users/obroeker/.ruby_inline/Inline_Example_58ed.so with
'/apps/gnu/bin/ld -shared -g -O2 -I
/users/obroeker/lib/ruby/1.8/mips-irix6.5 -o
/users/obroeker/.ruby_inline/Inline_Example_58ed.so
/users/obroeker/.ruby_inline/Inline_Example_58ed.c '
/users/obroeker/.ruby_inline/Inline_Example_58ed.c: file not
recognized: File format not recognized

which seems logical to me, because the construction of the command
includes the src_name of the file and thus assumes that the whole
compilation is also done in this command. If I would have written this= ,
I would have had two parts: one for compiling, one for linking. Can it=
be done in one step with ld? Must be so, otherwise the code would have=
never worked. Unfortunately I have found no way by hand to do all at
the same time.

Which platform are you on?

RubyInline (and also my Ruby2CExtension) assumes that =

Config::CONFIG["LDSHARED"] is set to something like "gcc -shared", e.g. =
Config::CONFIG["LDSHARED"]
=3D> "i686-pc-linux-gnu-gcc -shared"

If that is the case, then compilation in one step works. But as you show=
, =

this doesn't seem to always be the case.

So again, what platform are you on and did you supply any unusual option=
s =

when building Ruby.


Dominik
 
O

OliverMarchand

Dominik said:
Which platform are you on?

RubyInline (and also my Ruby2CExtension) assumes that
Config::CONFIG["LDSHARED"] is set to something like "gcc -shared", e.g. on
my system:
Config::CONFIG["LDSHARED"]
=> "i686-pc-linux-gnu-gcc -shared"

If that is the case, then compilation in one step works. But as you show,
this doesn't seem to always be the case.

That value was set to ld -shared in my case, which does not compile. I
didn't know that gcc can produce shared libraries. I simply changed
"ld" to "gcc" and volia, it works.

Thanks!

ciao, Oliver
 

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
474,156
Messages
2,570,878
Members
47,404
Latest member
PerryRutt

Latest Threads

Top