cygwin
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
$Id: README,v 1.6 2014/03/02 21:10:04 mwesdorp Exp $ Building sqsh on Windows in the Cygwin environment Cygwin (http://www.cygwin.com) is a free Unix-like environment (complete with X Window server, bash, etc.) that you can install on Windows machines. sqsh and other Unix tools can be built in that environment and then used to access resources/servers/etc as if you were using a Windows program. Since sqsh-2.5 the configure script is capable of handling cygwin installations as well. This README describes the process if you want to setup a cygwin build environment yourself as Cygwin can't use the Sybase DLLs directly. Building sqsh for Cygwin using Sybase Open Client 15.x 1) To be able to link the compiled sqsh object files with the Sybase client libraries to a working sqsh executable, you will need the libsybcs.a, libsybct.a and libsybblk.a link libraries or the 64 bits version libsybcs64.a, libsybct64.a and libsybblk64.a, which are also provided in the cygwin directory. These libraries are generated from the files libsybblk.lib, libsybcs.lib libsybct.lib and libsybblk64.lib, libsybcs64.lib, libsybct64.lib respectively in the %SYBASE%\%SYBASE_OCS%\lib directory. The files provided are based upon version OCS 15.7 P-EBF22014 SP121. To generate your own versions of these libs, you can use the script cygwin-syb15.sh and cygwin64-syb15.sh. Make sure the location of your Sybase installation directory in this script is correct. The default is /cygdrive/c/Sybase. Run this script from the cygwin directory and you will have three new library files: libsybblk.a, libsybcs.a and libsybct.a. (libsybblk64.a, libsybcs64.a and libsybct64.a for the 64 bit version of the script). Copy these files to /usr/local/lib or any other location you want, or just keep them here in the cygwin directory. 2) Check the Makefile-syb15 for the default Sybase OCS-15_0 location in variable SYBASE_OCOS on line 19 (default location is /cygdrive/c/Sybase/OCS-15_0). SYBASE_OCOS = /cygdrive/c/Sybase/OCS-15_0 and the SYBASE_LIBS entry on line 40 must point to the directory where you copied the libraries into, in the previous step. Default is the cygwin dir, i.e. ../cygwin. SYBASE_LIBS = -L../cygwin -lsybcs -lsybct -lsybblk If you want X and Motif support, you also have to uncomment the appropriate entries in the Makefile. 3) Go to the sqsh root level and do an export to your Sybase root level in Unix format and run configure: export SYBASE=/cygdrive/c/Sybase ./configure --with-readline # optional --with-x --with-motif If you run into errors you probably miss some Cygwin development packages. Install these missing packages and retry the ./configure. When succesfull, this will generate some required installation files like src/config.h for example. There is also a config.h file in the cygwin directory that you may copy to the src directory as the created config.h may lead to compile errors. Now copy the Cygwin makefile to the src directory. This will overwrite the generated Makefile with the Cygwin Makefile you just edited in the previous step: cp cygwin/Makefile-syb15 src/Makefile or cp cygwin/Makefile-syb15-x64 src/Makefile cp cygwin/config.h src/config.h 4) Now you can run from the sqsh root dir: make make install make install.man By default, sqsh will be installed in /usr/local/bin. Make sure this directory is in your PATH. You may also run make in the src/sqsh_parser directory and then run make in the src directory and copy the created sqsh.exe to your own preferred location.. 5) Install a .sqshrc file in your $HOME directory. There is an examples in the doc directory. If you choose the sqshrc-2.5 file as a template, you will also have to create a $HOME/.sqsh and $HOME/tmp directory. cd sqsh-2.5/doc cp sqshrc-2.5 $HOME/.sqshrc cd $HOME && mkdir .sqsh && mkdir tmp 6) Make sure you have a valid sql.ini file in your %SYBASE%\ini directory. 7) Some recent installations of Sybase OpenClient and SDK version 15.x do not properly set the SYBASE and SYBASE_OCS environment variables in the users variables region of Windows XP, 7, e.a. So make sure these variables are defined correctly. SYBASE points to the root installation directory (C:\Sybase for example), SYBASE_OCS contains the value OCS-15_0. The variables can also be defined as string values in the registry in HKEY_CURRENT_USER\Environment or HKEY_LOCAL_MACHINE\SOFTWARE\SYBASE\Setup. 8) Now you should be able to run sqsh from a cygwin terminal. Building sqsh for Cygwin using Sybase Open Client 12.x. 1. Generating the appropriate libXXX.a files The cygwin.sh script in this directory can be used to generate these files (libblk.a, libcs.a and libct.a). HOWEVER - this script does not generate usable files with recent (12.5.1 and later) versions of OCS. This directory includes copies of these "libraries" that you should be able to use. Note that these .a files aren't real libraries - they just document the entry points to the DLLs. 2. config.h This file is normally generated by the configure script. You can either use the one provided (which should work), or run configure yourself to generate this file. 3. Makefile The Makefile in this directory has been tailored for use with Cygwin. To use this file directly you need to update the SYBASE_OCOS macro (near the top of the file) to point at your OpenClient installation - it defaults to c:/sybase/OCS-12_5/ The SYBASE_LIBS macro points at the .a files in this directory, and the CPPFLAGS include the extra define (-D_MSC_VER=800) that is needed to build sqsh in this environment. Building: 1. Copy config.h to ../src 2. cd ../src 3. Run "make -f ../cygwin/Makefile" You should normally now have a sqsh.exe binary in the src directory. -------- Linn Anderson sent me the following comments regarding Cygwin when using FreeTDS: First, thanks for sqsh. I just built it for my cygwin desktop and had only a little trouble, mostly following the instructions in the cygwin directory. What I ended up doing was much easier. I havn't used the sqsh much, but the build seems robust. Maybe this is all old hat to you, but if it helps, here is what I did: Default Freetds install (configure, make, make install) Extract sqsh SYBASE=/usr/local Export SYBASE ./configure --with-readline Edit src/Makefile, replacing -ldl with -liconv Make Make install Make install.man And of course, edit up some usable interfaces file. The only problem with the build, out of the box, was -ldl not found and several links were needed from -liconv. Again, thanks. --Linn