From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21685 invoked by alias); 8 Aug 2009 12:04:52 -0000 Received: (qmail 21663 invoked by uid 22791); 8 Aug 2009 12:04:50 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=BAYES_00,J_CHICKENPOX_82,J_CHICKENPOX_92,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from qw-out-1920.google.com (HELO qw-out-1920.google.com) (74.125.92.144) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 08 Aug 2009 12:04:43 +0000 Received: by qw-out-1920.google.com with SMTP id 5so766139qwc.14 for ; Sat, 08 Aug 2009 05:04:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.100.14 with SMTP id w14mr926321qcn.48.1249733081245; Sat, 08 Aug 2009 05:04:41 -0700 (PDT) Date: Sat, 08 Aug 2009 12:17:00 -0000 Message-ID: <2cd8d8530908080504t30e938d7qeaba0af91de5af16@mail.gmail.com> Subject: How to link a static lib when build a shared lib ? From: Andy To: gcc@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-08/txt/msg00140.txt.bz2 Hi all, I got that, glibc can support SHA in crypt lib since v2.7. There is a requirement in my application to use SHA, but update the whole glibc is too risky. So I want to build a specific crypt lib for the module using crypt function in my application. Now the calling graph seems like this, from a simple view. crypt_user.c ----> call crypt() function in libcrypt.so myutil.c -----> call functions in crypt_user.c, and it will be build to a shared lib, libmyutil.so Executable program : server -----> need to use libmyutil.so to work. Now I can ONLY use the latest static lib libcrypt.a from the new glibc. How should I use it =EF=BC=9F Link it when build libmyutil.so or bui= ld server ? I tried to update my Makefile to link the libcrypt.a, but seems that the called crypt function is not as I expected, it's still from the old gli= bc. Could anybody give me a help with how to use the gcc option and write a working Makefile ? Any reply will be appreciated! Thanks,