From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11299 invoked by alias); 30 Sep 2012 10:00:44 -0000 Received: (qmail 11287 invoked by uid 22791); 30 Sep 2012 10:00:43 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Sep 2012 10:00:36 +0000 Received: by iebc13 with SMTP id c13so12219388ieb.20 for ; Sun, 30 Sep 2012 03:00:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.212.3 with SMTP id ng3mr2833282igc.58.1348999236043; Sun, 30 Sep 2012 03:00:36 -0700 (PDT) Received: by 10.42.197.202 with HTTP; Sun, 30 Sep 2012 03:00:35 -0700 (PDT) In-Reply-To: References: <680BABF85B31BC4DB6E3E4E33D569F4D0AC12D1B@NHEXCH2.allegro.msad> <1E5FA3D775D47342864BD139C7582A5503BF3649@ALPMLVEM05.e2k.ad.ge.com> Date: Sun, 30 Sep 2012 10:00:00 -0000 Message-ID: Subject: Re: is there any way to change the order of name resolution in linking (aside from putting the libraries in the right order?) From: Jonathan Wakely To: Dan Hitt Cc: "Vardhan, Sundara (GE Transportation)" , gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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 X-SW-Source: 2012-09/txt/msg00250.txt.bz2 On 30 September 2012 02:05, Dan Hitt wrote: > Thanks Sundara. > > Actually, i tried several variations to try to specify the extension. > > These are the variations i tried, with the results: > -lX11 (found, but does not resolve symbols) At the start of the link line there are no symbols to resolve. If -lX11 finds both libX11.so and libX11.a then it will prefer the shared library, and --whole-archive doesn't affect shared libraries. > -lX11a (cannot find) This looks for a library called libX11a.so or libX11a.a so obviously won't work. > -lX11.a (cannot find) This looks for libX11.a.so or libX11.a.a, so won't work. > lX11 (cannot find) This looks for a file called lX11 in the current dir. > libX11 (cannot find) > libX11a (cannot find) > libX11.a (cannot find) > llibX11.a (cannot find) Similarly, these look for files with that exact name in the current dir. > -llibX11.a (cannot find) This looks for liblibX11.a.so or liblibX11.a.a, so won't work. > Just for reference, these go in the arguments as > -Wl,--whole-archive,<>,--no-whole-archive > > and so far, the only things that don't bail are -lX11 and > /usr/lib/...../libX11.a, > and the latter is the only thing that actually resolves any symbols. You could make the former work (e.g. with --no-as-needed or -static) but giving the full path to the static archive works too.