msphpsql icon indicating copy to clipboard operation
msphpsql copied to clipboard

aws | Debian 10/11 [hvm] (64-bit aarch64/Arm) | Unknown processor architecture

Open MwSpaceLLC opened this issue 4 years ago • 11 comments

Hi there, we have a cloud project arm64/aarch64 based

We can't use x86 arch. We must use new arm. we tried this script to force install correctly driver for arm, but php return "Unknown processor architecture."

the script:

    sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    sudo printf "deb [arch=arm64,amd64] https://packages.microsoft.com/debian/10/prod buster main" | sudo tee /etc/apt/sources.list.d/mssql-release.list

    sudo apt update -y && sudo apt upgrade -y
    sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17

    # optional: for bcp and sqlcmd
    sudo ACCEPT_EULA=Y apt-get install -y mssql-tools
    echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
    source ~/.bashrc

    # optional: for unixODBC development headers
    sudo apt-get install -y unixodbc-dev

    # optional: kerberos library for debian-slim distributions
    sudo apt-get install -y libgssapi-krb5-2

    # install php 8 ext
    sudo pecl config-set php_ini /etc/php/8.0/fpm/php.ini
    sudo pecl install sqlsrv
    sudo pecl install pdo_sqlsrv

    sudo printf "; priority=20\nextension=sqlsrv.so\n" | sudo tee /etc/php/8.0/mods-available/sqlsrv.ini
    sudo printf "; priority=30\nextension=pdo_sqlsrv.so\n" | sudo tee /etc/php/8.0/mods-available/pdo_sqlsrv.ini

    sudo phpenmod -v 8.0 sqlsrv pdo_sqlsrv

php try script:

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$serverName = "serverName\\sqlexpress"; //serverName\instanceName

// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"dbName");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>

MwSpaceLLC avatar Sep 03 '21 16:09 MwSpaceLLC

So we try to install in Debian 11, we can't see repo in guide, but in repo.list we can find:

#Debian 11
curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list

# in source file
deb [arch=amd64,armhf,arm64] https://packages.microsoft.com/debian/11/prod bullseye main

So, important to know processor type to test => aarch64 on aws instances

MwSpaceLLC avatar Sep 04 '21 15:09 MwSpaceLLC

Not work on new installation, see below:

lsb_release -a

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

uname -mrs

Linux 5.10.0-8-cloud-arm64 aarch64

lscpu

Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          2
On-line CPU(s) list:             0,1
Thread(s) per core:              1
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       ARM
Model:                           1
Model name:                      Neoverse-N1
Stepping:                        r3p1
BogoMIPS:                        243.75
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        2 MiB
L3 cache:                        32 MiB
NUMA node0 CPU(s):               0,1
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:        Mitigation; __user pointer sanitization
Vulnerability Spectre v2:        Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs

MwSpaceLLC avatar Sep 04 '21 15:09 MwSpaceLLC

** x86_64 Work Perfectly**, see below:

lsb_release -a

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

uname -mrs

Linux 4.19.0-17-cloud-amd64 x86_64

lscpu

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
Address sizes:       46 bits physical, 48 bits virtual
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  2
Core(s) per socket:  1
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
Stepping:            7
CPU MHz:             2499.998
BogoMIPS:            4999.99
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            36608K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke

MwSpaceLLC avatar Sep 04 '21 16:09 MwSpaceLLC

hi @MwSpaceLLC we do not support Linux non-x86 platforms.

yitam avatar Sep 07 '21 14:09 yitam

Thanks @yitam for your response, I wanted to know if you have a future release plan as we are building an arm64 cloud and have recently released the Apple M1 update.

MwSpaceLLC avatar Sep 07 '21 18:09 MwSpaceLLC

Hi @MwSpaceLLC, the latest release of Microsoft ODBC Driver 17.8 now supports Apple M1, but the demand for Linux non-x86 platform is not high as of today.

yitam avatar Sep 07 '21 23:09 yitam

