user9147574
user9147574

Reputation: 113

pecl install pdo_sqlsrv MAKE fails on DDEV using Debian 11 - missing libltdl.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.

Upvotes: 5

Views: 3140

Answers (3)

user3461820
user3461820

Reputation: 1

Thanks Lampros, i only have to create the file with that content in ubuntu 22 and follow the instructions of 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'

Upvotes: 0

Tim H.
Tim H.

Reputation: 61

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

Upvotes: 6

Trần Anh Vũ
Trần Anh Vũ

Reputation: 114

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'

Upvotes: 4

Related Questions