From owner-freebsd-questions@FreeBSD.ORG Wed Mar 7 10:04:43 2012 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0C90106564A for ; Wed, 7 Mar 2012 10:04:43 +0000 (UTC) (envelope-from c.kworr@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3BED88FC17 for ; Wed, 7 Mar 2012 10:04:43 +0000 (UTC) Received: by eaaf13 with SMTP id f13so2254359eaa.13 for ; Wed, 07 Mar 2012 02:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Dh2Aaaz6/XdhF8bkAyv1WJUJrKdSPVIyzFdQ+dsvZRI=; b=qnVk0mFA3ftDdbWOJ+oUHXEXz93OXOYS8fLMipN+R0LPXMbOr/eTNx5Ah3b6UUXdQ5 T9uW+LCBZZPnintvmE3b9E61MkHz/mS7BIc8T2M9UC6yqL4pyRhWhKGT86b9zeZJSlFp u6FwTMbHEODKKUOvIfTrCCUWVb0g8jjiJLfeRPZ8phJCReZjTrLPayX/PZcMsSM4wA5y dK4awXeXJz1uXhYhzwHsi1xNvwInh98iLvvDT5MBKiPIg7ryWnCAhRPMkm63ntBNfwrt Vi0MAf5u/3pCdYG4xo8RRiDn4zVk/RLMso8c3fzyiohWQAhGFcwDR0u/DDeZOmM++3rd k7ag== Received: by 10.14.28.4 with SMTP id f4mr621882eea.52.1331113219134; Wed, 07 Mar 2012 01:40:19 -0800 (PST) Received: from green.tandem.local (75-208-132-95.pool.ukrtel.net. [95.132.208.75]) by mx.google.com with ESMTPS id o49sm85360540eeb.7.2012.03.07.01.40.17 (version=SSLv3 cipher=OTHER); Wed, 07 Mar 2012 01:40:18 -0800 (PST) Message-ID: <4F572CFF.8030708@gmail.com> Date: Wed, 07 Mar 2012 11:40:15 +0200 From: Volodymyr Kostyrko User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120220 Firefox/10.0.2 SeaMonkey/2.7.2 MIME-Version: 1.0 To: Doug Hardie References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "questions@FreeBSD.org" Subject: Re: Dynamic Libraries X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2012 10:04:43 -0000 Doug Hardie wrote: > I have encountered something that I do not understand. Everything works fine. Basically I have a bunch of user modules (low level) that are built into a dynamic library. If I write top level code that calls modules in that library, everything works just fine on i386 and AMD64. However, the application involved has another library of modules. Some of them call modules in the low level library. The top level code call modules in both libraries. Often when it calls a module in the mid level library, that module calls several modules in the low level library. > > All this works just fine on i386. However, when I compile everything on AMD64 I get an error message that says the lower level library needs to be compiled with fPIC. If I add that to the Makefile for the lower level library and rebuild everything, it all works again. I don't understand why the fPIC is required for AMD64. > > Also, how do I tell if the lower level library is being dynamically linked at run time, or being directly incorporated into the mid level library or top level application? Since both of these libraries are quite large, and they are in use by a number of top level applications, I want just one copy to exist in physical memory. This sounds exactly like compiling with clang through ccache. There are issues with clang and ccache cooperation. Actually the one you may hit is libtool detecting implicit fPIC requirement when running clang through ccache. -- Sphinx of black quartz judge my vow.