| 1 |
Building DBD::ODBC on Windows |
| 2 |
============================= |
| 3 |
|
| 4 |
Quick hints: |
| 5 |
|
| 6 |
1. Make sure when you run "perl Makefile.PL" that you specify which |
| 7 |
make you are using (dmake, nmake). You do this with: |
| 8 |
|
| 9 |
perl Makefile.PL MAKE=nmake |
| 10 |
|
| 11 |
If you don't, ExtUtils::MakeMaker will generate the Makefile for |
| 12 |
the default make which may not be the one you are going to use and |
| 13 |
this will lead to make errors. |
| 14 |
|
| 15 |
2. I've had a number of reports that attempting to build with Borland's |
| 16 |
make does not work. If that happens to you please don't tell me; get |
| 17 |
nmake or dmake. |
| 18 |
|
| 19 |
3. If you are not interested in Unicode support disable it as Unicode |
| 20 |
support is built in by default on Windows builds. You can disable it |
| 21 |
with -nou as in: |
| 22 |
|
| 23 |
perl Makefile.PL -nou |
| 24 |
|
| 25 |
4. If you are manually attempting to build DBD::ODBC for use with |
| 26 |
ActiveState Perl (ActivePerl) don't. You can use cpan like this: |
| 27 |
|
| 28 |
cpan M/MJ/MJEVANS/DBD-ODBC-1.23_4.tar.gz |
| 29 |
|
| 30 |
If you don't have Microsoft VC on your PATH, then this will |
| 31 |
download and install MinGW for you (inside the Perl tree) and use |
| 32 |
that instead. |
| 33 |
|
| 34 |
This should work for the latest builds of all major Perl versions, |
| 35 |
5.8.9.827, 5.10.1.1007 and 5.12.0.1200. On older versions you may |
| 36 |
need to install MinGW with PPM "by-hand" first: |
| 37 |
|
| 38 |
ppm install MinGW |
| 39 |
cpan M/MJ/MJEVANS/DBD-ODBC-1.23_4.tar.gz |
| 40 |
|
| 41 |
On ActivePerl 5.8.8 and earlier you will have to download, install |
| 42 |
and configure MinGW and dmake manually though, so you may not want |
| 43 |
to bother... |
| 44 |
|
| 45 |
5. With Strawberry Perl you can install DBD::ODBC from cpan as normal |
| 46 |
- see below. |
| 47 |
|
| 48 |
64bit Windows |
| 49 |
============= |
| 50 |
|
| 51 |
I have built DBD::ODBC on win64 and the tests to SQL Server completed |
| 52 |
successfully. However, you will need at least version 1.15 if you want |
| 53 |
to run DBD::ODBC on win64 successfully. |
| 54 |
|
| 55 |
If you are running a 32bit Perl on a 64bit Windows machine you will |
| 56 |
need to be aware there are two ODBC administrators and you need to |
| 57 |
create your DSNs with the right one. The ODBC Administrator you get to |
| 58 |
from Control Panel, Administrative Tools, Data Sources is the 64bit |
| 59 |
one and data sources created here will not be visible or useable from |
| 60 |
32bit applications. The ODBC administrator you need to use for 32bit |
| 61 |
applications can be found at X:\windows\syswow64\odbcad32.exe. |
| 62 |
|
| 63 |
Strawberry Perl |
| 64 |
=============== |
| 65 |
|
| 66 |
If you attempt to install DBD::ODBC with: |
| 67 |
|
| 68 |
cpan -i DBD::ODBC |
| 69 |
|
| 70 |
cpan in strawberry perl adds INC to the command line and that |
| 71 |
overrides what MakeMaker attempts to add to INC. As a result, the |
| 72 |
build will probably be missing the include path for the DBIXS.h |
| 73 |
module. |
| 74 |
|
| 75 |
See http://rt.cpan.org/Public/Bug/Display.html?id=32811. |
| 76 |
|
| 77 |
Since DBD::ODBC 1.17_2 I believe we have a workaround in the |
| 78 |
Makefile.PL that stops this happening and in later Strawberry Perl |
| 79 |
versions the problem is fixed. |
| 80 |
|
| 81 |
Reported issues and workarounds |
| 82 |
=============================== |
| 83 |
|
| 84 |
Missing SQLLEN/SQLULEN definitions |
| 85 |
================================== |
| 86 |
|
| 87 |
MS changed the ODBC header files and introduced SQLLEN/SQLULEN types |
| 88 |
which are required to build on 64 bit platforms so DBD::ODBC now needs |
| 89 |
them. |
| 90 |
|
| 91 |
If you find you are missing definitions for SQLLEN/SQLULEN you need |
| 92 |
updated header files. See the DBD::ODBC FAQ for where you can find |
| 93 |
them. |
| 94 |
|
| 95 |
Visual Studio 6.0 and SDK Feb 2003 |
| 96 |
================================== |
| 97 |
|
| 98 |
It has been reported to me that there are problems building DBD::ODBC |
| 99 |
with VS 6 on some setups (thanks to JHF Remmelzwaal for the following |
| 100 |
example and workaround). |
| 101 |
|
| 102 |
Initially an nmake failed with: |
| 103 |
|
| 104 |
C:\Program Files\Microsoft SDK\Include\.\windows.h(157) : fatal error |
| 105 |
C1083: Cannot open include file: 'excpt.h': No such file or directory |
| 106 |
|
| 107 |
This was solved by: |
| 108 |
|
| 109 |
set PASTHRU_INC=-I"c:\Program Files\Microsoft SDK\include" -I"c:\Program Files\Microsoft Visual Studio\VC98\include" |
| 110 |
|
| 111 |
which led to: |
| 112 |
|
| 113 |
ODBC.obj : error LNK2001: unresolved external symbol __fltused |
| 114 |
dbdimp.obj : error LNK2001: unresolved external symbol __fltused |
| 115 |
unicode_helper.obj : error LNK2001: unresolved external symbol __fltused |
| 116 |
ODBC.obj : error LNK2001: unresolved external symbol __imp__sprintf |
| 117 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp__sprintf |
| 118 |
ODBC.obj : error LNK2001: unresolved external symbol _strcpy |
| 119 |
dbdimp.obj : error LNK2001: unresolved external symbol _strcpy |
| 120 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp__strncmp |
| 121 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp__toupper |
| 122 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp__strncpy |
| 123 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp__strstr |
| 124 |
dbdimp.obj : error LNK2001: unresolved external symbol _memcpy |
| 125 |
dbdimp.obj : error LNK2001: unresolved external symbol _memset |
| 126 |
dbdimp.obj : error LNK2001: unresolved external symbol _strlen |
| 127 |
unicode_helper.obj : error LNK2001: unresolved external symbol _strlen |
| 128 |
dbdimp.obj : error LNK2001: unresolved external symbol _strcmp |
| 129 |
dbdimp.obj : error LNK2001: unresolved external symbol _strcat |
| 130 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp__atoi |
| 131 |
dbdimp.obj : error LNK2001: unresolved external symbol _abs |
| 132 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp___pctype |
| 133 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp___isctype |
| 134 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp____mb_cur_max |
| 135 |
dbdimp.obj : error LNK2001: unresolved external symbol __imp__strchr |
| 136 |
unicode_helper.obj : error LNK2001: unresolved external symbol __imp__wcslen |
| 137 |
LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12 |
| 138 |
blib\arch\auto\DBD\ODBC\ODBC.dll : fatal error LNK1120: 20 unresolved externals |
| 139 |
NMAKE : fatal error U1077: 'link' : return code '0x460' |
| 140 |
|
| 141 |
which was resolved by adding |
| 142 |
|
| 143 |
c:\Program Files\Microsoft Visual Studio\VC98\Lib\MSVCRTD.LIB" |
| 144 |
|
| 145 |
to end of LDLOADLIBS in the Makefile. |