orlp
orlp

Reputation: 117681

Cython static link with python runtime?

I have a Python script for python 2.7, say this:

print("Hello World!")

Next I turn this into C using:

python cython.py --embed helloworld.py

And then I try to compile it statically:

gcc -IC:\Python27\include -LC:\Python27\libs helloworld.c -Wl,-Bstatic -lpython27
  -Wl,-Bdynamic

But gcc just creates a binary that uses the python27.dll runtime. How can I create a binary that statically links to the runtime?

Upvotes: 8

Views: 2628

Answers (1)

gabomdq
gabomdq

Reputation: 1750

If you are working from Linux or OS X, you can use my engine's builder tool, Schafer, which has a "bare" mode which will just build Python statically (for all supported platforms, including Windows), along with several standard modules, and it will also "cythonize" and embed your sources into it as well. If this doesn't fit your bill, you still can get ideas from the source on what it takes to do what you want to accomplish.

Upvotes: 2

Related Questions