Getting expat compiled properly

Magnus Lie Hetland mlh at
Wed Sep 5 12:54:17 CEST 2001

"Mats Wichmann" <mats at> wrote in message
news:3b95f5d8.112439689 at
> :The problem is that I'm not an administrator at this machine, so
> :it would be a bit awkward... I guess I could take the #!/usr/bin/env
> :trick to new heights, but...
> You're limited to one argument...

I assume that's some strange restriction imposed by using env in the
hash-bang context? I see that it doesn't work -- although it works in
other contexts, e.g:

$ env foobar=1 python -c 'import os; print os.getenv("foobar")'

> This is a little tricky, yes.  You're trying to enable software where
> you can't control the entire execution context.

Right. Usually it's no problem, and I guess it wouldn't have been if
expat hadn't been compiled elsewhere.


> You problem is the link editor (ld) is finding a dynamic libexpat, but
> the dynamic linker is not.

Right. I guess I should hide the dynamic lib from ld, right?

> Since you don't appear to be able to
> control the environment in which the dynamic linker runs, you have to
> have a discussion with the link editor :-) ... linking in the static
> libexapt should resolve the problem.

Yeah... Again, the way to do this will be to remove the location of
the dynamic one from LD_LIBRARY_PATH while compiling, right?

> As a hack:
> build Python, capturing the output. grab the link-edit line, put it in
> a script by itself, and modify where it says "-lexpat" replacing that
> one argument word with the path to the static expat library.

Hm. OK, I'll try.

> If that works you can work on tweaking the Python build.  Not knowing
> which compiler you're using


> I can't give you exact syntax, but there's
> a way to temporarily turn off the search for a dynamic library,

Ah. That sounds useful.

> so
> that your command line will (conceptually) look like this:
> ......  -StopLookingForDynamicLibs -lexpat -StartLookingForDynamicLibs
> .....


> e.g., just for expat, search only for a static copy, then go back to
> looking for dynamic in preferece to static.

OK. Thanks for the help.

> Mats Wichmann


  Magnus Lie Hetland

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick

More information about the Python-list mailing list