[Top][All Lists]

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

PGI and C++ templates

From: Jeff Squyres
Subject: PGI and C++ templates
Date: Fri, 4 Mar 2005 19:07:11 -0500

Can I impose on the good will of a libtool wizard? I could attempt this myself, but I don't have a good track record mucking around in the LT source. ;-)

Here's the situation: on branch-1-5, we have good PGI compiler support -- *except* for libraries with C++ templates. For that, we need some more work (someone identified this recently -- I'm afraid I don't remember who). I have mailed the PGI support folks (CC'ed on this mail) and they have told me what needs to be done (if you care, the full thread is here: t=172&postdays=0&postorder=asc&start=0):

For each source file in the library, compile it:

$ pgCC -c --one_instantiation_per_object $(YOUR_FLAGS)

You must now do an extra pre-link step to instantiate all the templates used in this library, putting all the library .o's on this line, and no -c flag.

$ pgCC --one_instantiation_per_object --prelink_objects $(YOUR_FLAGS) file1.o file2.o etc.

Achive or build the shared library as before, except you must include the new hidden templates in the Template.dir directory:

$ ar qv lib_mylib.a Template.dir/*.o file1.o file2.o etc.

Is there any way someone can add this to Libtool (preferably both 1.5.x and 2.0.x), or provide me with some guidance on how to do so? (I did "ok" in tinkering around to add simple command line switch changes, but the multi-step outlined procedure would take me a loooong time to figure out).

There's one condition: this is only necessary for PGI compiler versions 5.2-4 and prior of their compiler. With their most recent version (soon to be released) -- 6.0 -- none of this is necessary, and what we have now in Libtool will work just fine (i.e., they cleaned up the compiler to do templates in libraries much better -- the entire multi-step process listed above is unnecessary).

Here's a quick-n-easy way to get the version of the compiler:

pgcc_major_ver=`pgCC -V | awk '/pgCC/ { print \$2 }' | cut -d. -f1`
pgcc_need_extra=`expr $pgcc_major_ver \< 6`

So if $pgcc_need_extra is 1, then we need to do the multi-step procedure listed above.

How does that sound?

{+} Jeff Squyres
{+} address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]