[Stellar-discuss] f95 + c + Ruby = okay on Mac. But what about linux?

Evert Glebbeek E.Glebbeek at phys.uu.nl
Wed Nov 30 09:17:35 GMT 2005


On Tuesday 29 November 2005 18:57, Bill Paxton wrote:
> Thanks for picking up the ball on the linux side for this.  I've
> changed things so that there is no main() in c anymore -- instead of
> that, there is a little fortran "program" file, ffun.main.f, that
> just calls the c start routine.  I removed -lobjc and -ldl without
> problems, but when I tried to change -lruby to -lruby-static, the
> system loaded, but hung up on one of the calls to setup ruby.  So for
> the Mac at least, I'm leaving it as -lruby.

I assumed it was a configure-time option for Ruby, but perhaps I was wrong. 
Anyway, I don't seem to have a libruby.a anywhere. Does anyone know if I 
should have it after installing Ruby or do I need to install something extra 
or compile it with a specific option?

Anyway, current result:

glebbeek at siu024: ~/Program/cfort/cfortran>make
[...]
ffun_main.o(.text+0x68): In function `ffun_main':
/kasper/strknd/glebbeek/Program/cfort/cfortran/ffun_main.f:6: undefined 
reference to `start_'
/home/strknd/glebbeek/lib/libruby-static.a(string.o)(.text+0x4f2e): In 
function `rb_str_crypt':
/home/strknd/glebbeek/Program/Ruby/ruby-1.8.3/string.c:4360: undefined 
reference to `crypt'
/home/strknd/glebbeek/lib/libruby-static.a(dln.o)(.text+0xbc): In function 
`dln_load':
/home/strknd/glebbeek/Program/Ruby/ruby-1.8.3/dln.c:1351: undefined reference 
to `dlopen'
/home/strknd/glebbeek/lib/libruby-static.a(dln.o)
(.text+0xd1):/home/strknd/glebbeek/Program/Ruby/ruby-1.8.3/dln.c:1356: 
undefined reference to `dlsym'
/home/strknd/glebbeek/lib/libruby-static.a(dln.o)
(.text+0x12d):/home/strknd/glebbeek/Program/Ruby/ruby-1.8.3/dln.c:1359: 
undefined reference to `dlclose'
/home/strknd/glebbeek/lib/libruby-static.a(dln.o)(.text+0x5): In function 
`dln_strerror':
/home/strknd/glebbeek/Program/Ruby/ruby-1.8.3/dln.c:1193: undefined reference 
to `dlerror'
make: *** [fun] Error 1
glebbeek at siu024: ~/Program/cfort/cfortran>

The Ruby errors maybe can be ignored for now, since it might just be that my 
installation is broken somehow. I'll read up on embedding Ruby into another 
programme myself and see if I can fix it.

The ffun_main.f error is a bit more serious and the sortof headache I was 
afraid of: different compilers do different things to function names on 
different platforms. Apparently, the Intel Fortran compiler adds an 
underscore to the end of the function name in the object file while GCC does 
not do the same for C files. Come to think of it, I think GCC does the same 
for Fortran files, but it's been over a year since I was calling Fortran from 
C. There has to be a way to figure out what the compiler is doing and 
compensate for that, but to do it automatically requires a script to detect 
what's happening at compiletime and some C preprocessor magic, I think.
Just for kicks, I'll see if I still have the Intel C compiler installed and 
see what happens if I use that instead of GCC.

Cheers,

Evert
-- 
Evert Glebbeek, PhD student
Physics and Astronomy Department, Utrecht University
Buys Ballot Laboratory, room 762
e-mail: glebbeek at astro.uu.nl   tel. +31 (0)30 253 5235
www: http://www.phys.uu.nl/~glebbeek/ 




More information about the stellar-discuss mailing list