Vim 未通过 ldd 列出的动态链接依赖项
Vim dynamic linked dependency not listed via ldd
从源代码成功安装vim
$ git clone https://github.com/vim/vim && cd vim
$ ./configure --prefix=/usr/local --enable-gui=no --enable-python3interp=dynamic
$ make CFLAGS='-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1'
$ sudo make install
在python3
中测试插件成功
python3 << EOF
print("Hello, Python3!")
EOF
检查是否python3
动态链接
$ /usr/local/bin/vim --version
+python3/dyna
$ ll -h /usr/local/bin/vim
2.6M
$ ldconfig -p | grep python3
libpython3
$ ldd /usr/local/bin/vim | grep python
(nothing)
应该列出了一些东西 libpython3
,为什么这里什么也没有显示?
当您使用 dynamic
时,库未链接,它在第一次使用时由 vim 二进制文件加载,使用 dlopen()
。来自 :help python-dynamic
:
On MS-Windows and Unix the Python library can be loaded dynamically. The
:version output then includes +python/dyn or +python3/dyn.
This means that Vim will search for the Python DLL or shared library file only
when needed. When you don't use the Python interface you don't need it, thus
you can use Vim without this file.
...
The 'pythondll' or 'pythonthreedll' option can be used to specify the Python
shared library file ...
和:help 'pythonthreedll'
:
Specifies the name of the Python 3 shared library. The default is
DYNAMIC_PYTHON3_DLL, which was specified at compile time.
从源代码成功安装vim
$ git clone https://github.com/vim/vim && cd vim
$ ./configure --prefix=/usr/local --enable-gui=no --enable-python3interp=dynamic
$ make CFLAGS='-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1'
$ sudo make install
在python3
中测试插件成功
python3 << EOF
print("Hello, Python3!")
EOF
检查是否python3
动态链接
$ /usr/local/bin/vim --version
+python3/dyna
$ ll -h /usr/local/bin/vim
2.6M
$ ldconfig -p | grep python3
libpython3
$ ldd /usr/local/bin/vim | grep python
(nothing)
应该列出了一些东西 libpython3
,为什么这里什么也没有显示?
当您使用 dynamic
时,库未链接,它在第一次使用时由 vim 二进制文件加载,使用 dlopen()
。来自 :help python-dynamic
:
On MS-Windows and Unix the Python library can be loaded dynamically. The :version output then includes +python/dyn or +python3/dyn.
This means that Vim will search for the Python DLL or shared library file only when needed. When you don't use the Python interface you don't need it, thus you can use Vim without this file.
...
The 'pythondll' or 'pythonthreedll' option can be used to specify the Python shared library file ...
和:help 'pythonthreedll'
:
Specifies the name of the Python 3 shared library. The default is DYNAMIC_PYTHON3_DLL, which was specified at compile time.