Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install sqlsrv and pdo_srv in whm server 108.0.11 using ubuntu 20.04 #1436

Open
Helwieahmad opened this issue Feb 13, 2023 · 43 comments

Comments

@Helwieahmad
Copy link

Helwieahmad commented Feb 13, 2023

after i update my ubuntu server, the sqlsrv and pdo_srv driver is missing in my whm. i try to install again with following this tutorial https://support.cpanel.net/hc/en-us/articles/360053132353-How-install-pdo-sqlsrv-to-connect-to-MSSQL-Servers?source=search&auth_token=eyJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50X2lkIjo5Mjc3OTc5LCJ1c2VyX2lkIjozODkxNDE4NDkyNTQsInRpY2tldF9pZCI6OTQ1MzEzNzQsImNoYW5uZWxfaWQiOjYzLCJ0eXBlIjoiU0VBUkNIIiwiZXhwIjoxNjc4ODUwOTYwfQ.EaB854qW1DgMkz4DaoTjyjaeLkNWJy0PlNJzNUemfTw and got error like i attach below:

root@newcpanel:~# /usr/bin/ea-php74-pecl install sqlsrv
downloading sqlsrv-5.10.1.tgz ...
Starting to download sqlsrv-5.10.1.tgz (193,661 bytes)
.........................................done: 193,661 bytes
34 source files, building
running: phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
building in /root/tmp/pear/pear-build-root0kcMPS/sqlsrv-5.10.1
running: /root/tmp/pear/sqlsrv/configure --with-php-config=/opt/cpanel/ea-php74/root/usr/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /opt/cpanel/ea-php74/root/usr
checking for PHP includes... -I/opt/cpanel/ea-php74/root/usr/include/php -I/opt/cpanel/ea-php74/root/usr/include/php/main -I/opt/cpanel/ea-php74/root/usr/include/php/TSRM -I/opt/cpanel/ea-php74/root/usr/include/php/Zend -I/opt/cpanel/ea-php74/root/usr/include/php/ext -I/opt/cpanel/ea-php74/root/usr/include/php/ext/date/lib
checking for PHP extension directory... /opt/cpanel/ea-php74/root/usr/lib64/php/modules
checking for PHP installed headers prefix... /opt/cpanel/ea-php74/root/usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking whether to enable sqlsrv functions... yes, shared
checking for SQLSRV headers... /root/tmp/pear/sqlsrv/shared/
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /root/tmp/pear/pear-build-root0kcMPS/sqlsrv-5.10.1/libtool --mode=compile g++ -std=c++11 -I. -I/root/tmp/pear/sqlsrv -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-root0kcMPS/sqlsrv-5.10.1/include -I/root/tmp/pear/pear-build-root0kcMPS/sqlsrv-5.10.1/main -I/root/tmp/pear/sqlsrv -I/opt/cpanel/ea-php74/root/usr/include/php -I/opt/cpanel/ea-php74/root/usr/include/php/main -I/opt/cpanel/ea-php74/root/usr/include/php/TSRM -I/opt/cpanel/ea-php74/root/usr/include/php/Zend -I/opt/cpanel/ea-php74/root/usr/include/php/ext -I/opt/cpanel/ea-php74/root/usr/include/php/ext/date/lib -I/root/tmp/pear/sqlsrv/shared/  -DHAVE_CONFIG_H  -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector   -c /root/tmp/pear/sqlsrv/conn.cpp -o conn.lo
libtool: compile:  g++ -std=c++11 -I. -I/root/tmp/pear/sqlsrv -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-root0kcMPS/sqlsrv-5.10.1/include -I/root/tmp/pear/pear-build-root0kcMPS/sqlsrv-5.10.1/main -I/root/tmp/pear/sqlsrv -I/opt/cpanel/ea-php74/root/usr/include/php -I/opt/cpanel/ea-php74/root/usr/include/php/main -I/opt/cpanel/ea-php74/root/usr/include/php/TSRM -I/opt/cpanel/ea-php74/root/usr/include/php/Zend -I/opt/cpanel/ea-php74/root/usr/include/php/ext -I/opt/cpanel/ea-php74/root/usr/include/php/ext/date/lib -I/root/tmp/pear/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /root/tmp/pear/sqlsrv/conn.cpp  -fPIC -DPIC -o .libs/conn.o
In file included from /usr/include/sql.h:19,
                 from /root/tmp/pear/sqlsrv/shared/xplat.h:30,
                 from /root/tmp/pear/sqlsrv/shared/typedefs_for_linux.h:23,
                 from /root/tmp/pear/sqlsrv/shared/xplat_winnls.h:24,
                 from /root/tmp/pear/sqlsrv/shared/FormattedPrint.h:24,
                 from /root/tmp/pear/sqlsrv/shared/core_sqlsrv.h:41,
                 from /root/tmp/pear/sqlsrv/php_sqlsrv_int.h:25,
                 from /root/tmp/pear/sqlsrv/conn.cpp:24:
