From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12646 invoked by alias); 17 Oct 2013 06:39:31 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 12633 invoked by uid 89); 17 Oct 2013 06:39:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f42.google.com Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 17 Oct 2013 06:39:29 +0000 Received: by mail-pa0-f42.google.com with SMTP id kx10so2294638pab.1 for ; Wed, 16 Oct 2013 23:39:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=moouEDo7yVC+uptBbBvPLBDV3qL/58/pAjBqFE45Ptg=; b=PMNa6MyX1oRopX8siXeK6V/Uup2rqlaxnfDA4wHzEhpNKtc8hXmnGnSSWO798DOpGh mYC+ZfthhsrirKqSi9Ypjq+73YNff+oAQOpf/2MC7xl3QvTc3/2d/eCMKt3RYQS/kGLF lVjcl19EQSlx79bX0ZH3apD6Hfddg6hRLl1Gt0gMi2+U3CZ1O8pXU0Fp5TgqXNlwTvUz kNJt0brDZqXyXUPuCpM35/k+g/3UHXaBUHUW+rg3dBLwcybJjJ3yHQnvwY3l2TqwICU0 FuG3IyxniHn3kfq5oQongWS90MYI1kTXbdXvdV9P9gxEAv7ruAZbFz38J6uvgJIRqaa1 4sQQ== X-Gm-Message-State: ALoCoQlSxrIfn8ynGMc+Gw2oeiTS1Ii8/ohYlCJAOEgu0ybEOixprbFlAqMrdSzUB8cTCdkwuT0X X-Received: by 10.68.180.5 with SMTP id dk5mr1255131pbc.176.1381991967906; Wed, 16 Oct 2013 23:39:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.66.189.226 with HTTP; Wed, 16 Oct 2013 23:39:07 -0700 (PDT) In-Reply-To: References: <80070575041F1A43B43673DA71C5B0BCBBE2B2EBBC@INBLRK77M1MSX.in002.siemens.net> <80070575041F1A43B43673DA71C5B0BCBBE2B2EC65@INBLRK77M1MSX.in002.siemens.net> From: net_robber Date: Thu, 17 Oct 2013 06:39:00 -0000 Message-ID: Subject: Re: how could make gcc link static library default? To: Terry Guo Cc: "Anandkumar, CB IN BLR STS" , "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00054.txt.bz2 thanks for your share, but this is can be use in case you know what type of the library is. could it be done by gcc auto?? On Thu, Oct 17, 2013 at 1:48 PM, Terry Guo wrote: > On Thu, Oct 17, 2013 at 1:05 PM, Anandkumar, CB IN BLR STS > wrote: >> Hi Terry, >> Normally dynamic is given more preference over static so this sh= ould work. >> > > Got your point. Thanks. > > BR, > Terry > >> With Regards, >> Anand >> >> -----Original Message----- >> From: Terry Guo [mailto:flameroc@gmail.com] >> Sent: Thursday, October 17, 2013 10:09 AM >> To: Anandkumar, CB IN BLR STS >> Cc: net_robber@timectrl.net; gcc-help@gcc.gnu.org >> Subject: Re: how could make gcc link static library default? >> >> On Thu, Oct 17, 2013 at 12:21 PM, Anandkumar, CB IN BLR STS wrote: >>> Hi, >>> You try both static and dynamic linking with following options = with example mentioned below: >>> If you have want to compile a program test.c which is dependent= on 2 static library foo1 and foo2 and one dynamic library foo3 then below = mentioned command will do the trick. >>> >>> gcc test.c -W1,-Bstatic -lfoo1 -lfoo2 -W1,-Bdynamic -lfoo3 -o >>> test >>> >>> >>> Try this trick on any number of static and dynamic libraries. >> >> Thanks for sharing and sorry for interrupting. I am thinking another sim= ilar scenario: sometimes the foo3 exists in dynamic library, sometimes it e= xists in static library. Is it possible to let gcc search the dynamic one f= irst and then search the static one if dynamic doesn't exist? Does command = like below works? >> >> gcc test.c -Wl,-Bdynamic -lfoo3 -Wl,-Bstatic -lfoo3 -o test >> >> And if both dynamic one and static exist, is it possible to let gcc choo= se the dynamic one over the static one or choose the static one over the dy= namic one? Thanks. >> >> BR, >> Terry >> >>> >>> With Regards, >>> Anand >>> >>> -----Original Message----- >>> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] >>> On Behalf Of net_robber >>> Sent: Thursday, October 17, 2013 9:10 AM >>> To: gcc-help@gcc.gnu.org >>> Subject: how could make gcc link static library default? >>> >>> hi, >>> >>> i know a option -static to force gcc link static library, which will ig= nore shared library. >>> but in my case, some library just have shared library. >>> so, is want gcc linlk static library first, then shared library if >>> static one was not found >>> >>> how to do that?