Environment:
HP 9000/720
HP-UX 9.01
HP C++ B2402/B2404 A.03.05
AFS 3.2a
I have an interesting problem involving the use of multiple files
(2, it makes a difference), C++ templates, and AFS.
I have three files:
array.h definition for class template Array<T>
array.C member functions for class template Array<T>
main.C program main (defines an Array<int> and does stuff)
The compiler will produce, by default, a directory called "./ptrepository"
to store various intermediate files. This directory can be changed using
the "-ptr${New_Directory}" flag. When the "ptrepository" directory is
created, it inherits the ACLs and owner/group from the current directory
and has mode bits 0755. Suffice to say, my ticket/token has access.
During the link (CC -v -ptv -o example main.o array.o), I receive the
following error:
CC[ptlink] fatal error: could not move Array__pt__2_i.o --> \
./ptrepository/Array__pt__2_i.o
If I set "-ptr." or "-ptr/tmp", the link will succeed. The current directory
"." is in AFS and "/tmp" is not. What gives?
A shar file (336 lines) that contains the simple program, Makefile, and
the Makefile output follows for those who want to take a crack at this.
Thanks,
- jss
--------------------------------------------------------------------------
Jon S. Stumpf [EMAIL PROTECTED] Merrill Lynch
World Financial Center
(212) 449-0498 Phone North Tower
(212) 449-0912 Fax New York, N.Y. 10281-1315
--------------------------------------------------------------------------
#---------------------------------- cut here ----------------------------------
# This is a shell archive. Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by Jon S. Stumpf <jss@hermes> on Fri Mar 12 08:21:32 1993
#
# This archive contains:
# Makefile Make.out array.h main.C
# array.C
#
# Existing files will not be overwritten.
# Error checking via wc(1) will be performed.
LANG=""; export LANG
PATH=/bin:/usr/bin:$PATH; export PATH
if test -f Makefile
then
echo Ok to overwrite existing file Makefile\?
read answer
case "$answer" in
[yY]*) echo Proceeding;;
*) echo Aborting; exit 1;;
esac
rm -f Makefile
if test -f Makefile
then
echo Error: could not remove Makefile, aborting
exit 1
fi
fi
echo x - Makefile
cat >Makefile <<'@EOF'
SRCS= main.C array.C
OBJS= $(SRCS:.C=.o)
HDRS= array.h
REPDIR= .
CXXFLAGS=-v -ptv -ptr$(REPDIR)
MAKEOUT= Make.out
RM= /bin/rm -f
DEST= example
$(DEST): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJS)
$(OBJS): $(HDRS)
$(DEST).shar: Makefile $(MAKEOUT) $(HDRS) $(SRCS)
$(RM) $@
shar -bcCev Makefile $(MAKEOUT) $(HDRS) $(SRCS) > $@
clean:
$(RM) $(DEST)
$(RM) $(OBJS)
$(RM) $(DEST).shar
$(RM) *~
shar: $(DEST).shar
@EOF
set `wc -lwc <Makefile`
if test $1$2$3 != 3054421
then
echo ERROR: wc results of Makefile are $* should be 30 54 421
fi
chmod 644 Makefile
if test -f Make.out
then
echo Ok to overwrite existing file Make.out\?
read answer
case "$answer" in
[yY]*) echo Proceeding;;
*) echo Aborting; exit 1;;
esac
rm -f Make.out
if test -f Make.out
then
echo Error: could not remove Make.out, aborting
exit 1
fi
fi
echo x - Make.out
cat >Make.out <<'@EOF'
CC -v -ptv -c main.C
/usr/lib/Cpp.ansi -D__hp9000s700 -D_PA_RISC1_1 -$ -Dc_plusplus -D__cplusplus
-D__hp9000s800 -D__hppa -D__hpux -D__unix -Dhp9000s800 -Dhppa -Dhpux -Dunix
-I/usr/include/CC -I/usr/include main.C /usr/tmp/AAAa08906.i
/usr/lib/cfront +T/usr/tmp/BAAa08906 +s +t/usr/tmp/CAAa08906 +fmain.C +XCmain.o
</usr/tmp/AAAa08906.i
/usr/lib/c++ptcomp -ptd -ptv ./ptrepository /usr/tmp/DAAa08906 defmap main.C
/usr/tmp/EAAa08906
CC[ptcomp] locked repository [0] ...
CC[ptcomp] read raw cfront information [0] ...
CC[ptcomp] read old map file [0] ...
CC[ptcomp] made list of unique filenames in new map file [0] ...
CC[ptcomp] deleted old map file entries [0] ...
CC[ptcomp] added in new map entries [0] ...
CC[ptcomp] wrote new map file [0] ...
CC[ptcomp] unlocked repository [0] ...
removing /usr/tmp/AAAa08906.i
removing /usr/tmp/BAAa08906
removing /usr/tmp/CAAa08906
removing /usr/tmp/DAAa08906
removing /usr/tmp/EAAa08906
CC -v -ptv -c array.C
/usr/lib/Cpp.ansi -D__hp9000s700 -D_PA_RISC1_1 -$ -Dc_plusplus -D__cplusplus
-D__hp9000s800 -D__hppa -D__hpux -D__unix -Dhp9000s800 -Dhppa -Dhpux -Dunix
-I/usr/include/CC -I/usr/include array.C /usr/tmp/AAAa08912.i
/usr/lib/cfront +T/usr/tmp/BAAa08912 +s +t/usr/tmp/CAAa08912 +farray.C +XCarray.o
</usr/tmp/AAAa08912.i
/usr/lib/c++ptcomp -ptv ./ptrepository /usr/tmp/DAAa08912 defmap array.C
/usr/tmp/EAAa08912
CC[ptcomp] locked repository [1] ...
CC[ptcomp] read raw cfront information [0] ...
CC[ptcomp] read old map file [0] ...
CC[ptcomp] made list of unique filenames in new map file [0] ...
CC[ptcomp] deleted old map file entries [0] ...
CC[ptcomp] added in new map entries [0] ...
CC[ptcomp] wrote new map file [0] ...
CC[ptcomp] unlocked repository [0] ...
removing /usr/tmp/AAAa08912.i
removing /usr/tmp/BAAa08912
removing /usr/tmp/CAAa08912
removing /usr/tmp/DAAa08912
removing /usr/tmp/EAAa08912
CC -v -ptv -o example main.o array.o
/usr/lib/c++ptlink -ptH.h, .H, .hxx, .HXX, .hh, .HH, .hpp -ptS.c, .C, .cxx, .CXX,
.cc, .CC, .cpp -ptv ./ptrepository CC /usr/tmp/AAAa08918 /usr/tmp/BAAa08918
/usr/tmp/CAAa08918 defmap /usr/tmp/DAAa08918
CC[ptlink] locked repository [0] ...
CC[ptlink] read name map file list [0] ...
CC[ptlink] read in all objects and archives [2] ...
CC[ptlink] finished link simulation to pick up undefineds [0] ...
CC[ptlink] made list of unique template class names [0] ...
==========left to do==========
Array<int>
CC[ptlink] now looking at template Array<int> [0] ...
CC[ptlink] wrote instantiation file Array__pt__2_i.c [0] ...
/usr/lib/Cpp.ansi -D__hp9000s700 -D_PA_RISC1_1 -$ -Dc_plusplus -D__cplusplus
-D__hp9000s800 -D__hppa -D__hpux -D__unix -Dhp9000s800 -Dhppa -Dhpux -Dunix
-I/usr/include/CC -I/usr/include Array__pt__2_i.c
CC[ptlink] rebuilt header file cache [0] ...
CC[ptlink] did dependency check on Array__pt__2_i.c (missing object) [0] ...
CC[ptlink] CC line is: CC -c -ptr./ptrepository +pti/usr/tmp/AAAa08920 -v
Array__pt__2_i.c [0] ...
/usr/lib/Cpp.ansi -D__hp9000s700 -D_PA_RISC1_1 -$ -Dc_plusplus -D__cplusplus
-D__hp9000s800 -D__hppa -D__hpux -D__unix -Dhp9000s800 -Dhppa -Dhpux -Dunix
-I/usr/include/CC -I/usr/include Array__pt__2_i.c /usr/tmp/AAAa08932.i
/usr/lib/cfront +T/usr/tmp/AAAa08920 +s +t/usr/tmp/CAAa08932 +fArray__pt__2_i.c
+XCArray__pt__2_i.o </usr/tmp/AAAa08932.i
/usr/lib/c++ptcomp -ptl ./ptrepository /usr/tmp/DAAa08932 defmap Array__pt__2_i.c
/usr/tmp/EAAa08932
removing /usr/tmp/AAAa08932.i
removing /usr/tmp/BAAa08932
removing /usr/tmp/CAAa08932
removing /usr/tmp/DAAa08932
removing /usr/tmp/EAAa08932
CC[ptlink] fatal error: could not move Array__pt__2_i.o -->
./ptrepository/Array__pt__2_i.o
CC[ptlink] removing /usr/tmp/AAAa08920 [2] ...
CC[ptlink] removing /usr/tmp/BAAa08920 [0] ...
CC[ptlink] removing /usr/tmp/CAAa08920 [0] ...
removing /usr/tmp/AAAa08918
removing /usr/tmp/BAAa08918
removing /usr/tmp/CAAa08918
removing /usr/tmp/DAAa08918
*** Error code 1
Stop.
@EOF
set `wc -lwc <Make.out`
if test $1$2$3 != 744293941
then
echo ERROR: wc results of Make.out are $* should be 74 429 3941
fi
chmod 644 Make.out
if test -f array.h
then
echo Ok to overwrite existing file array.h\?
read answer
case "$answer" in
[yY]*) echo Proceeding;;
*) echo Aborting; exit 1;;
esac
rm -f array.h
if test -f array.h
then
echo Error: could not remove array.h, aborting
exit 1
fi
fi
echo x - array.h
cat >array.h <<'@EOF'
#ifndef ARRAY_H
#define ARRAY_H
#include <iostream.h>
template<class T>
class Array {
public:
Array(int size = 0) { init_(size); }
~Array() { free_(); }
Array(const Array<T> &a) { copy_(a); }
const Array<T> &operator = (const Array<T> &a);
T &operator [] (int i) const { return data_[i]; }
int size() const { return size_; }
void print() const;
void resize(int size) { free_(); init_(size); }
private:
int size_;
T *data_;
void init_(int size) { data_ = new T[size_ = size]; }
void free_() { delete[] data_; }
void copy_(const Array<T> &);
};
#endif
@EOF
set `wc -lwc <array.h`
if test $1$2$3 != 2691656
then
echo ERROR: wc results of array.h are $* should be 26 91 656
fi
chmod 644 array.h
if test -f main.C
then
echo Ok to overwrite existing file main.C\?
read answer
case "$answer" in
[yY]*) echo Proceeding;;
*) echo Aborting; exit 1;;
esac
rm -f main.C
if test -f main.C
then
echo Error: could not remove main.C, aborting
exit 1
fi
fi
echo x - main.C
cat >main.C <<'@EOF'
#include "array.h"
main()
{
const n = 5;
Array<int> a(n);
for (int i = 0 ; i < n; i++)
a[i] = 2 * i + 14;
a.print();
return 0;
}
@EOF
set `wc -lwc <main.C`
if test $1$2$3 != 1531155
then
echo ERROR: wc results of main.C are $* should be 15 31 155
fi
chmod 644 main.C
if test -f array.C
then
echo Ok to overwrite existing file array.C\?
read answer
case "$answer" in
[yY]*) echo Proceeding;;
*) echo Aborting; exit 1;;
esac
rm -f array.C
if test -f array.C
then
echo Error: could not remove array.C, aborting
exit 1
fi
fi
echo x - array.C
cat >array.C <<'@EOF'
#include "array.h"
/*---------------------------------------------------------------------------*/
template<class T>
const Array<T> &Array<T>::operator = (const Array<T> &a)
{
if (this != &a) {
free_();
copy_(a);
}
return *this;
}
/*---------------------------------------------------------------------------*/
template<class T>
void Array<T>::print() const
{
cout << "[";
for (int i = 0; i < size_; i++) {
if (i > 0)
cout << " ";
cout << data_[i];
}
cout << "]\n";
}
/*---------------------------------------------------------------------------*/
template<class T>
void Array<T>::copy_(const Array<T> &a)
{
data_ = new T[size_ = a.size_];
for (int i = 0; i < size_; i++)
data_[i] = a.data_[i];
}
@EOF
set `wc -lwc <array.C`
if test $1$2$3 != 4387759
then
echo ERROR: wc results of array.C are $* should be 43 87 759
fi
chmod 644 array.C
exit 0