Jeremy Hughes | 16 Aug 2012 17:22
Favicon

One or more libs available at link-time are not available run-time

Hi,

I'm trying to build Libcurl 7.27.0 with SSH support on Mac OS X 10.7.4

I've previously built Libcurl 7.19.4 and 7.21.1 successfully

When I run the following command:

CFLAGS="-arch i386" ./configure --with-libssh2="$LS/Libssh2"

I get the following error:

configure: error: one or more libs available at link-time are not available run-time. Libs used at
link-time: -lssl -lcrypto -lldap -lz -lssh2

If I build without SSH support, I don't get this error.

Does Libcurl 7.27.0 require an extra library in addition to Libssh2, or is there another parameter I should
be passing?

Jeremy
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Daniel Stenberg | 16 Aug 2012 23:38
Picon
Favicon
Gravatar

Re: One or more libs available at link-time are not available run-time

On Thu, 16 Aug 2012, Jeremy Hughes wrote:

> Does Libcurl 7.27.0 require an extra library in addition to Libssh2, or is 
> there another parameter I should be passing?

libssh2 in itself uses other libraries that need to be provided.

But this error occurs when configure found and linked everything fine when it 
tried to actuallt just link stuff but it doesn't work fine to run the results.

It genereally means that you need to make sure your shell/system/loader finds 
the libraries when you run the command using LD_LIBRARY_PATH, /etc/ld.so.conf 
or similar.

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Jeremy Hughes | 17 Aug 2012 12:59
Favicon

Re: One or more libs available at link-time are not available run-time

Daniel Stenberg (16/8/12, 22:38) said:

>> Does Libcurl 7.27.0 require an extra library in addition to Libssh2, or is 
>> there another parameter I should be passing?
>
>libssh2 in itself uses other libraries that need to be provided.

The configure command for libssh2 specifies --with-openssl. This seems to be all that is needed for
building earlier versions of Libcurl with ssh support.

openssl is in /usr/bin/

>But this error occurs when configure found and linked everything fine when it 
>tried to actuallt just link stuff but it doesn't work fine to run the results.

That's more or less what I figured the error message was saying.

>It genereally means that you need to make sure your shell/system/loader finds 
>the libraries when you run the command using LD_LIBRARY_PATH, /etc/ld.so.conf 
>or similar.

I'm afraid I don't understand what this means. LD_LIBRARY_PATH seems to be a Linux environment variable,
and I don't have /etc/ld.so.conf on my machine.

I'm also not sure what you mean by "run the command" - is this the configure command or the application that is
using Libcurl?

What I'm trying to do is to build Libcurl as a static library that can be used by a Mac application. I've
previously built Libcurl 7.21.1 and 7.19.4 without encountering this problem. We're currently using
7.19.4, and I'm trying to update to the most recent version.
(Continue reading)

Dan Fandrich | 17 Aug 2012 21:18
Favicon

Re: One or more libs available at link-time are not available run-time

On Fri, Aug 17, 2012 at 11:59:45AM +0100, Jeremy Hughes wrote:
> Does 7.27.0 require additional libraries that aren't needed by earlier versions?

Yes, it has optional features that can require new dependencies. You
should still be able to disable those features in the configure script
to return to the same feature set as earlier versions, though. Try
running "curl-config --libs" on the installed earlier and newer versions
and compare the results to see if there are new dependencies in your
configuration.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Jeremy Hughes | 20 Aug 2012 14:43
Favicon

Re: One or more libs available at link-time are not available run-time

Hi Dan,

>> Does 7.27.0 require additional libraries that aren't needed by earlier
>>versions?
>
>Yes, it has optional features that can require new dependencies. You
>should still be able to disable those features in the configure script
>to return to the same feature set as earlier versions, though. Try
>running "curl-config --libs" on the installed earlier and newer versions
>and compare the results to see if there are new dependencies in your
>configuration.

The only "installed" version that I have is the version that comes with Mac OS X 10.6.8.

curl-config reports that this is version 7.19.7 and --libs reports -lcurl.

But that doesn't seem to help me much.

What I'm trying to do is to build a static version of Libcurl that has SSH support - the installed version
doesn't support SSH - and which we can then link with our application.

We're currently using 7.19.4, which we built without any problems. I can also build 7.21.1 without
problems. What I can't do is to build the latest version (7.27.0).

Building Libcurl to support SSH involves building openssh2 (./configure --with-openssl). This works fine.

The problem occurs when I try to build Libcurl. 7.19.4 and 7.21.1 build without any problems (./configure --with-libssh2="$LS/Libssh2")

7.27.0 also builds OK if I omit --with-libssh2, but it fails at the configure stage if I try to build with
libssh2. The error says:
(Continue reading)

Nick Zitzmann | 20 Aug 2012 17:43

Re: One or more libs available at link-time are not available run-time


On Aug 20, 2012, at 6:43 AM, Jeremy Hughes <jeremy <at> softpress.com> wrote:

