From owner-freebsd-questions@FreeBSD.ORG Wed Mar 7 09:31:52 2012 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D4B51065672 for ; Wed, 7 Mar 2012 09:31:52 +0000 (UTC) (envelope-from bc979@lafn.org) Received: from zoom.lafn.org (zoom.lafn.org [108.92.93.123]) by mx1.freebsd.org (Postfix) with ESMTP id 635D58FC08 for ; Wed, 7 Mar 2012 09:31:52 +0000 (UTC) Received: from [10.0.1.2] (pool-96-229-186-65.lsanca.fios.verizon.net [96.229.186.65]) (authenticated bits=0) by zoom.lafn.org (8.14.3/8.14.2) with ESMTP id q278rEqq043007 for ; Wed, 7 Mar 2012 00:53:15 -0800 (PST) (envelope-from bc979@lafn.org) From: Doug Hardie Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Wed, 7 Mar 2012 00:53:13 -0800 Message-Id: To: "questions@FreeBSD.org" Mime-Version: 1.0 (Apple Message framework v1257) X-Mailer: Apple Mail (2.1257) X-Virus-Scanned: clamav-milter 0.97 at zoom.lafn.org X-Virus-Status: Clean Cc: Subject: 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 09:31:52 -0000 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.=