Mac OS X again / creating a library

Hi,

sorry to ask questions again but I’m trying to figure out what is the best way to create a static or shared library under Mac. First of all, I understand that only the 32-bit version provides this option by using flag “dynamiclib” / will it be available for 64-bit ? Is there a way to do it under 64 ?

Also, I’m experiencing some linkings errors like :

ld: absolute addressing (perhaps -mdynamic-no-pic) …
not allowed in slidable image. Use ‘-read_only_relocs suppress’ to enable text relocs

How can I get around that / I don’t see an option in OS X to disable “pic”

Best regards,

PO

Hi,

Did you get that error with 32-bit or 64-bit? Which OS?
You can try passing -Wl,option_to_linker at link time.

We probably will not support -dynamiclib in the next release. Please check back as to when.

Hongyon

Hi,

I used the 32-bit version of the compiler under Snow Leopard,
my command was : pgf95 -dynamiclib *.f90 -o libTest.dylib

So you are suggesting that I try something like :
pgf95 -dynamiclib -Wl,options… *.f90 -o libTest.dylib ?

If dynamiclib will not be supported, what is the best approach to
build a library - should I use ar and ranlib instead ?

Regards,

PO

The command creating looks correct. In fact, I tried a simple example and it works fine on Snow Leopard with 32-bit. I use the same command you use for creating dynamic library. I assume you use 9.0-4?

Here is how I link: pgf95 main.f libtest.dylib

We may need more information as to why it fails for you. Can you provide us a small test case that fails for you and send it to trs@pgroup.com?

For 64-bit dynamic library, you can look at libtool for dynamic library.

Thank you,
Hongyon