From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1111 invoked by alias); 4 Oct 2010 16:14:44 -0000 Received: (qmail 1103 invoked by uid 22791); 4 Oct 2010 16:14:43 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Oct 2010 16:14:37 +0000 From: "r.menges at nice2cu dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45880] Template-Methode in Shared Object not resolved when compiled with -O2 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: r.menges at nice2cu dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 04 Oct 2010 16:14:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg00338.txt.bz2 Message-ID: <20101004161400.Q61D7NJp0esT-YQpbZeH7hCg7B_Hd2GH8ZYTjqE9JFM@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45880 --- Comment #4 from r.menges at nice2cu dot de 2010-10-04 16:14:34 UTC --- (In reply to comment #3) > Please also show the error you're getting, as "crashes the application because > of a symbol-not-defined-error" is not very helpful > > I don't think this has anything to do with using a template function, I think > you've just built it wrong Actually i didn't write the makefile myself, it was generated by netbeans (6.7.). I am sorry, i was inexact about the error message: The symbol-not-defined is the error i see when using the original-code, which is executed in an apache context. The example simply crashes with an segfault. But you are right, the option -share is what caused the segfault in this example. After i removed the -shared option manually from the generated makefile, the example crashes no more. The "real" applications runs as an extension to php5 in the context of apache, it's an libary for c++-php-bridge we builded (so that c++-objects can be mapped into the space of php). This is where undefined symbol errors crashes the httpd-process with an error of undefined symbol, when using template void printMessage(MsgType msg); void printMessage(const char *); it misses the implemetation for std::string.