From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 5 11:01:42 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC716106564A for ; Thu, 5 Feb 2009 11:01:42 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159]) by mx1.freebsd.org (Postfix) with ESMTP id 419248FC18 for ; Thu, 5 Feb 2009 11:01:41 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so109968fgb.35 for ; Thu, 05 Feb 2009 03:01:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=NDctjCbEbSFbCcqdEnmjPg0k+Q5liCPjqYUmRYgzpFE=; b=v3uHKDYWb/8lKjYza+gUim2d1ojvvZXV5CRZHw8D9qrHhxDOF7eo3G7JJnHoTWy20e XK6tbLDQZtEjs5cP9sZziLXRxjd+ein89XfyhICYsrZhuX56z/RiVXngmAM0eChOzPzK Zp0eO06cSbqeuNBoT4vkuxRI/rmbgcNcSAi+Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=BlFi3uuOz3ZVKAMklVRMZx55hvUGjxKCyJYWoKjPOiLOISQGTBjQN8QlAQumHRCIjR 3qrBW04/P0oAQ+2pmh8Wi18x0UZ7cbz4WrVqHoF7n51mHAIizSXz5CJTKgSchP+i6nM7 ZljX849PslWgVlKX5FaN6Cpuu/26712Vmgdyk= MIME-Version: 1.0 Received: by 10.86.99.9 with SMTP id w9mr255180fgb.12.1233831701160; Thu, 05 Feb 2009 03:01:41 -0800 (PST) Date: Thu, 5 Feb 2009 14:01:41 +0300 Message-ID: From: pluknet To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: linking .a lib with another library 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: Thu, 05 Feb 2009 11:01:42 -0000 Hi. The problem is: I have a program which is statically linked to my static lib during a build. The lib is in turn uses kvm*() calls, hence it should be linked with libkvm. During the build of my binaries which are linked to my libucron.a I get the following: /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x6e): In function `check_pidfile': : undefined reference to `kvm_open' /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x8b): In function `check_pidfile': : undefined reference to `kvm_getprocs' /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0xbe): In function `check_pidfile': : undefined reference to `kvm_getprocs' /usr/home/pluknet/svn/ucron/ksucron/crond/../lib/libucron.a(misc.o)(.text+0x106): In function `check_pidfile': : undefined reference to `kvm_close' *** Error code 1 Ok, if I add SHLIB_MAJOR directive in lib/Makefile (or remove any kvm* references) then all is ok. But the lib is used to be static. So the question is can I somehow link two .a libraries? e.g. libkvm.a + libucron.a + my binaries. Thanks. -- wbr, pluknet