From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30560 invoked by alias); 20 Dec 2012 19:22:41 -0000 Received: (qmail 30543 invoked by uid 22791); 20 Dec 2012 19:22:40 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-vc0-f179.google.com (HELO mail-vc0-f179.google.com) (209.85.220.179) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Dec 2012 19:22:37 +0000 Received: by mail-vc0-f179.google.com with SMTP id p1so4162903vcq.38 for ; Thu, 20 Dec 2012 11:22:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.36.19 with SMTP id m19mr13794313vdj.33.1356031356347; Thu, 20 Dec 2012 11:22:36 -0800 (PST) Received: by 10.220.91.10 with HTTP; Thu, 20 Dec 2012 11:22:36 -0800 (PST) Date: Thu, 20 Dec 2012 19:22:00 -0000 Message-ID: Subject: Spurious undefined reference error? From: Dan Kegel To: binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2012-12/txt/msg00212.txt.bz2 The command (sanitized) g++ -Wl,--verbose -v -pthread videos.C -Wl,-rpath,/opt/foo/bar/lib -L/opt/foo/bar/lib \ -lxxx3 -lxxx6++ -llxxx7++ -lxxx6 -lxxx7 ../xxx8/xxx8.a -o videos fails for me with found libxxx6++.so at /opt/foo/bar/lib/libxxx6++.so /usr/local/bin/ld: /opt/foo/bar/lib/libxxx3.so: undefined reference to symbol 'foo::xxx6::bletch() const' /usr/local/bin/ld: note: 'foo::xxx6::bletch() const' is defined in DSO /opt/foo/bar/lib/libxxx6++.so so try adding it to the linker command line The commandline g++ -Wl,--verbose -v -pthread videos.C -Wl,-rpath,/opt/foo/bar/lib -L/opt/foo/bar/lib \ -lxxx3 -lxxx6++ -llxxx7++ -lxxx6 -lxxx7 ../xxx8/xxx8.a /opt/foo/bar/lib/libxxx6++.so -o videos works. Why, if it was able to find the library, can't it use it without an absolute path? ld --version says 2.22; this is the stock linker on ubuntu 12.04 x86-64. (Building a fresh binutils-2.23 from source in /usr/local doesn't seem to help.... probably because even /usr/local/bin/ld --version still says 2.22 then, so evidently it's not that easy to replace binutils. A clue on how to gather more info would be appreciated.)