Static python compile on windows.

G

Grzegorz Dostatni

Cheers.
First what I am trying to do:
I am trying to create a version of pytho23.dll that contains everything
inside of it. It is staticaly linked. It also needs to contain the qt
library. For this I am trying to work off of instructions designed for
unix/linux using visual c++.net and gui.

I can compile basic python - that's not a problem. Once I add the paths
and dependencies for qt (as well as modifying the config.c) I get an
error:

LINK : fatal error LNK1181: cannot open input file '.\python23.lib'

Problem is I don't know where/when this gets created. python23.dll is
created as a result of pythoncore project. The python23.dll depends on
python23.lib. The only thing that gets build before pythoncore is the
make_versioninfo. I dug through the logs and was unable to determine where
python23.lib gets created. And how. If I can see why it is not created I
should be able to fix the problem.

Alternatively, did anyone figure out how to statically compile qt into
python? I can do the dynamic compile, but I need static for program
deployment.

Tired, exhausted and frustrated.
Greg



"When ideas fail, words come in very handy."
- Goethe (1749-1832)
 
?

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

Grzegorz said:
I can compile basic python - that's not a problem. Once I add the paths
and dependencies for qt (as well as modifying the config.c) I get an
error:

LINK : fatal error LNK1181: cannot open input file '.\python23.lib'

I don't understand. If you want to make Python and all of the modules
static (i.e. a single executable), then you should build qt *inside*
pcbuild. Then, there is no need to link qt with python23.lib at all.
Problem is I don't know where/when this gets created. python23.dll is
created as a result of pythoncore project. The python23.dll depends on
python23.lib.

That is not true, atleast not in the distribtion of Python shipped from
python.org. In what way have you modified the existing projects?

The python23.dll is completely independent from python23.lib: you don't
need python23.lib to run Python. The project generating python23.lib
is the same as the one generating python23.dll, namely pythoncore.
> The only thing that gets build before pythoncore is the
make_versioninfo. I dug through the logs and was unable to determine where
python23.lib gets created. And how. If I can see why it is not created I
should be able to fix the problem.

It is generated as a a result (as a side effect) of linking
python23.dll. It is called an "import library".
Alternatively, did anyone figure out how to statically compile qt into
python? I can do the dynamic compile, but I need static for program
deployment.

You should build as many static libraries as you need, e.g.
python23s.lib, qtXYs.lib, and so on. Static libraries don't depend
on each other, so you can build them independent from one another.
You should then link them all together, either linking them into
python.exe or pythonw.exe.

Regards,
Martin
 
T

Thomas Heller

Martin v. Löwis said:
You should build as many static libraries as you need, e.g.
python23s.lib, qtXYs.lib, and so on. Static libraries don't depend
on each other, so you can build them independent from one another.
You should then link them all together, either linking them into
python.exe or pythonw.exe.

Please let me join this thread with a related question.
I've added a project to the MSVC6 workspace for Python 2.3, which
basically does this. It seems required to define the
Py_NO_ENABLE_SHARED preprocessor flag when compiling this.

Now I have a ~900 kB static python.exe. How can I prevent that this exe
tries to import extension modules from the file system - it always
crashes with a Fatal Python error: Interpreter not initialized (because
it tries to load the normal python23.dll which I have also installed)?

Thomas
 
?

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

Thomas said:
Now I have a ~900 kB static python.exe. How can I prevent that this exe
tries to import extension modules from the file system - it always
crashes with a Fatal Python error: Interpreter not initialized (because
it tries to load the normal python23.dll which I have also installed)?

See my comments to python-dev. The easiest way, as you explain, is to
disable dynamic loading in the first place. Alternatively, make sure
that the PE module it tries to load is the same as the one implementing
dynamic loading.

Regards,
Martin
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top