public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problems porting from UNIX  to Mac OS X 10.2 Darwin 6.8
@ 2004-10-01 18:17 Danilo José
  0 siblings, 0 replies; only message in thread
From: Danilo José @ 2004-10-01 18:17 UTC (permalink / raw)
  To: gcc-help

 have some problems porting a working code to the gcc-937.2 gcc2 based on
the gcc 2.95.2.

 The same library works fine with gcc 1175, (gcc3 based on 3.1).

  The thing is why the same library in gcc 1175, (gcc3 based on 3.1)  with
the same flags gives problems of undefined reference symbols when building
the executable. I have already tried the f-no-implicit-templates flag.

 have compiled  the objects without any problem. I create the static library
using the ar command.

 The thing is that when I use the library to build an executable it gives me
some errors of undefined symbols.

  One person of another mail list, recommended me to compile everything in
an object, using ld -r *.o -o new.o. And then build de library with those
values.

  With this the number of unreferenced symbols reduced to 4 only. That
appear as 's' when calling to nm and c++filt.

  He recommended me to delete no_toc in the temporary .s files, but it did
not have any other effect. And to change in the temporary files, the
private_extern for globl. It gave a lot of problems.

  I do not find the libgcc.a inside the 2.95.2 directory, only the 3.1
directory, maybe that is affecting the building.


  But if I use directly the objects the executable works correctly.

g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
ar crs -crv  ./../lib/Mac_OS_10/libgol.a String.o StdError.o InputStream.o
JulianDate.o
ser.tab.o CalcScanner.tab.o lex.Calc.o ObjAppendListTypes.o
r - String.o
r - StdError.o
r - InputStream.o
r - JulianDate.o
r - RawBuffer.o
r - Args.o
r - Statistic.o
r - CalcParser.tab.o
r - CalcScanner.tab.o
r - lex.Calc.o
r - ObjAppendListTypes.o
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -o calc_test String.o StdError.o InputStream.o JulianDate.o RawBuffer.o
Args.o Stat
b.o lex.Calc.o ObjAppendListTypes.o
 CalcTest.o -L./../lib/Mac_OS_10 -lgol -L/usr/lib -
g++ -c -DMacintosh -O2 -fvtable-thunks -frepo -fno-implicit-templates  -I./.
./include -
g++ -o calc_test_bind
CalcTestBind.o -L./../lib/Mac_OS_10 -lgol -L/usr/lib -lstdc++ -lm
/usr/bin/ld: Undefined symbols:
___Q23golt13ObjAppendList1ZPQ23gol14CalcBinderDatalPCPB1
___Q23golt13ObjAppendList1ZblPCb
___ls__Q23golt13ObjAppendList1ZPQ23gol14CalcBinderDataRCPB1
___ls__Q23golt13ObjAppendList1ZbRCb
___Q23golt13ObjAppendList1ZPQ23gol8CalcNodelPCPB1
___Q23golt13ObjAppendList1ZPvlPCPv
___Q23golt13ObjAppendList1ZcRCB0
___Q23golt13ObjAppendList1ZclPCc
___as__Q23golt13ObjAppendList1ZcRCB0
___ls__Q23golt13ObjAppendList1ZPQ23gol8CalcNodeRCPB1
___ls__Q23golt13ObjAppendList1ZPvRCPv
_append__Q23golt13ObjAppendList1ZclPCc
_reverse__Q23golt13ObjAppendList1ZPQ23gol8CalcNode
make: *** [calc_test_bind] Error 1


So as you can see when building calc_test, there is no problem because it
uses the objects directly, but when using the library it fails.

   I have checked the library with nm and this is what appears:

nm ../lib/Mac_OS_10/libgol.a | grep
___Q23golt13ObjAppendList1ZPQ23gol14CalcBinderDatalPCPB1 | c++filt
         U gol::ObjAppendList<gol::CalcBinderData *>::ObjAppendList(long,
gol *const *)
         U gol::ObjAppendList<gol::CalcBinderData *>::ObjAppendList(long,
gol *const *)
00000d30 S gol::ObjAppendList<gol::CalcBinderData *>::ObjAppendList(long,
gol *const *)


 My workmate is telling me that maybe is because the flags of compilations
of the objects.

   I see in the library three references to the method that it says it is
undefined.

nm ObjAppendListTypes.o | grep
___Q23golt13ObjAppendList1ZPQ23gol14CalcBinderDatalPCPB1 | c++filt

00000d30 S gol::ObjAppendList<gol::CalcBinderData *>::ObjAppendList(long,
gol *const *)

nm StdError.o | grep
___Q23golt13ObjAppendList1ZPQ23gol14CalcBinderDatalPCPB1 | c++filt
         U gol::ObjAppendList<gol::CalcBinderData *>::ObjAppendList(long,
gol *const *)

  The strange thing, it appears a reference to it inside CalcParser.tab.o,
that does not appear with the gcc 3.1:

         U gol::ObjAppendList<gol::CalcBinderData *>::ObjAppendList(long,
gol *const *)

  So the thing, is that as far as I have seen. In the compilation of the
gcc 3.1 in Mac_OS_X:

    The symbols appear like this inside the StdError.o , when doing a c++
filt.

         U
gol::ObjAppendList<gol::CalcBinderData*>::ObjAppendList[in-charge](long,
gol::CalcBinderData* const*)

   Inside the ObjAppendListTypes.o

          T
gol::ObjAppendList<gol::CalcBinderData*>::ObjAppendList[in-charge](long,
gol::CalcBinderData* const*)

    Inside the library libgol.a that I am trying to build like this :

U gol::ObjAppendList<gol::CalcBinderData*>::ObjAppendList[in-charge](long,
gol::CalcBinderData* const*)
00011234 T
gol::ObjAppendList<gol::CalcBinderData*>::ObjAppendList[in-charge](long,
gol::CalcBinderData* const*)



ObjAppendListTypes.C is a file that has all the instantiations of the
templates needed by the code:
   Like this:

namespace gol
{

template class ObjAppendList<char>;
template class ObjAppendList<unsigned char>;
template class ObjAppendList<signed char>;
template class ObjAppendList<short>;
template class ObjAppendList<unsigned short>;
template class ObjAppendList<long>;
template class ObjAppendList<unsigned long>;
template class ObjAppendList<long long>;
template class ObjAppendList<unsigned long long>;
template class ObjAppendList<float>;
template class ObjAppendList<double>;
template class ObjAppendList<String>;
template class ObjAppendList<const char*>;
template class ObjAppendList<int>;
template class ObjAppendList<bool>;

template class ObjAppendList<void *>;

template class ObjAppendListP<stringstream>;
template class ObjAppendList<stringstream*>;

template class ObjAppendListP<String>;
template class ObjAppendList<String*>;

template class ObjAppendListP<JulianDate>;
template class ObjAppendList<JulianDate*>;

template class ObjAppendList<RawBuffer *>;
template class ObjAppendListP<RawBuffer>;

template class ObjAppendList<CalcNode *>;
template class ObjAppendListP<CalcNode>;

template class ObjAppendList<CalcBinder *>;
template class ObjAppendListP<CalcBinder>;

template class ObjAppendList<CalcBinderData *>;
template class ObjAppendListP<CalcBinderData>;

} // namespace gol
#endif

   The templates definition are in one .h file.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-01 18:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-01 18:17 problems porting from UNIX to Mac OS X 10.2 Darwin 6.8 Danilo José

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).