4

Python 3.3インタープリターをMac OS 10.9 Cocoa アプリに埋め込んで、いくつかの Python 機能を追加したいと考えています。別の StackOverflow Q&A から読んだことから、動的ライブラリよりも静的ライブラリ (フッターの参照) を作成するのが最善でしょう。

Python インタープリターから静的ライブラリ (.a ファイル) を作成しようとしたのは次のとおりです。

  1. ここから Python 3.3 (CPython) ソース コードをダウンロードしました。
  2. ファイル*static*内に追加しましたModules/Setup.dist
  3. ターミナルでソースをコンパイルするために、次のように入力しました。
    • ./configure LDFLAGS="-static -static-libgcc" CPPFLAGS="-static"

私が得る結果は次のとおりです。

checking build system type... x86_64-apple-darwin13.1.0
checking host system type... x86_64-apple-darwin13.1.0
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking for --without-gcc... no
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Path/To/My/Source/Python-3.3.4':
configure: error: C compiler cannot create executables
See `config.log' for more details

私の理解では、gcc は実際には Mavericks の Apple LLVM バージョン 5.0 (clang-500.2.79) (LLVM 3.3svn に基づく) に置き換えられています。

また、config.logに以下を見つけました...

configure:3914: checking whether the C compiler works
configure:3936: clang  -static  conftest.c  >&5
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

質問: Apple LLVMを使用して Python 3.3 をコンパイルし、 libpython3.3.aなどのスタティック ライブラリですか?


4

2 に答える 2