pecl install pdo_sqlsrv MAKE 在使用 Debian 11 的 DDEV 上失败 - 缺少 libltdl.la

问题描述 投票:0回答:3

我有一个项目正在使用 DDEV 来运行 PHP 8.1 的实例。 我需要向包中引入 pdo_sqlsrv 扩展,因此我在 .ddev/web-build/ 目录中添加了一个 Dockerfile,用于安装所需的包,并复制一个 bash 脚本,然后使用 sudo 运行该脚本来安装剩余的依赖项。

bash 脚本获取 microsoft gpg 密钥,从packages.microsoft.com/config/$OS/$VERSION/prod.list 中提取 apt 源列表(其中 OS 和 Version 是相当于 debian 和 11 的变量),然后继续安装 msodbcsql17、unixodbc 和 unixodbc-dev

最后,bash 脚本运行 pecl install pdo_sqlsrv 命令。

一切都按预期工作,除了 pdo_sqlsrv 的构建由于缺少文件 /usr/lib/x86_64-linux-gnu/libltdl.la 而失败 我已经搜索了我能找到的所有内容,但无法理解为什么缺少这个 libltdl.la 文件。我验证了 libltdl-dev (2.4.6-15) 软件包已安装。它有其他预期的文件,如 libltdl.a 和 libltdl.so 等 - 只是不是 .la 文件。

为了防止项目开发陷入停滞,我拼命地尝试将 libltdl.la 文件从本地 WSL2 Ubuntu 20.04 系统复制到我的 .ddev/web-build/ 目录中,并将以下命令添加到我的 Dockerfile 中:

COPY libltdl.la /usr/lib/x86_64-linux-gnu/

这“解决”了问题,允许完成 pecl 安装,并且生成的 pdo_sqlsrv 扩展已正确编译并按预期加载。 然而,为什么这个 .la 文件丢失,以及如何“正确”确保它安装,仍然是一个我希望我能理解答案的问题。

如果有人能够提供见解或复制此内容,我将非常感谢您的理解,使其成为一个独立的解决方案,而不是依赖于本地系统中的文件副本。

谢谢你。

debian ddev php-8.1 bullseye
3个回答
6
投票

我只是想自己解决这个问题。终于找到了https://github.com/microsoft/msphpsql/issues/1436#issuecomment-1428075290

答案是做一个

apt-get install odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc-dev=2.3.7 unixodbc=2.3.7
,因为 2.3.11 版本显然有错误并且缺少头文件。我刚刚将这些软件包添加到安装 msodbcsql18 的同一安装调用中,同时遵循本文档 https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc -driver-for-sql-server?view=sql-server-2017&tabs=debian18-install%2Calpine17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline

在安装 pecl 之前我的最终命令如下所示:

ACCEPT_EULA=Y apt-get install -y --allow-downgrades msodbcsql18 odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc-dev=2.3.7 unixodbc=2.3.7


3
投票

谢谢你,你的解决方案帮助我摆脱了地狱

你们可以从那里复制 libltdl.la 的内容。 https://www.apt-browse.org/browse/debian/jessie/main/amd64/libltdl-dev/2.4.2-1.11+b1/file/usr/lib/x86_64-linux-gnu/libltdl.la

# libltdl.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1.11+b1
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libltdl.so.7'

# Names of this library.
library_names='libltdl.so.7.3.0 libltdl.so.7 libltdl.so'

# The name of the static archive.
old_library='libltdl.a'

# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''

# Libraries that this one depends upon.
dependency_libs=' -ldl'

# Names of additional weak libraries provided by this library
weak_library_names=''

# Version information for libltdl.
current=10
age=3
revision=0

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/lib/x86_64-linux-gnu'

0
投票

谢谢 Lampros,我只需在 ubuntu 22 中创建包含该内容的文件并按照 Microsoft 的说明进行操作即可。

# libltdl.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libltdl.so.7'

# Names of this library.
library_names='libltdl.so.7.3.0 libltdl.so.7 libltdl.so'

# The name of the static archive.
old_library='libltdl.a'

# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''

# Libraries that this one depends upon.
dependency_libs=' -ldl'

# Names of additional weak libraries provided by this library
weak_library_names=''

# Version information for libltdl.
current=10
age=3
revision=0

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/lib/x86_64-linux-gnu'
© www.soinside.com 2019 - 2024. All rights reserved.