Subject: Re: [libssh2] [PATCH] Building static lib on x86_64 linux

Re: [libssh2] [PATCH] Building static lib on x86_64 linux

From: Simon Josefsson <>
Date: Thu, 29 Mar 2007 14:22:31 +0200

"Yang Tse" <> writes:

> When static libraries are built for AMD64 linux they _must_ be
> compiled using PIC, otherwise linkage will fail.
> The attached patch is the same solution I've contributed to libcurl,
> and which has proven to be efective.
> The 'trick' is to set to 'yes' variable 'with_pic' for x86_64 linux

I believe this is the wrong solution -- you shouldn't be mixing static
libraries (non-PIC) with shared libraries (PIC). Either use the
shared PIC library of libssh2, or build libssh2 using './configure

If we install this, it will make all x86_64 libssh2.a files be
compiled with PIC information, which is unnecessary and will slow
things down.

If you strongly need static PIC libraries, I suggest creating
'libssh2_pic.a' which would be a static library compiled with
PIC-information. I've seen this approach being used in Debian, and it
seems to be a better solution.


Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
libssh2-devel mailing list
Received on 2007-03-29