From owner-freebsd-ports@FreeBSD.ORG Wed Jun 26 09:00:43 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 92EF615B; Wed, 26 Jun 2013 09:00:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id 56A56188D; Wed, 26 Jun 2013 09:00:43 +0000 (UTC) Received: from spaceball.andric.com (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B19BF5C43; Wed, 26 Jun 2013 11:00:38 +0200 (CEST) Message-ID: <51CAADB8.7090603@FreeBSD.org> Date: Wed, 26 Jun 2013 11:00:40 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Thunderbird/22.0 MIME-Version: 1.0 To: Michael Gmelin Subject: Re: Are ports supposed to build and run on 10-CURRENT? References: <20130613031535.4087d7f9@bsd64.grem.de> <20130626015508.426ab5b9@bsd64.grem.de> In-Reply-To: <20130626015508.426ab5b9@bsd64.grem.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: David Chisnall , "freebsd-ports@freebsd.org Ports" , Matthias Andree X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 09:00:43 -0000 On 2013-06-26 01:55, Michael Gmelin wrote: ... > The problem is that static initialization happens in the expected > order (same translation unit), but termination does *not* happen in the > reverse order of initialization, which - according to the C++ standard > section 3.6.3 should be guaranteed: > > "If the completion of the constructor or dynamic initialization of an > object with static storage duration is sequenced before that of > another, the completion of the destructor of the second is sequenced > before the initiation of the destructor of the first." > > The following conditions have to be met in order to show the problem: > > 1. Two static objects defined in the translation unit containing main > 2. Definition of one of the underlying objects is in a separate > source which is used to build a shared library > 3. Both, the translation unit containing main an the one forming the > shared library are compiled using -fPIC (or -fpic). Strange, if you compile the main program without -fPIC, the testcase works correctly. Normally, there should never be a need to compile a normal executable with -fPIC, but it should not break anything either. I am not sure what causes this, but I will investigate. For now, the workaround is to compile only shared objects with -fPIC. -Dimitry