Thanks @yitam, I fully understand that without a high demand Microsoft cannot release a version for arm64, but I wanted to inform you that this platform is in use right now throughout the Amazon cloud.

So any person could choose this type of machine, your driver will not work.

Linux machines on the arm64 processor go considerably faster, like the M1 processor, because they are technologies (deriving from mobile) made especially for multitasking, so inevitably sooner or later users will start installing their web platforms on arm64. Our little Cloud will exclusively have the arm64e M1 processor.

So we will have a problem for all versions of Linux our customers will not be able to install Microsoft SQL Driver. (https://weeblify.com/en)

Having said that in our installations we have told users that the driver does not work and they will be sent on this page to request support. (see installation sh: https://bash.weeblify.net/hosting)

MwSpaceLLC avatar Sep 07 '21 23:09 MwSpaceLLC

Thanks @MwSpaceLLC for the info. I will mark this as a feature request for the management's awareness.

yitam avatar Sep 07 '21 23:09 yitam

Thanks @MwSpaceLLC for the info. I will mark this as a feature request for the management's awareness.

AWS supports and recommends arm64, this is a blocking issue for us to move to arm64 ec2 instance

faizanakram99 avatar Dec 27 '21 14:12 faizanakram99

Can we +1 this somewhere?

ps-mattstuart avatar Jun 09 '22 02:06 ps-mattstuart

Hi @MwSpaceLLC, the latest release of Microsoft ODBC Driver 17.8 now supports Apple M1, but the demand for Linux non-x86 platform is not high as of today.

I'd like to run php code with sqlsrv driver on my arm64 machines... so my +1 Linux on arm64 platform is very high demanded! Maybe Linux on arm64 platform as server runing php workload is what is not high demanded ... till now! So, please, take the arm64 platform into account Thank you very much in advance

marcos-guerrero avatar Sep 19 '22 13:09 marcos-guerrero

Has anyone tried the latest driver from 9/2022 ? https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15

My docker is based on Alpine Linux in a M1 mac, still get error: "Fatal error: Uncaught PDOException: SQLSTATE[01000]: [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.1.so.1.1' : file not found in /app/config/bootstrap.php:45"

Then i run "ldd /opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.1.so.1.1", a lot of errors starting with Error relocating libmsodbcsql-18.1.so.1.1: unsupported relocation type 7 Error relocating libmsodbcsql-18.1.so.1.1: unsupported relocation type 7 Error relocating libmsodbcsql-18.1.so.1.1: unsupported relocation type 6 Error relocating libmsodbcsql-18.1.so.1.1: unsupported relocation type 1

ningji avatar Oct 12 '22 22:10 ningji

ODBC Driver does not currently support Alpine ARM (https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/system-requirements?view=sql-server-ver16).

For PHP Driver code to support Linux ARM has been added, but haven't been tested yet.

v-makouz avatar Oct 17 '22 23:10 v-makouz

ODBC Driver does not currently support Alpine ARM (https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/system-requirements?view=sql-server-ver16).

For PHP Driver code to support Linux ARM has been added, but haven't been tested yet.

@v-makouz For PHP Driver for ARM, do we have a rough timeline when it can be tested and released to public ?

ningji avatar Oct 19 '22 14:10 ningji

So I can see that Arm support is out The ARM64 architecture on Red Hat 8, 9, Debian 11, and Ubuntu 20.04, 22.04 are supported starting with version 18.1.

But wouldn't it be realistic to get the .so file built for Alpine as well? Where does one push to get this done?

danijelk avatar Feb 24 '23 10:02 danijelk

But wouldn't it be realistic to get the .so file built for Alpine as well? Where does one push to get this done?

@danijelk

Sure. It's not that it's impossible. We just have to prioritize resources. Adding new platforms for testing/validation comes with one-time and ongoing maintenance costs. Debian, Ubuntu, and RH have large user bases. Alpine ARM64 support is already in the MS ODBC Driver backlog, but it doesn't have a timeline. I hear your vote for Alpine, though, and it's noted.

Regards, David

David-Engel avatar Feb 28 '23 23:02 David-Engel

Thanks for quick reply @David-Engel at least I know I'm at the right place. If there is anything we/my team/ can do to help in any way open-source wise and maintaining the builds let us know.

danijelk avatar Mar 01 '23 09:03 danijelk

So I can see that Arm support is out The ARM64 architecture on Red Hat 8, 9, Debian 11, and Ubuntu 20.04, 22.04 are supported starting with version 18.1.

But wouldn't it be realistic to get the .so file built for Alpine as well? Where does one push to get this done?

Thanks for mentioning this. I came across this post trying to get mssql support for php on arm64 ubuntu 20.04 and because of your post I looked up 18.1 and it does include arm64 support. I found it here https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=ubuntu18-install%2Calpine17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline

I followed the steps for ubuntu, but they also have some instructions for Alpine and debian

acalcutt avatar Mar 20 '23 22:03 acalcutt

So I can see that Arm support is out The ARM64 architecture on Red Hat 8, 9, Debian 11, and Ubuntu 20.04, 22.04 are supported starting with version 18.1. But wouldn't it be realistic to get the .so file built for Alpine as well? Where does one push to get this done?

Thanks for mentioning this. I came across this post trying to get mssql support for php on arm64 ubuntu 20.04 and because of your post I looked up 18.1 and it does include arm64 support. I found it here https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=ubuntu18-install%2Calpine17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline

I followed the steps for ubuntu, but they also have some instructions for Alpine and debian

Sadly no arm for alpine yet.

version 18.1

New distributions supported. Ubuntu 22.04, Red Hat 9. ARM64 Linux platforms: Debian 11, RedHat 8 and 9, Ubuntu 20.04, 22.04

danijelk avatar Mar 20 '23 23:03 danijelk

Just to answer my own question regarding moving the extension from debian/ubuntu onto alpine, sadly as Alpine uses musl libc instead of glibc it won't run - even with libc6-compat package installed.


ldd libmsodbcsql-18.2.so.1.1 
        /lib/ld-musl-aarch64.so.1 (0xffffb7b38000)
        libdl.so.2 => /lib/ld-musl-aarch64.so.1 (0xffffb7b38000)
        libodbcinst.so.2 => /usr/lib/libodbcinst.so.2 (0xffffb78f6000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xffffb7824000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xffffb77c3000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xffffb757f000)
        libm.so.6 => /lib/ld-musl-aarch64.so.1 (0xffffb7b38000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xffffb754e000)
        libpthread.so.0 => /lib/ld-musl-aarch64.so.1 (0xffffb7b38000)
        libc.so.6 => /lib/ld-musl-aarch64.so.1 (0xffffb7b38000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xffffb750d000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0xffffb74ec000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xffffb74cb000)
        libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0xffffb74aa000)
Error relocating libmsodbcsql-18.2.so.1.1: __strcat_chk: symbol not found
Error relocating libmsodbcsql-18.2.so.1.1: __fdelt_chk: symbol not found
Error relocating libmsodbcsql-18.2.so.1.1: __snprintf_chk: symbol not found
Error relocating libmsodbcsql-18.2.so.1.1: __memmove_chk: symbol not found
Error relocating libmsodbcsql-18.2.so.1.1: __strncpy_chk: symbol not found
Error relocating libmsodbcsql-18.2.so.1.1: __memset_chk: symbol not found
Error relocating libmsodbcsql-18.2.so.1.1: __read_chk: symbol not found

danijelk avatar Apr 11 '23 09:04 danijelk

Issue can be closed I believe.

18.18 out now which has support for arm64 for Alpine ❤️‍🔥 thanks for that

danijelk avatar Aug 08 '23 14:08 danijelk

Alpine ARM64 support is now in msodbcsql18_18.3: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/release-notes-odbc-sql-server-linux-mac?view=sql-server-ver16#1831-july-2023

David-Engel avatar Aug 08 '23 21:08 David-Engel