[Top][All Lists]

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

Re: PGI and C++ templates

From: Ralf Wildenhues
Subject: Re: PGI and C++ templates
Date: Sat, 5 Mar 2005 17:10:31 +0100
User-agent: Mutt/1.5.6+20040907i

Hi Jeff,

* Jeff Squyres wrote on Sat, Mar 05, 2005 at 01:07:11AM CET:
> 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.  ;-)

Not true.  But let's see what we can do..

> 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:  

Thank you for this link, quite helpful.

> For each source file in the library, compile it:
> $ pgCC -c --one_instantiation_per_object $(YOUR_FLAGS)

Can we issue the `--one_instantiation_per_object' for all C++ source,
not just the source with templates in it?

What happens for input/output in subdirs (this is an important
question)?  E.g., what does
  pgCC -c --one_instantiation_per_object -c -o sub/foo.o src/bar.c

> 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.

Similar question: do we have to know which objects need
prelink/contain/use templates?  How about subdirs: which are the
important ones?

What happens if templates are not used at all?

At which time is Template.dir populated (and which dir, in the case of
subdir-objects)?  Is is maybe possible to specify the Template.dir with
another parameter (this might be necessary in special cases only)?

> 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.

Same questions as above.

> 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).

I'd love this to work better with Libtool.  One thing that kept me from
putting a solution for one compiler in (apart from the fact that I had
not delved deep into PGCC) is that similar things might be necessary for
SGI C++ and others.  Where possible, larger code snippets should be
factored out.  Maybe this is not necessary.

Let's see how far we get with PGI, we can still do refactoring later.
(BTW, I had even once looked at their online docs, but the questions
above are not answered fully in there.)

> 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`

Can we get the complete output of pgCC?
  ( set `pgCC -V`; pgcc_major_ver=$2
    case $pgcc_major_ver in
      [1-5].*) :;;
      *) false;;
    esac )
suffice as yesno-test (little faster)?
(Note you need to double `[' and `]' in most m4 macros.)

> How does that sound?

Thank you for your work on this.

If you want to start fuddling around with the archive_cmds, one further
hint: `~' is used to delimit commands in the *_cmds libtool variables.
So, if we the subdir stuff turns out to be trivial, we can just add a
command to archive_cmds/archive_expsyms_cmds/old_archive_cmds and be
done mostly.


reply via email to

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