From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25958 invoked by alias); 1 Oct 2004 18:17:41 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 25929 invoked from network); 1 Oct 2004 18:17:36 -0000 Received: from unknown (HELO smtp-01.servidoresdns.net) (217.76.146.200) by sourceware.org with SMTP; 1 Oct 2004 18:17:36 -0000 Received: from pcdjgr (160.Red-80-36-186.pooles.rima-tde.net [80.36.186.160]) by smtp-01.servidoresdns.net (Postfix) with SMTP id 5D7473974B2 for ; Fri, 1 Oct 2004 20:17:35 +0200 (CEST) Message-ID: <016c01c4a7e2$bf24e450$420216ac@deimosspace.com> From: =?iso-8859-1?Q?Danilo_Jos=E9?= To: Subject: problems porting from UNIX to Mac OS X 10.2 Darwin 6.8 Date: Fri, 01 Oct 2004 18:17:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-SW-Source: 2004-10/txt/msg00007.txt.bz2 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::ObjAppendList(long, gol *const *) U gol::ObjAppendList::ObjAppendList(long, gol *const *) 00000d30 S gol::ObjAppendList::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::ObjAppendList(long, gol *const *) nm StdError.o | grep ___Q23golt13ObjAppendList1ZPQ23gol14CalcBinderDatalPCPB1 | c++filt U gol::ObjAppendList::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::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::ObjAppendList[in-charge](long, gol::CalcBinderData* const*) Inside the ObjAppendListTypes.o T gol::ObjAppendList::ObjAppendList[in-charge](long, gol::CalcBinderData* const*) Inside the library libgol.a that I am trying to build like this : U gol::ObjAppendList::ObjAppendList[in-charge](long, gol::CalcBinderData* const*) 00011234 T gol::ObjAppendList::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; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendList; template class ObjAppendListP; template class ObjAppendList; template class ObjAppendListP; template class ObjAppendList; template class ObjAppendListP; template class ObjAppendList; template class ObjAppendList; template class ObjAppendListP; template class ObjAppendList; template class ObjAppendListP; template class ObjAppendList; template class ObjAppendListP; template class ObjAppendList; template class ObjAppendListP; } // namespace gol #endif The templates definition are in one .h file.