I have been trying to find ways to install perl/pdl/fortran modules. I
was succesful using Makefile.PL by imitating the PDL::Slatec
approach. On the other hand I found the nice packages
Module::Build::Pluggable::Fortran
and
Module::Build::Pluggable::PDL
by Mark Grimes, which allow using Build.PL.
I made a small test module named Routine (attached) whose only
Fortran function writes a simple message. I installed it and tested by running
$ perl Build.PL
$ ./Build
$ ./Build install
$ perl -MRoutine -MPDL -e 'hello();'
and I got the error
perl: symbol lookup error: .../auto/Routine/Routine.so: undefined symbol:
_gfortran_st_write
I noticed that one of the steps reported during the Build process was
cc -shared -O2 -L/usr/local/lib -fstack-protector-strong -o
blib/arch/auto/Routine/Routine.so lib/Routine.o
-L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib -lgfortran -lm src/routine.o
Strangely, if I run that same command by hand, reinstall the module
and run my test
$ cc -shared -O2 -L/usr/local/lib -fstack-protector-strong -o
blib/arch/auto/Routine/Routine.so lib/Routine.o
-L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib -lgfortran -lm src/routine.o
$ ./Build install
$ perl -MRoutine -e 'hello();'
Hi there
the program runs as expected with no error. So it seems there is a
difference between compiling by hand and compiling as part of the
./Build process.
I examined the content of the library
$ nm blib/arch/auto/Routine/Routine.so using
and found in the output lines such as
U _gfortran_st_write
when using ./Build, and
U _gfortran_st_write_done@@GFORTRAN_1.0
when I compile by hand. Thus I guess that the trailing
'@@GFORTRAN_1.0' is what allows finding the fortran symbols during
runtime.
Does anyone knows why is the behavior different when linking by hand
and when running ./Build?
Best regards,
Luis
--
o
W. Luis Mochán, | tel:(52)(777)329-1734 /<(*)
Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\
Apdo. Postal 48-3, 62251 | (*)/\/ \
Cuernavaca, Morelos, México | [email protected] /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB
Routine-0.01.tar.gz
Description: application/gzip
------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________ pdl-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pdl-general
