Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKu1f-0001Wd-PR for pgsql-odbc@arkaria.postgresql.org; Wed, 06 Jul 2016 21:06:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bKu1e-00023L-Tv for pgsql-odbc@arkaria.postgresql.org; Wed, 06 Jul 2016 21:06:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKu1e-00023B-FW for pgsql-odbc@postgresql.org; Wed, 06 Jul 2016 21:06:30 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bKu1b-0006Q9-Ax for pgsql-odbc@postgresql.org; Wed, 06 Jul 2016 21:06:29 +0000 Received: by mail-wm0-x242.google.com with SMTP id r201so1357062wme.0 for ; Wed, 06 Jul 2016 14:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=BgQ9juGMSU4pa0qPQoiNu+HJxrI00HVSUI4zIxZO18E=; b=pOUZs0vQCswARgro8zs5oW6uPnQz4571HGd5RCqzuU7XA1aD2auSFsmgHD8X/KXUD+ EHRXqboOdZ/N75IHysGdCmxSDvU+ozx7VwLpE0mtGU9jI5oDHKex+qoFiRiO5m4lhAeR iCkVzx/PfEX1fzvs1V4loMJJck/E0s4b0rbaNMg9uNR8Ds4Kx/dn2Ee2lkpCHBfJmWSK arTH71nbQjs2hjc192IYQmqDFLIYzQ7KHjZe15XiqLzXqsUbKhWBbjIgC5ywmtJvBj3l CUYaym3ILjj48AEj6ibI5YxcDgitM/KUgJhNhBsPMclqhUzIxAgHIlQkJB1vQwEIaZoi JZ8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=BgQ9juGMSU4pa0qPQoiNu+HJxrI00HVSUI4zIxZO18E=; b=OLcslOlGImpypzuGduOwwYjUvBLyD59vfzCwclgJvaGL97yu7BTa9iiEQvaWCbgGuq O4dNp49Vvswiv6xQTLzXW/ippGMxaUsDMw/527uP9wvLcbGOhf+QA02bgvSV5KvGolPF 0P2D3h5CVsQQMKCr432xZrX7iNhLS9SS+rM5/o1QzrpX4b2jYUvF0PtToid5+MjNlGmK habaagpMcmPIl6UcuHQLUMR58idVdrI9L7Xo+wK38zBL+4LjgYwwIusdq/cCQo6m2SbC Dse8pmHTvvb+OVnodb7OaGKxUk7T4QGGVYWCVEj+xCctjHQoUU9316v4kDXa9VA8E7CH dTBA== X-Gm-Message-State: ALyK8tIZ+UwcZP8ghG0zLmZhuAwzAgOQ2UXwVMRuJBQWWTRaHxrCCKvihsCKpJLEfzh8rg== X-Received: by 10.28.169.66 with SMTP id s63mr23632929wme.87.1467839186440; Wed, 06 Jul 2016 14:06:26 -0700 (PDT) Received: from [192.168.1.106] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id x83sm10926206wmx.9.2016.07.06.14.06.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 14:06:25 -0700 (PDT) Subject: Re: Statically linking against libpq To: Johnny Yan , "pgsql-odbc@postgresql.org" References: From: Heikki Linnakangas Message-ID: Date: Thu, 7 Jul 2016 00:06:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 07/06/2016 11:01 PM, Johnny Yan wrote: > Hi, > > We're building the postgres odbc driver by ourselves for our > customers on Linux. It builds against hence depends on libpq.so. > We're wondering if there is a secret configure flag to statically > link against libpq such that the final psqlodbcw.so has less > dependencies and in particular doesn't depend on libpq.so. There's no such flag, currently. One option is to create a temporary installation of libpq, with just the static library. The linker will use the static library, if it can't find a shared one. Something along the lines of: mkdir static-libpq mkdir static-libpq/lib ln -s `pg_config --libdir`/libpq.a static-libpq/lib/libpq.a ln -s `pg_config --includedir` static-libpq/include ./configure --with-libpq=static-libpq ... Assuming your libpq is built with OpenSSL, though, you'll also need to pass LDFLAGS="-lssl -lcrypto" to make the configure test pass. The resulting ODBC driver will still need libssl and libcrypto as shared libraries, if built that way. There might be a more straightforward way to do that, with suitable linked flags, but I don't know how. > Also if there is no such config flag yet, are you guys planning to > add one? No such plans. If you want to write a patch, and it's not too complicated, I wouldn't mind adding it, thouhg. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc