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

huangapple go评论62阅读模式
英文:

pecl install pdo_sqlsrv MAKE fails on DDEV using Debian 11 - missing libltdl.la

问题

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

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

最后,bash脚本运行pecl install 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 install能够完成,生成的pdo_sqlsrv扩展编译得很好,并且按预期加载。
然而,为什么缺少这个.la文件以及如何“正确”确保其安装仍然是我希望理解答案的一个谜团。

如果有人能提供洞察或复制这个问题,我将非常感激,希望能够使这更具自包含性,而不是依赖于从本地系统复制文件。谢谢。

英文:

I have a project that is using DDEV to run an instance with PHP 8.1.
I needed to introduce the pdo_sqlsrv extension to the package, so I added a Dockerfile in the .ddev/web-build/ directory that installs the required packages, and copies a bash-script that is then run with sudo to install the remaining dependencies.

The bash script grabs the microsoft gpg key, pulls the apt source list from packages.microsoft.com/config/$OS/$VERSION/prod.list (Where OS and Version are variables that equate to debian and 11) then it proceeds to install msodbcsql17, unixodbc and unixodbc-dev

Lastly, the bash script runs the pecl install pdo_sqlsrv command.

Everything works as expected, except the build of pdo_sqlsrv fails due to a missing file /usr/lib/x86_64-linux-gnu/libltdl.la
I have searched everything I could find, and am unable to understand why this libltdl.la file is missing. I verified the libltdl-dev (2.4.6-15) package is installed. It has the other expected files like libltdl.a and libltdl.so, etc - just not the .la file.

In a desperate attempt to get this working to prevent stalling my project development, I simply copied the libltdl.la file from my local WSL2 Ubuntu 20.04 system into my .ddev/web-build/ directory, and added the following command to my Dockerfile:
COPY libltdl.la /usr/lib/x86_64-linux-gnu/

This "solves" the problem, allowing the pecl install to complete, and the resulting pdo_sqlsrv extension is compiled properly and loads as expected.
However, the mystery of why this .la file is missing, and how to "properly" ensure it's installed, is still a question I wish I could understand the answer to.

If anyone is able to provide insight or replicate this, I'd greatly appreciate an understanding to make this more of a self-contained solution rather than relying on a copy of a file from my local system.

Thank you.

答案1

得分: 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

英文:

I was just trying to solve this myself. Finally found https://github.com/microsoft/msphpsql/issues/1436#issuecomment-1428075290

The answer was to do an apt-get install odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc-dev=2.3.7 unixodbc=2.3.7 because the 2.3.11 version is apparently bugged and missing a header file. I just added those packages to the same install call where I installed msodbcsql18 while following this documentation 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

My final command before the pecl installs looked like this:
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

答案2

得分: 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 - 一个libtool库文件

由libtool(GNU libtool)2.4.2 Debian-2.4.2-1.11+b1生成

请不要删除这个文件!

这对于链接库是必要的。

我们可以通过dlopen(3)打开的名称。

dlname='libltdl.so.7'

这个库的名称。

library_names='libltdl.so.7.3.0 libltdl.so.7 libltdl.so'

静态存档的名称。

old_library='libltdl.a'

不能放入dependency_libs的链接器标志。

inherited_linker_flags=''

该库依赖的库。

dependency_libs=' -ldl'

该库提供的附加弱库的名称

weak_library_names=''

libltdl的版本信息。

current=10
age=3
revision=0

这是一个已安装的库吗?

installed=yes

当链接到模块时,我们是否应该警告可移植性?

shouldnotlink=no

要打开/dlpreopen的文件

dlopen=''
dlpreopen=''

此库需要安装的目录:

libdir='/usr/lib/x86_64-linux-gnu'

英文:

Thank you, Your solution helped me jump out of hell

Your guys can copy contain of libltdl.la from there. 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'

huangapple
  • 本文由 发表于 2023年3月4日 03:48:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75631319.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定