README
1$Id: README,v 1.7 2014/03/11 21:49:04 mwesdorp Exp $
2
3Building sqsh on Windows in the Cygwin environment
4
5Cygwin (http://www.cygwin.com) is a free Unix-like environment (complete
6with X Window server, bash, etc.) that you can install on Windows
7machines. sqsh and other Unix tools can be built in that environment
8and then used to access resources/servers/etc as if you were using a
9Windows program.
10
11Since sqsh-2.5 the configure script is capable of handling cygwin
12installations as well. This README describes the process if you
13want to setup a cygwin build environment yourself as Cygwin can't use
14the Sybase DLLs directly.
15
16
17
18 Building sqsh for Cygwin using Sybase Open Client 15.x
19
201) To be able to link the compiled sqsh object files with the Sybase client libraries
21 to a working sqsh executable, you will need the libsybcs.a, libsybct.a and libsybblk.a
22 link libraries or the 64 bits version libsybcs64.a, libsybct64.a and libsybblk64.a,
23 which are also provided in the cygwin directory. These libraries are
24 generated from the files libsybblk.lib, libsybcs.lib libsybct.lib and libsybblk64.lib,
25 libsybcs64.lib, libsybct64.lib respectively in the %SYBASE%\%SYBASE_OCS%\lib directory.
26 The files provided are based upon version OCS 15.7 P-EBF22014 SP121.
27 To generate your own versions of these libs, you can use the script cygwin-syb15.sh and
28 cygwin64-syb15.sh.
29 Make sure the location of your Sybase installation directory in this script is correct.
30 The default is /cygdrive/c/Sybase.
31 Run this script from the cygwin directory and you will have three new library files:
32 libsybblk.a, libsybcs.a and libsybct.a. (libsybblk64.a, libsybcs64.a and libsybct64.a for
33 the 64 bit version of the script). Copy these files to /usr/local/lib or
34 any other location you want, or just keep them here in the cygwin directory.
35
362) Check the Makefile-syb15 for the default Sybase OCS-15_0 location in variable
37 SYBASE_OCOS on line 19 (default location is /cygdrive/c/Sybase/OCS-15_0).
38
39 SYBASE_OCOS = /cygdrive/c/Sybase/OCS-15_0
40
41 and the SYBASE_LIBS entry on line 40 must point to the directory where you copied
42 the libraries into, in the previous step. Default is the cygwin dir, i.e. ../cygwin.
43
44 SYBASE_LIBS = -L../cygwin -lsybcs -lsybct -lsybblk
45
46 If you want X and Motif support, you also have to uncomment the appropriate
47 entries in the Makefile.
48
493) Go to the sqsh root level and do an export to your Sybase root level in Unix format
50 and run configure:
51
52 export SYBASE=/cygdrive/c/Sybase
53 ./configure --with-readline # optional --with-x --with-motif
54
55 If you run into errors you probably miss some Cygwin development packages.
56 Install these missing packages and retry the ./configure. When succesfull, this will
57 generate some required installation files like src/config.h for example.
58 There is also a config.h file in the cygwin directory that you may copy to the src
59 directory as the created config.h may lead to compile errors.
60 Now copy the Cygwin makefile to the src directory. This will overwrite the generated
61 Makefile with the Cygwin Makefile you just edited in the previous step:
62
63 cp cygwin/Makefile-syb15 src/Makefile
64 or
65 cp cygwin/Makefile-syb15-x64 src/Makefile
66
67 cp cygwin/config.h src/config.h
68
694) Now you can run from the sqsh root dir:
70 make
71 make install
72 make install.man
73
74 By default, sqsh will be installed in /usr/local/bin. Make sure this directory is
75 in your PATH.
76 You may also run make in the src/sqsh_parser directory and then run make in the src
77 directory and copy the created sqsh.exe to your own preferred location..
78
795) Install a .sqshrc file in your $HOME directory. There is an examples in the doc
80 directory. If you choose the sqshrc-2.5 file as a template,
81 you will also have to create a $HOME/.sqsh and $HOME/tmp directory.
82
83 cd sqsh-2.5/doc
84 cp sqshrc-2.5 $HOME/.sqshrc
85 cd $HOME && mkdir .sqsh && mkdir tmp
86
876) Make sure you have a valid sql.ini file in your %SYBASE%\ini directory.
88
897) Some recent installations of Sybase OpenClient and SDK version 15.x do not properly
90 set the SYBASE and SYBASE_OCS environment variables in the users variables region of
91 Windows XP, 7, e.a.
92 So make sure these variables are defined correctly. SYBASE points to the root
93 installation directory (C:\Sybase for example), SYBASE_OCS contains the value OCS-15_0.
94 The variables can also be defined as string values in the registry in
95 HKEY_CURRENT_USER\Environment or HKEY_LOCAL_MACHINE\SOFTWARE\SYBASE\Setup.
96
978) Now you should be able to run sqsh from a cygwin terminal.
98
99
100
101
102
103 Building sqsh for Cygwin using Sybase Open Client 12.x.
104
1051. Generating the appropriate libXXX.a files
106 The cygwin.sh script in this directory can be used to generate
107 these files (libblk.a, libcs.a and libct.a). HOWEVER - this script
108 does not generate usable files with recent (12.5.1 and later)
109 versions of OCS. This directory includes copies of these "libraries"
110 that you should be able to use. Note that these .a files aren't
111 real libraries - they just document the entry points to the DLLs.
112
1132. config.h
114 This file is normally generated by the configure script. You can
115 either use the one provided (which should work), or run configure
116 yourself to generate this file.
117
1183. Makefile
119 The Makefile in this directory has been tailored for use with
120 Cygwin. To use this file directly you need to update the
121 SYBASE_OCOS macro (near the top of the file) to point at your
122 OpenClient installation - it defaults to c:/sybase/OCS-12_5/
123 The SYBASE_LIBS macro points at the .a files in this directory,
124 and the CPPFLAGS include the extra define (-D_MSC_VER=800) that
125 is needed to build sqsh in this environment.
126
127Building:
128
1291. Copy config.h to ../src
1302. cd ../src
1313. Run "make -f ../cygwin/Makefile"
132
133You should normally now have a sqsh.exe binary in the src directory.
134
135
136--------
137
138Linn Anderson sent me the following comments regarding Cygwin when
139using FreeTDS:
140
141First, thanks for sqsh. I just built it for my cygwin desktop and had
142only a little trouble, mostly following the instructions in the cygwin
143directory. What I ended up doing was much easier. I havn't used the
144sqsh much, but the build seems robust.
145
146 Maybe this is all old hat to you, but if it helps, here is what I did:
147
148 Default Freetds install (configure, make, make install)
149 Extract sqsh
150 SYBASE=/usr/local
151 Export SYBASE
152 ./configure --with-readline
153 Edit src/Makefile, replacing -ldl with -liconv
154 Make
155 Make install
156 Make install.man
157 And of course, edit up some usable interfaces file.
158
159The only problem with the build, out of the box, was -ldl not found and
160several links were needed from -liconv.
161
162 Again, thanks.
163
164--Linn
165
166