From owner-freebsd-hackers@FreeBSD.ORG Tue May 24 04:48:14 2005 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F2B916A41C for ; Tue, 24 May 2005 04:48:14 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id DBDFB43D48 for ; Tue, 24 May 2005 04:48:13 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j4O4m9fT049940; Mon, 23 May 2005 23:48:09 -0500 (CDT) (envelope-from dan) Date: Mon, 23 May 2005 23:48:09 -0500 From: Dan Nelson To: Darren Pilgrim Message-ID: <20050524044808.GD16069@dan.emsphone.com> References: <000401c56012$b34a3570$0a2a15ac@SMILEY> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000401c56012$b34a3570$0a2a15ac@SMILEY> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i Cc: hackers@freebsd.org Subject: Re: Forcing static-linking on a port? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2005 04:48:14 -0000 In the last episode (May 23), Darren Pilgrim said: > I need to make use of a port during start up, but it has library > dependencies that aren't available, before the complete library path is > established. I've tried the following: > > NO_SHARED=true (added to /etc/make.conf) > make -DNO_SHARED > make LDFLAGS+=-static > > Every time, running file on the compiled program tells me that the binary is > dynamically-linked. I couldn't find anything else in any man pages, Mk > files, mailing lists, Google, etc. Sorry for the semi-inappropriate list > choice, but this one would get swallowed up on -questions. NO_SHARED only works on programs that use the bsd.prog.mk makefile template; I'd guess under a dozen ports do this. Some pieces of software have dynamic-link options hardcoded in their Makefiles, probably as a workaround for bugs in other OSes. Those options override -static. I can't think of a valid reason for them to be used in FreeBSD. Search for (and remove) any occurances of -Wl,-Bdynamic and -Wl,-Bstatic , and you should be set. -- Dan Nelson dnelson@allantgroup.com