cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Why are builds different?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 21 Nov 2002 08:51:26 +0100 (MET)

On Wed, 20 Nov 2002, Dan Wood wrote:

> I have a backward compatibility problem that I have tracked down to
> differences between the binary libcurl.a that is built. My problem is that
> if I build libcurl on the more recent 10.2 build of Mac OS X, the
> application that it links into fails due to problems linking.
>
> Specifically, these symbols are expected to be found in the Mac's
> runtime libraries when I build under 10.2: _getnameinfo, _strtok_r,
> _localtime_r, _strlcat, and _gmtime_r.

Hm. This looks like weirdness.

The configure script checks for the presence of multiple functions. It should
check for at least strtok_r, localtime_r, strlcat and gmtime_r. It is then of
course only meant to use the functions if the configure actually detected
them, and this is where the weirdness enters.

I can't see why getnameinfo() is used though. libcurl uses getaddrinfo if
built ipv6-enabled, and perhaps that function in itself uses the
getnameinfo...

> When I dump out the contents of libcurl.a (using otool -vI), I find
> references to those symbols in the 10.2-built file. In libcurl.a built
> under 10.1, I either don't find references to those symbols, though I found
> a reference to "_Curl_strtok_r"

Right, that's because it didn't find any strtok_r() function when configure
ran and instead used a replacement function (which curl provides itself to
those systems that don't have it).

> My guess is that 10.2 identifies itself differently than 10.1 when curl is
> configured and make'd, so the code gets compiled differently, referencing
> the above symbols when compiled under 10.2 because they are known to be
> available, and not referencing them when compiled under 10.1 because they
> aren't supplied by the OS in that version.

Ah! Are this the library you build and run fine on a 10.2 system but the
linkage error occurs when you try to run this on a 10.1 system?

> Trouble is, I want to be compatible *at runtime* with the earlier version
> of the OS, which means that I really need to build curl as if those symbols
> weren't provided for me in the OS, so that I can run under both 10.1 and
> 10.2.

Right, you basicly want to copy the lib/config.h file from your 10.1 build
into the 10.2 build and have it built the same way there. It should work.

The problem here is of course that configure runs and sets up things for your
*current* system, not for any system you may want to run the library on.

So, I'd advice you to do this:

On the 10.2 host, run configure as usual (you might wanna disable ipv6
builds). Then edit the lib/config.h to match how it looked on the 10.1-host.
Like you don't have strtok_r etc. Then you save a diff and keep that around
for the next time you feel the need to re-run configure as then you can more
easily apply the changes again with no sweat.

> Any hints? (Other than just requiring me to build under the older OS --
> that's what I'm trying to get around!)

I just hope I've understood your problem properly.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-11-21