Simple question about freeze

M

mrstephengross

I'm working with the freeze utility, and I'm trying to learn the
basics. For the most part, I think I understand how it works. I have a
question about modules, though.

I want to make sure that my native executable is entirely standalone.
That is, it should have no dynamic linking. I've read through a number
of posts on the subject, and think I get it. In order to make this
work, I need to do two things:

(1) Recompile libpythonXXX.a so that the required modules are indeed
compiled into the archive.
(2) Modify the freeze-generated Makefile to force gcc to use static
linking and to use my custom-built libpythonXXX.a in linking together
the native executable.

My question is: is it sufficient to carry out the above steps? Freeze
is designed to use the version of python installed on the host system,
*not* a custom build in a different directory. If freeze looks to the
system's default installation, but I've modified the makefile to use my
custom-built libpython.a, will that cause problems? My sense is that it
will not, but I want to make sure I think things through. Any thoughts?

Thanks,
--Steve ([email protected])
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

mrstephengross said:
I want to make sure that my native executable is entirely standalone.
That is, it should have no dynamic linking. I've read through a number
of posts on the subject, and think I get it. In order to make this
work, I need to do two things:

(1) Recompile libpythonXXX.a so that the required modules are indeed
compiled into the archive.
(2) Modify the freeze-generated Makefile to force gcc to use static
linking and to use my custom-built libpythonXXX.a in linking together
the native executable.

My question is: is it sufficient to carry out the above steps?

No. You also need to provide static versions of all system libraries.
E.g. if you include _tkinter in your binary, you need static Tcl
libraries, plus, on Unix, static X11 libraries, plus a static C
library; if you include a bsddb module, you need a static bsddb library,
and so on.
Freeze
is designed to use the version of python installed on the host system,
*not* a custom build in a different directory. If freeze looks to the
system's default installation, but I've modified the makefile to use my
custom-built libpython.a, will that cause problems? My sense is that it
will not, but I want to make sure I think things through. Any thoughts?

I don't see a problem with that.

Regards,
Martin
 
S

Sybren Stuvel

Martin v. Löwis enlightened us with:
No. You also need to provide static versions of all system
libraries.

You can also ship the required .so files along with the program, and
set LD_LIBRARY_PATH to include the directory in which you stored those
files. This can be easily done by a shell script that sets up the
environment variable and then runs the real program.

Sybren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top