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

3

5

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.

Rosio answered 3/3, 2023 at 19:48 Comment(3)
Are you using the technique from github.com/ddev/ddev-contrib/tree/master/… ?Nuremberg
That's essentially the same, except a bit more is run in the bash script, but the same packages are being installed except for php8.1 rather than php8.0 Also following the details from here: learn.microsoft.com/en-us/sql/connect/php/…Rosio
Please see if you have the problem using the ddev_contrib recipe, thanks! If you do, an issue there would be good. Really if people are using it we need to turn it into a DDEV add-on.Nuremberg
W
6

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

Worm answered 1/6, 2023 at 21:40 Comment(2)
I adapted your solution for my need but it worked correctlyRutherford
thank you! This solution worked for me too on Debian 11 (bullseye).Hebraist
P
4

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'
Pusey answered 7/3, 2023 at 17:54 Comment(3)
This doesn't explain how to solve the problem described in the question. Could you please edit to provide a complete Dockerfile that does it, and explain how it differs from the ddev-contrib recipe?Nuremberg
just put the file contents in /usr/lib/x86_64-linux-gnu/libltdl.laJoses
Same issue here, at Ubuntu 22.04, make was failing due to an issue with libtools. Actually the libltdl.la file was completly missing. I have created it at and copied it's content from here . Thanks guys you really saved my day with your hints!Burgoyne
B
0

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'
Blear answered 15/5 at 18:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.