Msphpsql: AWS Linux unixODBC dependency

Created on 8 Aug 2017  路  16Comments  路  Source: microsoft/msphpsql

I'm trying to install this on an AWS Linux instance and I'm running into a dependency issue and just want to know if this is right.

When I try to install msodbcsql and mssql-tools I get the following:

Error: Package: msodbcsql-13.1.9.0-1.x86_64 (packages-microsoft-com-prod)
           Requires: unixODBC >= 2.3.1
           Available: unixODBC-2.2.14-14.7.amzn1.i686 (amzn-main)
               unixODBC = 2.2.14-14.7.amzn1

However I noticed that the Microsoft repo includes unixODBC-utf16 which is version 2.3.1. I also tried installing this prior to the others. No luck.

Is unixODBC-utf16 2.3.1 not a valid package to satisfy the dependency?

Here is the output of yum delpist msodbcsql

  dependency: /bin/sh
   provider: bash.x86_64 4.2.46-20.36.amzn1
  dependency: e2fsprogs
   provider: e2fsprogs.x86_64 1.42.12-4.40.amzn1
  dependency: glibc
   provider: glibc.x86_64 2.17-157.170.amzn1
   provider: glibc.i686 2.17-157.170.amzn1
  dependency: krb5-libs
   provider: krb5-libs.x86_64 1.14.1-27.41.amzn1
   provider: krb5-libs.i686 1.14.1-27.41.amzn1
  dependency: libc.so.6(GLIBC_2.14)(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libcrypto.so.10()(64bit)
   provider: openssl.x86_64 1:1.0.1k-15.99.amzn1
  dependency: libcrypto.so.10(OPENSSL_1.0.1)(64bit)
   provider: openssl.x86_64 1:1.0.1k-15.99.amzn1
  dependency: libcrypto.so.10(libcrypto.so.10)(64bit)
   provider: openssl.x86_64 1:1.0.1k-15.99.amzn1
  dependency: libcurl.so.4()(64bit)
   provider: libcurl.x86_64 7.51.0-6.74.amzn1
  dependency: libdl.so.2()(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libdl.so.2(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libgcc_s.so.1()(64bit)
   provider: libgcc48.x86_64 4.8.3-9.111.amzn1
   provider: libgcc44.x86_64 4.4.6-4.81.amzn1
  dependency: libgcc_s.so.1(GCC_3.0)(64bit)
   provider: libgcc48.x86_64 4.8.3-9.111.amzn1
   provider: libgcc44.x86_64 4.4.6-4.81.amzn1
  dependency: libgssapi_krb5.so.2()(64bit)
   provider: krb5-libs.x86_64 1.14.1-27.41.amzn1
  dependency: libgssapi_krb5.so.2(gssapi_krb5_2_MIT)(64bit)
   provider: krb5-libs.x86_64 1.14.1-27.41.amzn1
  dependency: libkrb5.so.3()(64bit)
   provider: krb5-libs.x86_64 1.14.1-27.41.amzn1
  dependency: libkrb5.so.3(krb5_3_MIT)(64bit)
   provider: krb5-libs.x86_64 1.14.1-27.41.amzn1
  dependency: libm.so.6()(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libm.so.6(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libodbcinst.so.2()(64bit)
   provider: unixODBC-utf16.x86_64 2.3.1-1
   provider: unixODBC.x86_64 2.2.14-14.7.amzn1
  dependency: libpthread.so.0()(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libpthread.so.0(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libpthread.so.0(GLIBC_2.3.2)(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: librt.so.1()(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: librt.so.1(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.17-157.170.amzn1
  dependency: libssl.so.10()(64bit)
   provider: openssl.x86_64 1:1.0.1k-15.99.amzn1
  dependency: libssl.so.10(libssl.so.10)(64bit)
   provider: openssl.x86_64 1:1.0.1k-15.99.amzn1
  dependency: libstdc++.so.6()(64bit)
   provider: libstdc++48.x86_64 4.8.3-9.111.amzn1
   provider: libstdc++44.x86_64 4.4.6-4.81.amzn1
  dependency: libstdc++.so.6(CXXABI_1.3)(64bit)
   provider: libstdc++48.x86_64 4.8.3-9.111.amzn1
   provider: libstdc++44.x86_64 4.4.6-4.81.amzn1
  dependency: libstdc++.so.6(CXXABI_1.3.3)(64bit)
   provider: libstdc++48.x86_64 4.8.3-9.111.amzn1
   provider: libstdc++44.x86_64 4.4.6-4.81.amzn1
  dependency: libstdc++.so.6(GLIBCXX_3.4)(64bit)
   provider: libstdc++48.x86_64 4.8.3-9.111.amzn1
   provider: libstdc++44.x86_64 4.4.6-4.81.amzn1
  dependency: libstdc++.so.6(GLIBCXX_3.4.11)(64bit)
   provider: libstdc++48.x86_64 4.8.3-9.111.amzn1
   provider: libstdc++44.x86_64 4.4.6-4.81.amzn1
  dependency: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
   provider: libstdc++48.x86_64 4.8.3-9.111.amzn1
  dependency: libstdc++.so.6(GLIBCXX_3.4.19)(64bit)
   provider: libstdc++48.x86_64 4.8.3-9.111.amzn1
  dependency: libuuid.so.1()(64bit)
   provider: libuuid.x86_64 2.23.2-33.28.amzn1
  dependency: libuuid.so.1(UUID_1.0)(64bit)
   provider: libuuid.x86_64 2.23.2-33.28.amzn1
  dependency: openssl
   provider: openssl.x86_64 1:1.0.1k-15.99.amzn1
   provider: openssl.i686 1:1.0.1k-15.99.amzn1
  dependency: rtld(GNU_HASH)
   provider: glibc.x86_64 2.17-157.170.amzn1
   provider: glibc.i686 2.17-157.170.amzn1
  dependency: unixODBC >= 2.3.1
   Unsatisfied dependency
Linux question

Most helpful comment

Found a resolution to this by disabling the Amazon repos:

sudo ACCEPT_EULA=Y yum install mssql-tools unixODBC-devel -y --disablerepo=amzn*

All 16 comments

I ran deplist on an older version, sudo yum deplist msodbcsql-13.1.1.0-1

This does not require unixODBC but instead lists unixODBC-utf16

newer version of ODBC won't work with unixODBC-utf16. I am trying to get an instance and repo your issue. Meanwhile can you try to build unixODBC 2.3.4 ? Here are the steps:

mkdir /tmp/msodbcrhel
sudo wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.4.tar.gz -P /tmp/msodbcrhel/
sudo tar -xzf /tmp/msodbcrhel/unixODBC-2.3.4.tar.gz
if [ -d "usr/lib64/libodbc*" ]; then
    echo "exists"
    sudo rm /usr/lib64/libodbc*
fi

cd /tmp/msodbcrhel/
sudo tar -xzf unixODBC-2.3.4.tar.gz
cd /tmp/msodbcrhel/unixODBC-2.3.4

sudo -i export CPPFLAGS="-DSIZEOF_LONG_INT=8"

./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --disable-gui --disable-drivers --enable-iconv > odbc_con.log 2> make_err.log

sudo make 1> make_std.log 2> make_err.log ; 

 sudo make install 1> makeinstall_std.log 2> makeinstall_err.log ; 

cd /usr/lib64
sudo ln -s libodbccr.so.2   libodbccr.so.1
sudo ln -s libodbcinst.so.2 libodbcinst.so.1
sudo ln -s libodbc.so.2     libodbc.so.1

Let me know how it goes

@sean256 Have you had a chance to build unixODBC?

@Hadis-Fard We changed our approach and instead of using EB's out of date AMI we built our own platform on top of Ubuntu 16.04, which is working great. Maybe this should be closed now?

@sean256 thanks for update

I ran into the same issue, I succeded building unixODBC but I still get the message:

Error: Package: msodbcsql-13.1.9.1-1.x86_64 (packages-microsoft-com-prod)
Requires: unixODBC >= 2.3.1
Available: unixODBC-2.2.14-14.7.amzn1.i686 (amzn-main)
unixODBC = 2.2.14-14.7.amzn1

After running
sudo ACCEPT_EULA=Y yum install msodbcsql mssql-tools

@hugoromo We found Amazon Linux to be such a pain and not worth the effort. I don't know what they have going with it, but it seems like its based on CentOS 5 with some libraries updated.

I keep hoping to get this problem solved, so I had made a request on the Amazon Linux forums at https://forums.aws.amazon.com/thread.jspa?threadID=261972&tstart=25 and while it didn't make it into 2017.09 AMI, I would love for it to be in 2018.03 or some other one.

2017.09's update actually enabled HTTP2 within Apache, which should have been available much earlier, so I'll remain skeptical they'll update unixODBC.

Until then, stuck on PHP 5.6 and mssql due to not wanting to completely rewrite the code and the lack of an actual working mssql_num_rows variant in PDO (the PDO variant doesn't return the number of rows a SELECT statement has... which was a core logic component of the software). I'm not sure if sqlsrv will do it, but it's my last hope...

I managed to install unixOBDC 3.2.4 from an RPM of this site https://github.com/EreMaijala/unixODBC

For the help of others trying to solve this problem, I have gotten this working with the Amazon Linux AMI, in the context of elastic beanstalk. The full configuration script I use is HERE.

To anyone finding this thread and wondering why none of this is working with PHP 7.2 or any other future release, here's the updated config file (named .ebextensions/pdo_sqlsrv.config or something similar).

commands:
  010_qlsrv_pdo:
    command: |

      # 0. EXIT if pdo_sqlsrv is already installed
      if php -m | grep -q 'pdo_sqlsrv'; then echo 'hi'; fi;

      # 1. Register the Microsoft Linux repository
      curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/mssql-tools.repo;

      # 2. Install the newer unixODBC for MSSQL
      sudo yum install http://mirror.centos.org/centos/7/os/x86_64/Packages/unixODBC-2.3.1-11.el7.x86_64.rpm;
      sudo yum install http://mirror.centos.org/centos/7/os/x86_64/Packages/unixODBC-devel-2.3.1-11.el7.x86_64.rpm;

      # 3. Install MSSQL and tools
      sudo ACCEPT_EULA=Y yum install msodbcsql17 mssql-tools;

      # 4. Update the PEAR Archive_Tar package and update PEAR itself
      sudo curl https://raw.githubusercontent.com/pear/Archive_Tar/1.4.3/Archive/Tar.php > `pear config-get php_dir`/Archive/Tar.php;
      sudo pear upgrade -f Archive_Tar; # Don't forget to actually update it

      # 5. Install SQLSRV and its PDO extension and configure it correctly
      sudo pear config-set php_ini ''; # Disable PECL's php.ini update
      sudo pecl7 install sqlsrv pdo_sqlsrv;
      sudo chmod 0755 `pear config-get ext_dir`/sqlsrv.so; # Fix perms
      sudo chmod 0755 `pear config-get ext_dir`/pdo_sqlsrv.so; # Fix perms
      echo "extension=sqlsrv.so" | sudo tee /etc/php.d/sqlsrv.ini;
      echo "extension=pdo_sqlsrv.so" | sudo tee /etc/php.d/pdo_sqlsrv.ini;
      sudo pear config-set php_ini /etc/php.ini; # Reenable PECL's php.ini update

      # 6. Restart Apache to enable
      sudo service httpd restart;

FYI - I also found that cleaning the yum cache helped solve the problem:

$ yum clean all

Found a resolution to this by disabling the Amazon repos:

sudo ACCEPT_EULA=Y yum install mssql-tools unixODBC-devel -y --disablerepo=amzn*

heres a snippet from my docker file that shows how to install on amazon linux:

RUN curl http://mirror.centos.org/centos/7/os/x86_64/Packages/unixODBC-2.3.1-14.el7.x86_64.rpm > /tmp/unixODBC-2.3.1-14.el7.x86_64.rpm
RUN yum -y install /tmp/unixODBC-2.3.1-14.el7.x86_64.rpm 
RUN curl http://mirror.centos.org/centos/7/os/x86_64/Packages/unixODBC-devel-2.3.1-14.el7.x86_64.rpm > /tmp/unixODBC-devel-2.3.1-14.el7.x86_64.rpm 
RUN yum -y install /tmp/unixODBC-devel-2.3.1-14.el7.x86_64.rpm 

RUN curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
RUN ACCEPT_EULA=Y yum -y install msodbcsql17

bonus if you want pyodbc:

RUN yum -y install gcc72-c++ \ && yum -y install python36-devel \ && yum -y install zip \ && yum clean all RUN python3.6 -m pip install --upgrade pip RUN python3.6 -m pip install pyodbc

solved it with the next script:

export ACCEPT_EULA=Y
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/mssql-tools.repo
yum remove -y unixODBC unixODBC-devel unixODBC-utf16 unixODBC-utf16-devel
yum install -y http://mirror.centos.org/centos-7/7/os/x86_64/Packages/unixODBC-2.3.1-14.el7.x86_64.rpm
yum install -y http://mirror.centos.org/centos-7/7/os/x86_64/Packages/unixODBC-devel-2.3.1-14.el7.x86_64.rpm
yum install -y msodbcsql17 mssql-tools

Was this page helpful?
0 / 5 - 0 ratings