使用“ --enable-shared”选项从源代码构建Python的问题

时间:2018-10-16 01:03:38

标签: python build compilation clang

我正在尝试从源代码构建Python作为共享dylib。我得到的结果是这样的:

otool -L ./python2.7.8-clang-800.0.42/lib/python2.7/lib-dynload/_ctypes.so
./python2.7.8-clang-800.0.42/lib/python2.7/lib-dynload/_ctypes.so:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 915.0.0)

但是,我遵循的指南列出了理想的结果:

$ otool -L $HOME/.pyenv/versions/2.7.11/lib/python2.7/lib-dynload/_ctypes.so
/Users/foo/.pyenv/versions/2.7.11/lib/python2.7/lib-dynload/_ctypes.so:
    /Users/foo/.pyenv/versions/2.7.11/lib/libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

路径显然不同,但是,在我的情况下,我根本看不到dylink。我做错了什么?我应该怎么做才能将so文件链接到libpython2.7.dylib库?

我的构建命令是:

./configure --prefix=/Users/me/apps/Darwin64/python2.7.8-clang-800.0.42 \
--enable-shared \
--enable-unicode=ucs2 \
BLDSHARED="clang -bundle -lpython2.7" \
LDCXXSHARED="clang++ -bundle" \
CFLAGS="-arch x86_64" \
LDFLAGS="-arch x86_64" \
LDFLAGS="-L/Users/me/apps/Darwin64/readline6.2-clang-500.2.79"

我正在使用OSX 10.11.6(ElCapitan)。

0 个答案:

没有答案