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

pecl install sqlsrv fails #726

Closed
adankert opened this issue Mar 21, 2018 · 4 comments
Closed

pecl install sqlsrv fails #726

adankert opened this issue Mar 21, 2018 · 4 comments

Comments

@adankert
Copy link

adankert commented Mar 21, 2018

+## Driver version or file name
+Please tell us what the PHP driver version or file name is.
+
+## SQL Server version
+Please tell us what the SQL Server version is.
+
+## Client operating system
+Please tell us what oprating system the client program is running on.
Centos 7.4
+## PHP version
+Please tell us which version of PHP you are running.
7.2.3
+## Microsoft ODBC Driver version
+Please tell us which version of the Microsoft ODBC Driver you are using.
17.0.1.1-1
+## Table schema
+Please tell us the table schema
+
+## Problem description
+Please share more details with us.
+
+## Expected behavior and actual behavior
+Please tell us what should happen and what happened instead

pecl install sqlsrv
downloading sqlsrv-4.3.0.tgz ...
Starting to download sqlsrv-4.3.0.tgz (164,282 bytes)
....................................done: 164,282 bytes
33 source files, building
running: phpize
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
building in /var/tmp/pear-build-rootU12Avy/sqlsrv-4.3.0
running: /var/tmp/sqlsrv/configure --with-php-config=/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 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 whether cc understands -c and -o together... yes
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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable sqlsrv functions... yes, shared
checking for SQLSRV headers... /var/tmp/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 whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-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 mt... no
checking if : 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... no
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... no
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: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/sh /var/tmp/pear-build-rootU12Avy/sqlsrv-4.3.0/libtool --mode=compile g++ -std=c++11 -I. -I/var/tmp/sqlsrv -DPHP_ATOM_INC -I/var/tmp/pear-build-rootU12Avy/sqlsrv-4.3.0/include -I/var/tmp/pear-build-rootU12Avy/sqlsrv-4.3.0/main -I/var/tmp/sqlsrv -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/var/tmp/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /var/tmp/sqlsrv/conn.cpp -o conn.lo
libtool: compile: g++ -std=c++11 -I. -I/var/tmp/sqlsrv -DPHP_ATOM_INC -I/var/tmp/pear-build-rootU12Avy/sqlsrv-4.3.0/include -I/var/tmp/pear-build-rootU12Avy/sqlsrv-4.3.0/main -I/var/tmp/sqlsrv -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/var/tmp/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /var/tmp/sqlsrv/conn.cpp -fPIC -DPIC -o .libs/conn.o
In file included from /usr/include/php/Zend/zend_types.h:27:0,
from /usr/include/php/Zend/zend.h:29,
from /usr/include/php/main/php.h:35,
from /var/tmp/sqlsrv/shared/core_sqlsrv.h:34,
from /var/tmp/sqlsrv/php_sqlsrv.h:25,
from /var/tmp/sqlsrv/conn.cpp:20:
/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_increment_function(zval*)':
/usr/include/php/Zend/zend_operators.h:446:68: error: '__builtin_saddl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                ^

/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_decrement_function(zval*)':
/usr/include/php/Zend/zend_operators.h:500:68: error: '__builtin_ssubl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                ^

/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_add_function(zval*, zval*, zval*)':
/usr/include/php/Zend/zend_operators.h:554:80: error: '__builtin_saddl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                ^

/usr/include/php/Zend/zend_operators.h: In function 'void fast_long_sub_function(zval*, zval*, zval*)':
/usr/include/php/Zend/zend_operators.h:657:80: error: '__builtin_ssubl_overflow' was not declared in this scope
if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) {
^
/usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                ^

make: *** [conn.lo] Error 1
ERROR: `make' failed

+## Repro code
+Please share repro code with us, or tell us how to reproduce the issue.

@david-puglielli
Copy link
Contributor

@adankert This is a known issue - the problem is that the default gcc on CentOS lacks the required definitions, and even after upgrading gcc PECL finds the old compiler. To install the drivers, you must first upgrade your gcc by installing the devtoolset collection as follows:

sudo yum install centos-release-scl
sudo yum install devtoolset-7
scl enable devtoolset-7 bash

See this page for more info. Then download and install the drivers manually:

pecl download sqlsrv-5.2.0RC1
tar xvzf sqlsrv-5.2.0RC1.tgz
cd sqlsrv-5.2.0RC1/
phpize
./configure --with-php-config=/usr/bin/php-config
make
sudo make install

and similarly for pdo_sqlsrv.

Alternatively, you can install the drivers from the Remi repo:

sudo yum install php-sqlsrv php-pdo_sqlsrv

though I do not know if this will install the latest version.

@yitam
Copy link
Contributor

yitam commented Apr 4, 2018

Closing issue due to inactivity. Please feel free to reopen.

@MarFelix
Copy link

MarFelix commented May 15, 2020

The following worked for me:
already from root

  • yum install centos-release-scl
  • yum install devtoolset-7
  • scl enable devtoolset-7 bash
  • pecl download sqlsrv-5.2.0RC1
  • tar xvzf sqlsrv-5.2.0RC1.tgz
  • cd sqlsrv-5.2.0RC1/
  • phpize
  • ./configure --with-php-config=/usr/local/bin/php-config (this changed in my case)
  • make
  • sudo make install

Environment:

CentOS Linux release 7.7.1908 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.7.1908 (Core)
CentOS Linux release 7.7.1908 (Core)

PHP Version 7.2.29

Linux v193257.neubox.net 3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020 x86_64

@yitam
Copy link
Contributor

yitam commented May 15, 2020

Just so you know, @MarFelix, this is an old issue. Our latest release is 5.8.1, which works with php 7.4

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

4 participants