From owner-freebsd-questions@FreeBSD.ORG Fri May 1 22:00:25 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 093882C3 for ; Fri, 1 May 2015 22:00:25 +0000 (UTC) Received: from mail.qcislands.net (mail.qcislands.net [23.235.65.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE9BD12C7 for ; Fri, 1 May 2015 22:00:24 +0000 (UTC) Received: from 254-68-235-23.qcislands.net ([23.235.68.254] helo=[192.168.1.8]) by mail.qcislands.net with esmtp (Exim 4.82) (envelope-from ) id 1YoIyt-000PRO-9J; Fri, 01 May 2015 15:00:23 -0700 Message-ID: <5543F76E.7060207@paz.bz> Date: Fri, 01 May 2015 15:00:14 -0700 From: Jim Pazarena User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: compiling static Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-local_scan: locally submitted (54) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2015 22:00:25 -0000 It was as simple as placing -static on the gcc command line On 2015-05-01 2:22 PM, Alex Merritt wrote: > On Fri, May 1, 2015 at 5:02 PM, Jim Pazarena wrote: > >> is there a way to tell cc (clang) to compile with static libraries? > > > If you want to _compile_ code to a static library, you generate the object > files and then use "ar" to assemble them together into an archive file (.a). > > cc -c file0.c file1.c ... > ar rcus lib.a file0.o file1.o ... > > If you want to _link to_ (if that's what you mean by "compile with") static > libraries, you may specify the archive path to the linker instead of using > the dynamic linker flag (-l). > > cc prog.c /path/to/lib.a -o prog > > There may be other ways I am unfamiliar with. Is this not how gcc does it > also? > > -Alex > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >