First time installation for sqlsrv and pdo_sqlsrv
using microsoft azure sql server
using rasparian (Debian 8)
php 7.0
im receiving conn.lo error
In file included from /usr/include/sql.h:19:0,
from /tmp/pear/temp/sqlsrv/shared/xplat.h:30,
from /tmp/pear/temp/sqlsrv/shared/typedefs_for_linux.h:23,
from /tmp/pear/temp/sqlsrv/shared/xplat_winnls.h:24,
from /tmp/pear/temp/sqlsrv/shared/FormattedPrint.h:24,
from /tmp/pear/temp/sqlsrv/shared/core_sqlsrv.h:41,
from /tmp/pear/temp/sqlsrv/php_sqlsrv.h:25,
from /tmp/pear/temp/sqlsrv/conn.cpp:20:
/usr/include/sqltypes.h:251:33: note: previous declaration as 'typedef long unsigned int UDWORD'
typedef unsigned long int UDWORD;
^
Makefile:194: recipe for target 'conn.lo' failed
The so should install but instead it shows code error.
When run this sudo pecl install sqlsrv pdo_sqlsrv command
@zhiyan114 Could you provide the full error message? It's not clear from what you have provided where the conflicting declarations are.
After it runs the build command:
/bin/bash /tmp/pear/temp/pear-build-rootNQun35/sqlsrv-4.3.0/libtool --mode=compile g++ -std=c++11 -I. -I/tmp/pear/temp/sqlsrv -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootNQun35/sqlsrv-4.3.0/include -I/tmp/pear/temp/pear-build-rootNQun35/sqlsrv-4.3.0/main -I/tmp/pear/temp/sqlsrv -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/tmp/pear/temp/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /tmp/pear/temp/sqlsrv/conn.cpp -o conn.lo
libtool: compile: g++ -std=c++11 -I. -I/tmp/pear/temp/sqlsrv -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootNQun35/sqlsrv-4.3.0/include -I/tmp/pear/temp/pear-build-rootNQun35/sqlsrv-4.3.0/main -I/tmp/pear/temp/sqlsrv -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/tmp/pear/temp/sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -c /tmp/pear/temp/sqlsrv/conn.cpp -fPIC -DPIC -o .libs/conn.o
In file included from /tmp/pear/temp/sqlsrv/shared/xplat.h:99:0,
from /tmp/pear/temp/sqlsrv/shared/typedefs_for_linux.h:23,
from /tmp/pear/temp/sqlsrv/shared/xplat_winnls.h:24,
from /tmp/pear/temp/sqlsrv/shared/FormattedPrint.h:24,
from /tmp/pear/temp/sqlsrv/shared/core_sqlsrv.h:41,
from /tmp/pear/temp/sqlsrv/php_sqlsrv.h:25,
from /tmp/pear/temp/sqlsrv/conn.cpp:20:
/tmp/pear/temp/sqlsrv/shared/xplat_intsafe.h:50:29: error: conflicting declaration 'typedef windowsULong_t DWORD'
typedef windowsULong_t DWORD;
^
In file included from /usr/include/sql.h:19:0,
from /tmp/pear/temp/sqlsrv/shared/xplat.h:30,
from /tmp/pear/temp/sqlsrv/shared/typedefs_for_linux.h:23,
from /tmp/pear/temp/sqlsrv/shared/xplat_winnls.h:24,
from /tmp/pear/temp/sqlsrv/shared/FormattedPrint.h:24,
from /tmp/pear/temp/sqlsrv/shared/core_sqlsrv.h:41,
from /tmp/pear/temp/sqlsrv/php_sqlsrv.h:25,
from /tmp/pear/temp/sqlsrv/conn.cpp:20:
/usr/include/sqltypes.h:96:24: note: previous declaration as 'typedef long unsigned int DWORD'
typedef unsigned long DWORD;
^
Makefile:194: recipe for target 'conn.lo' failed
make: *** [conn.lo] Error 1
ERROR:make' failed
`
There is a conflicting declaration of DWORD somewhere in your header files. What does your unixodbc_conf.h look like? Can you attach it here? It is likely in your /usr/include directory.
Here is the code from that file
/* unixodbc_conf.h. Generated from unixodbc_conf.h.in by configure. */
/* #undef ODBC_STD */
/* #undef UNICODE */
/* #undef GUID_DEFINED */
/* #undef SQL_WCHART_CONVERT */
/* #undef ODBCINT64_TYPEA */
/* #undef UODBCINT64_TYPE */
/* #undef DISABLE_INI_CACHING */
/* #undef ALLREADY_HAVE_WINDOWS_TYPE */
/* #undef DONT_TD_VOID */
/* #undef DO_YOU_KNOW_WHAT_YOUR_ARE_DOING */
Your header file defines SIZEOF_LONG_INT as 4. SIZEOF_LONG_INT is then used in sqltypes.h to typedef unsigned long as DWORD, but the sqlsrv source typedefs unsigned int as DWORD, and these conflict because unsigned long is 8 bytes on your system and unsigned int is 4 bytes. SIZEOF_LONG_INT should be 8. I suspect you installed unixODBC manually with certain configure flags - can you provide the commands you used to install unixODBC?
The PHP drivers used to require a specific set of configure options relating to type lengths when building unixODBC, but that is no longer the case and the packaged unixODBC from apt works. If you do not specifically need to manually compile unixODBC for some other application, it would be easiest to remove it from your system and reinstall using apt-get install unixodbc.
@zhiyan114 do you have any updates? Otherwise, due to inactivity, we will close this issue in a few days.
Closing this issue, @zhiyan114
Please feel free to reopen if you have any question about this.
I am having the same issue.
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bioni
odbcinst -j
unixODBC 2.3.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/maruf/.odbc.ini
SQLULEN Size.......: 4
SQLLEN Size........: 4
SQLSETPOSIROW Size.: 2
odbcinst -q -d -n
[ODBC Driver 17 for SQL Server]
The error I receive is:
/tmp/pear/temp/sqlsrv/shared/xplat_intsafe.h:50:29: error: conflicting declaration ‘typedef windowsULong_t DWORD’
typedef windowsULong_t DWORD;
^~~~~
In file included from /usr/include/sql.h:19:0,
from /tmp/pear/temp/sqlsrv/shared/xplat.h:30,
from /tmp/pear/temp/sqlsrv/shared/typedefs_for_linux.h:23,
from /tmp/pear/temp/sqlsrv/shared/xplat_winnls.h:24,
from /tmp/pear/temp/sqlsrv/shared/FormattedPrint.h:24,
from /tmp/pear/temp/sqlsrv/shared/core_sqlsrv.h:41,
from /tmp/pear/temp/sqlsrv/php_sqlsrv.h:25,
from /tmp/pear/temp/sqlsrv/conn.cpp:20:
/usr/include/sqltypes.h:96:24: note: previous declaration as ‘typedef long unsigned int DWORD’
typedef unsigned long DWORD;
^~~~~
Makefile:194: recipe for target 'conn.lo' failed
make: *** [conn.lo] Error 1
ERROR: `make' failed
Thanks
Hi @marufmax
We have not seen this before. While we are investigating, please tell us how you installed PHP (7.2?) and/or ODBC 17.
I'd installed ODBC 17 from the instructions provied in here https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017
#Ubuntu 18.04
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install unixodbc-dev
and PHP from ondrej PHP repository.
Please note that for PHP 7.2 you don't need the ondrej repository, not to mention that it comes with dependencies that may conflict with a base Ubuntu 18.04 install. Please read the notes in our documentation.
As @david-puglielli stated above
when I changed SIZEOF_LONG_INT to 8 in the file
/usr/include/unixodbc_conf.h
It compiled successfully!
thank you
I got the same error that @marufmax got, just remember to install
# optional: for unixODBC development headers
sudo apt-get install unixodbc-dev
After that, it worked. !
I got the same error that @marufmax got, just remember to install
# optional: for unixODBC development headers sudo apt-get install unixodbc-devAfter that, it worked. !
thanks ..
I install this and try install SQLSRV again and it works ...
Most helpful comment
I got the same error that @marufmax got, just remember to install
After that, it worked. !