/usr/include/sqltypes.h:56:10: fatal error: unixodbc.h: No such file or directory
   56 | #include "unixodbc.h"
      |          ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:192: conn.lo] Error 1
ERROR: `make' failed

for addtional information:

unixodbc-dev version 5.10.1
ODBC Driver 17 for SQL Server
ODBC Driver 18 for SQL Server
ubuntu server version 20.04
whm server version 108.0.11 and
my sql server version 2016

anybody can help me

thanks in advanced

@websmurf
Copy link

websmurf commented Feb 13, 2023

Same issue here, our builds builds fail since today when trying to release a new product version:

# install and setup custom extensions
RUN apt-get -qq -y update \
  && apt-get --no-install-recommends -qq -y install apt-transport-https \
  # mssql odbc driver
  && rm /etc/apt/trusted.gpg \
  && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
  && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
  && apt-get -qq -y update \
  && ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev unixodbc \
  # install and enable extensions
  && pecl install pdo_sqlsrv-5.10.1 \
  && docker-php-ext-enable pdo_sqlsrv

Result + error:

... snip ...
#0 66.15 (cached) (cached) checking how to hardcode library paths into programs... immediate
#0 69.04 configure: patching config.h.in
#0 69.09 configure: creating ./config.status
#0 69.83 config.status: creating config.h
#0 70.19 running: make
#0 70.24 /bin/bash /tmp/pear/temp/pear-build-defaultuserYGg4zV/pdo_sqlsrv-5.10.1/libtool --mode=compile g++ -I. -I/tmp/pear/temp/pdo_sqlsrv -I/tmp/pear/temp/pear-build-defaultuserYGg4zV/pdo_sqlsrv-5.10.1/include -I/tmp/pear/temp/pear-build-defaultuserYGg4zV/pdo_sqlsrv-5.10.1/main -I/tmp/pear/temp/pdo_sqlsrv -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/pdo_sqlsrv/shared/  -DHAVE_CONFIG_H  -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector   -I/usr/local/include/php/ext -std=c++11 -c /tmp/pear/temp/pdo_sqlsrv/pdo_dbh.cpp -o pdo_dbh.lo
#0 71.42 mkdir .libs
#0 71.45  g++ -I. -I/tmp/pear/temp/pdo_sqlsrv -I/tmp/pear/temp/pear-build-defaultuserYGg4zV/pdo_sqlsrv-5.10.1/include -I/tmp/pear/temp/pear-build-defaultuserYGg4zV/pdo_sqlsrv-5.10.1/main -I/tmp/pear/temp/pdo_sqlsrv -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/pdo_sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -I/usr/local/include/php/ext -std=c++11 -c /tmp/pear/temp/pdo_sqlsrv/pdo_dbh.cpp  -fPIC -DPIC -o .libs/pdo_dbh.o
#0 71.89 In file included from /usr/include/sql.h:19,
#0 71.89                  from /tmp/pear/temp/pdo_sqlsrv/shared/xplat.h:30,
#0 71.89                  from /tmp/pear/temp/pdo_sqlsrv/shared/typedefs_for_linux.h:23,
#0 71.89                  from /tmp/pear/temp/pdo_sqlsrv/shared/xplat_winnls.h:24,
#0 71.89                  from /tmp/pear/temp/pdo_sqlsrv/shared/FormattedPrint.h:24,
#0 71.89                  from /tmp/pear/temp/pdo_sqlsrv/shared/core_sqlsrv.h:41,
#0 71.89                  from /tmp/pear/temp/pdo_sqlsrv/php_pdo_sqlsrv_int.h:23,
#0 71.89                  from /tmp/pear/temp/pdo_sqlsrv/pdo_dbh.cpp:24:
#0 71.89 /usr/include/sqltypes.h:56:10: fatal error: unixodbc.h: No such file or directory
#0 71.89    56 | #include "unixodbc.h"
#0 71.89       |          ^~~~~~~~~~~~
#0 71.89 compilation terminated.
#0 71.91 make: *** [Makefile:209: pdo_dbh.lo] Error 1
#0 71.92 ERROR: `make' failed

Most likely it's related to this update:
image

@elavrom
Copy link

elavrom commented Feb 13, 2023

Same issue here.

If using Buster, reverting to https://packages.microsoft.com/config/debian/9/prod.list instead of https://packages.microsoft.com/config/debian/10/prod.list works tho.

@pontus-mp
Copy link

One workaround is to install version 2.3.7 of the relevant packages. Something like this:

ACCEPT_EULA=Y apt-get install -y
        odbcinst=2.3.7 \
        odbcinst1debian2=2.3.7 \
        unixodbc=2.3.7 \
        unixodbc-dev=2.3.7 \
         --no-install-recommends

@websmurf
Copy link

@pontus-mp thanks, can confirm this works

Update RUN command:

# install and setup custom extensions
RUN apt-get -qq -y update \
  && apt-get --no-install-recommends -qq -y install apt-transport-https \
  # mssql odbc driver
  && rm /etc/apt/trusted.gpg \
  && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
  && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
  && apt-get -qq -y update \
  && ACCEPT_EULA=Y apt-get install -y msodbcsql17 odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc-dev=2.3.7 unixodbc=2.3.7 \
  # install and enable extensions
  && pecl install pdo_sqlsrv-5.10.1 \
  && docker-php-ext-enable pdo_sqlsrv

@ShNURoK42
Copy link

@pontus-mp thanks, release the versions helped me.

@steve962
Copy link

steve962 commented Feb 16, 2023

Can also confirm that explicitly installing 2.3.7 works. I did some research and finally realized it's a problem with the microsoft repositories that are needed for the msodbcsql prerequisite -- they have an old version of the unixodbc-dev package version 2.3.11 which was missing the unixodbc.h file. Debian fixed this with package build 2.3.11-2 last May, but a number of the Microsoft debian and ubuntu repositories look like they're still using the original 2.3.11 package.

I'm not exactly sure how to report this upstream to the msodbcsql team, so I came here to see, and found this bug report.

FYI, I was building this in a docker image based on Ubuntu focal (20.04).

@andremartinez
Copy link

I'd like to thank both @pontus-mp and @websmurf for the workaround

I can confirm it work for the msodbcsql18 drivers for ubuntu 20.04.

Although the error I'm getting is a little different, these seem to be related

#0 14.69 libtool: link: warning: library `/usr/lib/x86_64-linux-gnu/libodbc.la' was moved.
#0 14.69 grep: /usr/lib/x86_64-linux-gnu/libltdl.la: No such file or directory
#0 14.69 /bin/sed: can't read /usr/lib/x86_64-linux-gnu/libltdl.la: No such file or directory
#0 14.69 libtool: link: `/usr/lib/x86_64-linux-gnu/libltdl.la' is not a valid libtool archive
#0 14.69 make: *** [Makefile:251: sqlsrv.la] Error 1
#0 14.69 ERROR: `make' failed
------
Dockerfile:28
--------------------
  26 |     # Required extensions
  27 |     RUN docker-php-ext-install pdo intl gd mbstring zip
  28 | >>> RUN pecl install sqlsrv
  29 |     RUN pecl install pdo_sqlsrv
  30 |     RUN docker-php-ext-enable sqlsrv pdo_sqlsrv
--------------------
ERROR: failed to solve: process "/bin/sh -c pecl install sqlsrv" did not complete successfully: exit code: 1
ERROR: Service 'server' failed to build : Build failed
make: *** [Makefile:3: build] Error 1

@delboy1978uk
Copy link