> Is there a way of discovering the actual names of the libraries that are referred to in the error message?
E.g. -lssl is presumably /usr/bin/openssl.

-lssl refers to /usr/lib/libssl.dylib. /usr/bin/openssl is an executable file, not a library.

> Has anyone successfully built 7.27.0 with SSH support on a Mac system?

I have...

Nick Zitzmann
<http://www.chronosnet.com/>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Jeremy Hughes | 20 Aug 2012 18:33
Favicon

Re: One or more libs available at link-time are not available run-time

Hi Nick,

>On Aug 20, 2012, at 6:43 AM, Jeremy Hughes <jeremy <at> softpress.com> wrote:
>
>> Is there a way of discovering the actual names of the libraries that
>>are referred to in the error message? E.g. -lssl is presumably /usr/bin/
>>openssl.
>
>-lssl refers to /usr/lib/libssl.dylib. /usr/bin/openssl is an executable
>file, not a library.

OK - thanks for that.

In that case the other libraries that are referred to in the error message are presumably

/usr/lib/libcrypto.dylib
/usr/lib/libldap.dylib
/usr/lib/libz.dylib

>> Has anyone successfully built 7.27.0 with SSH support on a Mac system?
>
>I have...

I wonder what I'm doing differently that is causing a problem.

== 1. Build openssh2 (using: ./configure --with-openssl) ==

I don't have any problems here. The latest version of openssh2 seems to be 1.4.2.

== 2. Build libcurl (using ./configure --with-libssh2=[Libssh2 directory] ==
(Continue reading)

Nick Zitzmann | 20 Aug 2012 19:42

Re: One or more libs available at link-time are not available run-time


On Aug 20, 2012, at 10:33 AM, Jeremy Hughes <jeremy <at> softpress.com> wrote:

>> -lssl refers to /usr/lib/libssl.dylib. /usr/bin/openssl is an executable
>> file, not a library.
> 
> OK - thanks for that.
> 
> In that case the other libraries that are referred to in the error message are presumably
> 
> /usr/lib/libcrypto.dylib
> /usr/lib/libldap.dylib
> /usr/lib/libz.dylib

<PLUG>If you're building 7.27, then unless your application depends on an OpenSSL-specific feature, you
are welcome to try out the native SSL option by configuring libcurl --with-darwinssl.</PLUG>

> Are you using a different set of configure options?

No. Are you installing libssh2 after building it? If not, then you'll probably need to adjust the header &
library search paths in your CFLAGS and LDFLAGS environmental variables. You may also need to adjust
LD_LIBRARY_PATH as someone else suggested; the man page to dlopen() suggests that the variable works on
OS X as well as on GNU/Linux.

Nick Zitzmann
<http://www.chronosnet.com/>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
(Continue reading)

Jeremy Hughes | 20 Aug 2012 20:17
Favicon

Re: One or more libs available at link-time are not available run-time

Hi Nick,

><PLUG>If you're building 7.27, then unless your application depends on
>an OpenSSL-specific feature, you are welcome to try out the native SSL
>option by configuring libcurl --with-darwinssl.</PLUG>

I thought from a previous discussion on this list that darwinssl doesn't support ssh. Jonas Schnelli
(23/7/12, 21:38) listed one of the cons as "no SFTP (libssh) support without openssl"

The reason we're building with libssh2 is that we want to support SFTP.

>> Are you using a different set of configure options?
>
>No. Are you installing libssh2 after building it?

We're not installing it. I thought the --with-libssh2=[directory] option was supposed to allow libcurl
to be built with a static library of libssh2?

This used to work, as I've said, but it stopped working sometime between 7.21.1 and 7.27.0.

I'm slightly puzzled by your question about installing libssh2, because we're developing an application
that doesn't require users to have libssh2 installed on their machines. Maybe you're suggesting that it
helps to have it installed on development machines? 

>If not, then you'll
>probably need to adjust the header & library search paths in your CFLAGS
>and LDFLAGS environmental variables. You may also need to adjust
>LD_LIBRARY_PATH as someone else suggested; the man page to dlopen()
>suggests that the variable works on OS X as well as on GNU/Linux.

(Continue reading)

Nick Zitzmann | 20 Aug 2012 21:25

Re: One or more libs available at link-time are not available run-time


On Aug 20, 2012, at 12:17 PM, Jeremy Hughes <jeremy <at> softpress.com> wrote:

> I thought from a previous discussion on this list that darwinssl doesn't support ssh. Jonas Schnelli
(23/7/12, 21:38) listed one of the cons as "no SFTP (libssh) support without openssl"
> 
> The reason we're building with libssh2 is that we want to support SFTP.

You don't need to use the same crypto library for libssh2 as you are using in libcurl. So darwinssl doesn't
cancel out support for SSH; it just doesn't completely replace OpenSSL if you want SSH because Apple's
crypto libraries are missing a few features that are present in libcrypto. I was porting libssh2 to
Apple's crypto libraries, but got stuck on Apple's lack of a bignum replacement for cryptography.

>>> Are you using a different set of configure options?
>> 
>> No. Are you installing libssh2 after building it?
> 
> We're not installing it. I thought the --with-libssh2=[directory] option was supposed to allow libcurl
to be built with a static library of libssh2?

I thought the =directory option was there if you had it installed in a place other than /usr or /usr/local.

> This used to work, as I've said, but it stopped working sometime between 7.21.1 and 7.27.0.
> 
> I'm slightly puzzled by your question about installing libssh2, because we're developing an
application that doesn't require users to have libssh2 installed on their machines. Maybe you're
suggesting that it helps to have it installed on development machines? 

Yes. We use libssh2 and libcurl in our products, and I solved this problem by building both libraries as
static libraries only using the configure option --disable-shared, and only "installing" libssh2 so I
(Continue reading)

Jeremy Hughes | 22 Aug 2012 16:06
Favicon

Re: One or more libs available at link-time are not available run-time

Hi Nick,

>On Aug 20, 2012, at 12:17 PM, Jeremy Hughes <jeremy <at> softpress.com> wrote:
>
>> I thought from a previous discussion on this list that darwinssl
>>doesn't support ssh. Jonas Schnelli (23/7/12, 21:38) listed one of the
>>cons as "no SFTP (libssh) support without openssl"
>> 
>> The reason we're building with libssh2 is that we want to support SFTP.
>
>You don't need to use the same crypto library for libssh2 as you are
>using in libcurl. So darwinssl doesn't cancel out support for SSH; it
>just doesn't completely replace OpenSSL if you want SSH because Apple's
>crypto libraries are missing a few features that are present in
>libcrypto. I was porting libssh2 to Apple's crypto libraries, but got
>stuck on Apple's lack of a bignum replacement for cryptography.

Just to make sure I understand this...

I think what you're suggesting is:

1. Build libssh2 using "./configure --with-openssl"
2. Build libcurl using "./configure --with-libssh2=[directory] --with-darwinssl"

Doing this presumably gives the benefits provided by darwinssl but also keeps support for SSH and SFTP.

If Apple drop openssl from future Mac OSes, we could keep SFTP by building openssl separately.

Jeremy

(Continue reading)

Nick Zitzmann | 22 Aug 2012 17:47

Re: One or more libs available at link-time are not available run-time


On Aug 22, 2012, at 8:06 AM, Jeremy Hughes <jeremy <at> softpress.com> wrote:

> Just to make sure I understand this...
> 
> I think what you're suggesting is:
> 
> 1. Build libssh2 using "./configure --with-openssl"
> 2. Build libcurl using "./configure --with-libssh2=[directory] --with-darwinssl"
> 
> Doing this presumably gives the benefits provided by darwinssl but also keeps support for SSH and SFTP.
> 
> If Apple drop openssl from future Mac OSes, we could keep SFTP by building openssl separately.

That's correct.

Nick Zitzmann
<http://www.chronosnet.com/>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Daniel Stenberg | 21 Aug 2012 00:32
Picon
Favicon
Gravatar

Re: One or more libs available at link-time are not available run-time

On Mon, 20 Aug 2012, Jeremy Hughes wrote:

> We're not installing it. I thought the --with-libssh2=[directory] option was 
> supposed to allow libcurl to be built with a static library of libssh2?

It works, I do it all the time.

But:

  1 - you need to specify the "prefix" directory, not the full dir since it
      needs to find both the $prefix/lib and $prefix/include and the relevant
      files in there (and there is no $prefix/lib directory in a regular
      libssh2 dev tree, I have a lib -> src/.libs symlink for that).

  2 - you need to manually provide the extra libs you need for the dependencies
      to configure (or make)

> This used to work, as I've said, but it stopped working sometime between 
> 7.21.1 and 7.27.0.

AFAIK, it has worked the same way basically forever and I've linked it like 
that regularly since the day we added ssh support.

--

-- 

  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

(Continue reading)

Jeremy Hughes | 22 Aug 2012 15:53
Favicon

Re: One or more libs available at link-time are not available run-time

Hi Daniel,

>  1 - you need to specify the "prefix" directory, not the full dir since it
>      needs to find both the $prefix/lib and $prefix/include and the relevant
>      files in there (and there is no $prefix/lib directory in a regular
>      libssh2 dev tree, I have a lib -> src/.libs symlink for that).

That's more or less what I'm doing, except that I'm copying the include and .libs folders into the "prefix"
directory, as follows:

cp -r include/ ../include
cp src/.libs/libssh2.a ../libs

The one significant difference that I noticed is that your symlink is called "lib" and not "libs".

After renaming my "libs" folder to "lib", everything works again!

I don't know why (or when) this changed between 7.21.0 and 7.27.0.

Thanks for helping!

Jeremy

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Gmane