From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27727 invoked by alias); 21 Aug 2011 09:52:43 -0000 Received: (qmail 27718 invoked by uid 22791); 21 Aug 2011 09:52:42 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,TW_PM,TW_SV X-Spam-Check-By: sourceware.org Received: from iona.labri.fr (HELO iona.labri.fr) (147.210.8.143) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 21 Aug 2011 09:52:25 +0000 Received: from localhost (localhost [127.0.0.1]) by iona.labri.fr (Postfix) with ESMTP id 3664E746 for ; Sun, 21 Aug 2011 11:52:21 +0200 (CEST) Received: from iona.labri.fr ([127.0.0.1]) by localhost (iona.labri.fr [127.0.0.1]) (amavisd-new, port 10027) with LMTP id UE1Peoes+nwq for ; Sun, 21 Aug 2011 11:52:21 +0200 (CEST) Received: from [192.168.1.100] (mek33-6-88-181-13-93.fbx.proxad.net [88.181.13.93]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by iona.labri.fr (Postfix) with ESMTPSA id E52FF47B for ; Sun, 21 Aug 2011 11:52:20 +0200 (CEST) Message-ID: <4E50D56F.1070806@labri.fr> Date: Sun, 21 Aug 2011 09:52:00 -0000 From: Emmanuel Fleury User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110626 Icedove/3.1.11 MIME-Version: 1.0 To: gcc@gcc.gnu.org Subject: Critical behavioral change between g++-4.4/g++-4.5 and g++-4.6 ? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00370.txt.bz2 Hi, I was trying to compile a project called kyua with g++-4.6 and I did hit a linking error. It seems that a method was missing. After some discussions with the main developer of the project, it appeared that depending on the version of g++ we were using the build was going nicely (g++-4.4/g++-4.5) or was hitting a linking error (g++-4.6). Here is the error: g++ -I/usr/include/lua5.1 -I/usr/include/lua5.1 -I/usr/include/lua5.1 -I/usr/include/lua5.1 -I/usr/include/lua5.1 -I/usr/local/include -g -O2 -D_FORTIFY_SOURCE=2 -Wall -Wcast-qual -Wextra -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow -Wsign-compare -Wswitch -Wwrite-strings -DNDEBUG -Wabi -Wctor-dtor-privacy -Wno-deprecated -Wno-non-template-friend -Wno-pmf-conversions -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo -Wsynth -o cli/cmd_about_test cli/cli_cmd_about_test-cmd_about_test.o libcli.a libengine.a libutils.a -llua5.1 libutils.a -llua5.1 libengine.a libutils.a -llua5.1 libutils_test.a libutils.a -llua5.1 libutils.a -llua5.1 -L/usr/local/lib -latf-c++ -latf-c cli/cmd_about_test.cpp:106: error: undefined reference to 'utils::cmdline::base_command::main(utils::cmdline::ui*, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, engine::user_files::config const&)' cli/cmd_about_test.cpp:106: error: undefined reference to 'utils::cmdline::base_command::main(utils::cmdline::ui*, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, engine::user_files::config const&)' cli/cmd_about_test.cpp:87: error: undefined reference to 'utils::cmdline::base_command::main(utils::cmdline::ui*, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, engine::user_files::config const&)' cli/cmd_about_test.cpp:87: error: undefined reference to 'utils::cmdline::base_command::main(utils::cmdline::ui*, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, engine::user_files::config const&)' collect2: ld returned 1 exit status And, indeed, when getting the symbols from the static libraries built with g++-4.4 (I had it on my system, but I can install g++-4.5 if needed) and g++-4.6, I got the following output (you will see that the method requested by the linker is missing in libcli.a): =========== = g++-4.4 = =========== $myshell> for lib in *.a; do echo; echo "Scanning lib ${lib}: "; echo "======================="; nm ${lib} | grep main; done Scanning lib libcli.a: ======================= libcli_a-main.o: 000003a0 t _ZN12_GLOBAL__N_1L9safe_mainEPN5utils7cmdline2uiEiPKPKcSt8auto_ptrINS1_12base_commandIN6engine10user_files6configEEEE 00001510 T _ZN3cli4mainEPN5utils7cmdline2uiEiPKPKcSt8auto_ptrINS1_12base_commandIN6engine10user_files6configEEEE 00001b00 T _ZN3cli4mainEiPKPKc 00000000 W _ZN5utils7cmdline12base_commandIN6engine10user_files6configEE4mainEPNS0_2uiERKSt6vectorISsSaISsEERKS4_ Scanning lib libengine.a: ======================= Scanning lib libutils.a: ======================= 000008a0 T _ZN5utils7cmdline20base_command_no_data4mainEPNS0_2uiERKSt6vectorISsSaISsEE Scanning lib libutils_test.a: ======================= =========== = g++-4.6 = =========== $myshell> for lib in *.a; do echo; echo "Scanning lib ${lib}: "; echo "======================="; nm ${lib} | grep main; done Scanning lib libcli.a: ======================= libcli_a-main.o: 00000000 T _ZN3cli4mainEPN5utils7cmdline2uiEiPKPKcSt8auto_ptrINS1_12base_commandIN6engine10user_files6configEEEE 00001180 T _ZN3cli4mainEiPKPKc Scanning lib libengine.a: ======================= Scanning lib libutils.a: ======================= 00000000 T _ZN5utils7cmdline20base_command_no_data4mainEPNS0_2uiERKSt6vectorISsSaISsEE Scanning lib libutils_test.a: ======================= So, now, I am looking for help to know if the problem is coming from the code or from g++-4.6. Does this problem ring a bell to anyone ? If you want to get the code that produce this problem (sorry I didn't manage to circumvent the problem to a small piece of code), here are the instructions (which are quite long I'm afraid). 1) Install atf (make, make install): http://www.netbsd.org/~jmmv/atf/releases/0.14/ 2) Get the source code of kyua: svn co http://kyua.googlecode.com/svn/trunk/kyua-cli 3) cd kyua-cli 4) autoreconf -i -s -I /usr/local/share/aclocal 5) ./configure && make Thanks in advance ! Regards -- Emmanuel Fleury The most important thing in the programming language is the name. A language will not succeed without a good name. I have recently invented a very good name and now I am looking for a suitable language. -- Donald Knuth