Thanks @websmurf, your RUN command fixed my issue (although I had to remove && rm /etc/apt/trusted.gpg \ for it to work.

fox91 added a commit to fox91/docker-php-extensions that referenced this issue Apr 12, 2023
@ftoledo
Copy link

ftoledo commented Jul 5, 2023

I don't use on docker but i can confirm that working on debian 11 with the downgrade of unixodbc workaround

@mbomb007
Copy link

mbomb007 commented Jul 18, 2023

I have this issue, too. Came here from microsoft/linux-package-repositories#39

@v-makouz
Copy link
Contributor

@mbomb007 This issue was caused by a unixODBC being packaged with the ODBC driver. I believe it has been removed from the package, but can you tell me which OS and what exact commands you use, so I can to track it down?

@fcorrigabb
Copy link

fcorrigabb commented Jul 19, 2023

@v-makouz look at this comment: microsoft/linux-package-repositories#39 (comment)

EDIT: It happens on Ubuntu 20.x thru 22.x and Debian 10/11

@mbomb007
Copy link

mbomb007 commented Jul 19, 2023

@v-makouz Debian and Ubuntu with the code here: https://stackoverflow.com/a/58086934

It fails on Debian 11. To fix the issue, I have to replace this:

apt-get install -y unixodbc-dev

with this:

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

@v-makouz
Copy link
Contributor

There is an incorrect dependency when building the new unixODBC 2.3.11, there are people working on it. I'll let you know when the fix is in.

@taozuhong
Copy link

taozuhong commented Aug 18, 2023

SQLServer could provide a C library that could be used by C/C++/PHP/ODBC/Ruby/Nodejs/JDBC?

ODBC is not friendly for App, can't package it directly, and it's huge.

@hazman96
Copy link

Hi All,

  1. I was following this guide https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver16&tabs=ubuntu2204 to install mssql in my linux mint 21.1 cinnamon os

  2. I managed to complete the installation of the sql server but failed to install the sql server command line tools when, i try to run this command inside terminal

sudo apt-get update sudo apt-get install mssql-tools18 unixodbc-dev

and after running the above command inside terminal, i received error below

Errors were encountered while processing:
/tmp/apt-dpkg-install-Y37HBJ/04-libodbc1_2.3.11-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

May I know what does this mean and is there any workaround on this? Really appreciate everyone guidance..

PS: I am new to linux and trying to improve my sql skills by using mssql in Linux.

@v-makouz
Copy link
Contributor

This error seems to be caused by a package that got into a bad state. I'm not familiar with this issue myself, but here's what others who encountered it have said: https://unix.stackexchange.com/questions/688261/please-help-sub-process-usr-bin-dpkg-returned-an-error-code-1-installing-mys

@reinierpost
Copy link

reinierpost commented Sep 11, 2023

I'm having the same issue today on Ubuntu 22.04 after upgrading from 20.04; sqlsrv-5.10.1 had already been installed.

sudo pecl install pdo_sqlsrv  # tries to install pdo_sqlsrv-5.11.1
# fails with message: libtool: link: `/usr/lib/x86_64-linux-gnu/libltdl.la' is not a valid libtool archive
sudo pecl install pdo_sqlsrv-5.10.1  # a no-op
sudo pecl uninstall pdo_sqlsrv-5.10.1  # works
sudo pecl install pdo_sqlsrv-5.10.1  # fails with the same message as above
sudo apt -y --allow-downgrades msodbcsql17 odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc-dev=2.3.7 unixodbc=2.3.7 
# as indicated above
sudo pecl install pdo_sqlsrv  # works now
sudo apt-mark hold odbcinst odbcinst1debian2 unixodbc unixodbc-dev
# to keep unattended-upgrades from upgrading them

@v-chojas
Copy link

The "is not a valid libtool" error should now be solved for Debian 11 amd64, with unixodbc 2.3.11-2.

We were unable to reproduce this issue on other versions of Debian and Ubuntu.

@johnandersen777
Copy link

This worked for me:

for package_name in $(sudo ls /var/lib/dpkg/info | grep -i odbc); do sudo mv -v /var/lib/dpkg/info/$package_name /tmp/; done
sudo apt --fix-broken install -y
sudo apt-get -y autoremove
sudo apt-get update
ACCEPT_EULA=Y sudo -E apt-get install --reinstall -y msodbcsql18

@MonsterITServices
Copy link

Nothing worked for me Ubuntu 22.04 still missing pdo_sqlsrv and sqlsrv wont install.

@v-makouz
Copy link
Contributor

v-makouz commented Apr 9, 2024

Are there error messages? Which specific part of the install fails?

@AvelPostol
Copy link

У меня ничего не получилось. В Ubuntu 22.04 по-прежнему отсутствует pdo_sqlsrv, а sqlsrv не устанавливается.

на этот момент времени все так же для Ubuntu 22.04 ошибка остается ( PHP Startup: Unable to load dynamic library 'pdo_sqlsrv').

@fcorrigabb
Copy link

Still broken on both Debian and Ubuntu

@AvelPostol
Copy link

что насчет Centos7? работает?

@fcorrigabb
Copy link

Didn't try on CentOS. The problem was always reported on Debian and Ubuntu

@mbomb007
Copy link

CentOS 7 reached end of life already. https://www.redhat.com/en/topics/linux/centos-linux-eol

@v-makouz
Copy link
Contributor

Is this an installation error? Or does the install finish with no issues, but the library can't be imported when running the PHP script?

@AvelPostol
Copy link

AvelPostol commented Jul 18, 2024 via email

@v-makouz
Copy link
Contributor

If you set error_reporting = E_ALL, display_errors = On, and display_startup_errors = On in php.ini, it should show where it's looking for the libraries it's attempting to load, which might give a clue as to why it doesn't load

@fcorrigabb
Copy link

adding E_ALL to error_reporting is useless. the package does not install because of broken dependencies.

@v-makouz
Copy link
Contributor

v-makouz commented Aug 6, 2024

@fcorrigabb Oh that was in response to AvelPostol, who seems to have a different problem where the driver installs fine, but import doesn't work.

In any case, are you using the docker? How are you installing the driver?

@joelharkes
Copy link

joelharkes commented Aug 9, 2024

We had added this specifically to our docker image to make it work both for amd64 and arm architecture:

# Can be removed when depdency issue is fixed: https://github.com/microsoft/msphpsql/issues/1436
# amd64 has a depedency issue, but installing this on ARM will fail
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then  \
     apt-get install -y --allow-downgrades  \
        odbcinst=2.3.7  \
        odbcinst1debian2=2.3.7  \
        unixodbc=2.3.7  \
        unixodbc-dev=2.3.7  \
    ; fi

kudos to teammate of mine.

@joelharkes
Copy link

joelharkes commented Aug 9, 2024

@v-makouz is it solved now? i see no reference to any issue elsewhere where i can find if this got solved or not?

I do see https://www.unixodbc.org/ released a new version .12 but unsure this is solved?

@fcorrigabb
Copy link

fcorrigabb commented Aug 9, 2024

As of yesterday, it was not yet resolved.

Step 27/57 : RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools
 ---> Running in e78412022b01
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 odbcinst : Depends: odbcinst1debian2 (>= 2.3.11-1) but 2.3.6-0.1+b1 is to be installed
 unixodbc : Depends: odbcinst1debian2 (>= 2.3.11-1) but 2.3.6-0.1+b1 is to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools' returned a non-zero code: 100

P.S. it's not just on Ubuntu 20.04. The error above is on Debian 12. Dependencies are just broken.
P.P.S i held no packages.

@delboy1978uk
Copy link

This worked for me last year, try this:

RUN apt-get -qq -y update \
  && apt-get --no-install-recommends -qq -y install apt-transport-https \
  && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
  && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \
  && apt-get -qq -y update \
  && ACCEPT_EULA=Y apt-get install -y msodbcsql17 odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc-dev=2.3.7 unixodbc=2.3.7 \
  && pecl install pdo_sqlsrv-5.10.1 \
  && docker-php-ext-enable pdo_sqlsrv

@fcorrigabb
Copy link

fcorrigabb commented Aug 9, 2024

@delboy1978uk is there a reason why you had to force several packages at version 2.3.7 when the required version is >= 2.3.11?
also, why pdo_sqlsrv-5.10.1 ?

EDIT: the fact you need to force the installation of specific dependencies versions is the proof dependencies are broken.

@v-makouz
Copy link
Contributor

v-makouz commented Aug 9, 2024

@fcorrigabb It looks like you're getting the error installing ODBC Driver 17 and the mssql-tools. I tried installing them on clean VMs with Ubuntu 20.04 and Debian 12, and both worked without issue.
(Though I did notice the install instructions for Driver 17 are missing this line: curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg)

I suspect the docker pulls something from a different repo (there was a bug a while ago, where docker used a minimal distro of an OS, which didn't have some of the usual packages, so it had an error that didn't occur otherwise)

@fcorrigabb
Copy link

fcorrigabb commented Aug 12, 2024

@v-makouz i already included that line in my install scripts. I'll check back later this week and let you know if something has changed.
I'm using a customized docker image.

@fcorrigabb
Copy link

fcorrigabb commented Sep 2, 2024

The problem is still there. unixodbc-dev from the MS repo is either version 2.3.7 or 2.3.11.
Even using ubuntu 22.04 repo on debian 11, msodbcsql18 and/or mssql-tools18 require(s) unixodbc-dev version =2.3.6-0.1+b1
Dependencies are still broken

@fcorrigabb
Copy link

Tried with debian 10 and IT WORKS with unixodbc-dev 2.3.11.

@fcorrigabb
Copy link

I think i fixed the problem with debian 11. I managed to build the image with unixodbc 2.3.11 and msodbcsql and mssql-tools ver,. 18.
if it works correctly, i'll be back with the solution

@fcorrigabb
Copy link

fcorrigabb commented Sep 9, 2024

For whatever reason, on Debian 11, if i install unixodbc-dev from the Debian repo BEFORE adding the Microsoft external repo, everything seems to work and unixodbc-dev gets also updated.
On Debian 9 I need to install the multiarch-support package from the Ubuntu repo (for example: http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.5_amd64.deb ) before installing packages from the the Microsoft repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests