[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shlibs with fortran source in ccc

Okay, minor clarification...

Adam C Powell IV wrote:

The really bizarre thing is that for PETSc 2.1.0 and the older fort (the -2 RPM, installed by cfal...-1.deb), it worked just fine with -lcpml. The old libpetsc.so contains the symbol for_write_seq_lis, but the linker is somehow finding it without -lfor.

Actually, for some reason, the 2.1.0 shared libs were never built, so -lpetsc was linking against libpetsc.a. The old libpetsc.a has that for_write_seq_lis symbol, and that links with a C binary just fine.

If I use the new 2.1.1 libpetsc.a, that works fine too. And when I make a shlib from the old 2.1.0 libpetsc.a, that fails with missing for_write_seq_lis. So that's cool, it's not a compiler version issue.

I'm just building my shared lib wrong, or perhaps, there's just something different about shared libs which is making it drop that symbol... I can't find other options on the ld manpage that would help... Here it is again:

The old and new shared libs were linked in exactly the same way, using:

${LD} -shared -soname $$LIBNAME.${SLSUFFIX}.${SLVERSION} -whole-archive $$LIBNAME.a -o $$LIBNAME.${SLSUFFIX}.${SLVERSION}

I also tried mkdir tmp; ar x ../$$LIBNAME.a; same LD command with *.o instead of $$LIBNAME.a, same error.

So the question is: how do I build a shared lib with mixed fortran/C sources (including a fortran write statement) such that a C program can link to it? Fortran programs can link fine because they have MAIN__...

Thanks for any help you can provide,

-Adam P.

GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6

Welcome to the best software in the world today cafe! <http://lyre.mit.edu/%7Epowell/The_Best_Stuff_In_The_World_Today_Cafe.ogg>

Reply to: