Static Linking...

Chris Barker - NOAA Federal <[email protected]>
Newsgroups gmane.comp.python.apple
Message-ID <CALGmxEJqXboXqxHpeDz3kctEXaa8n2oXJLgkswOtVudhrHKF4g@mail.gmail.com>
As a side note to the main thread about dependencies:

How can  I static link?

I"ve struggled for literally years to get gcc to statically link, but
it tries really hard to dynamically link instead. I have written way
too many scripts that move or re-name dynamic libs temporarily while
building, then put them back after.

Then a colleague of mine showed me the really neat trick -- pass the
paths to the libs themselves through to gcc with "extra_objects"
keyword in the Extension object, like so:

extra_objects = ["libhdf5.a", "libhdf5_hl.a", "libnetcdf.a"]

extensions = [Extension("netCDF4",
                        sources,
                        libraries=libs,
                        include_dirs=inc_dirs,
                        extra_objects=extra_objects,
                        )]

very nifty -- works like a charm.

However, when I do this, I had to re-write part of the setup.py --
actually, making it far more simple -- in this case, there was a lot
of machinations finding the libs...

But Ideally, I"d ;like to build a semi-arbitrary extension with static
linking while using the existing setup.py. Is there a way to
minkey-path the setup, so I can use the existing one, but re-shuffle
it some in place before the actual build occurs?

-Chris




-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
Pythonmac-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.