Cygwin32 on NT
Setting up to use the new CYGNUS cygwin32 release b18.0:
NOTE: all of these instructions/setups (except for creating the common
.bashrc file) are effective for only a single user on a
single machine so must be repeated for each user on each machine. In
addition they are for one particular choice of directories etc. At the
end, I'll mention some things that can be customized.
- Make sure that you have \\d0server1\apps NT mapped to some
drive number. Mine is mapped to n:. All the instructions below assume
that mapping. If yours is different, then substitute the correct drive
letter. You can also use the \\node\share NT device name convention.
That is, you can substitute \\d0server1\apps\ for n:\ in the
instructions below.
- In Control Panel/System, Environment tab:
- create or modify the User Variable "Path" (a semicolon deliminated
list) to add the directories:
- .; ("dot")
- n:\gnuwin32\b18\H-i386-cygwin32\bin;
- n:\gnuwin32\b18\tcl\bin;
- n:\cvs-1.6\windebug;
The first searches your current directory. The second allows the
system to find the cygwin32 binaries, including bash (the
Bourne Again SHell). The third is for TCL. And the last is to
use CVS V1.6, which is not a part of the new Cygnus release but is needed
for any code management you'd do. Since this is probably the reason you're
configuring cygwin32 it's recommended.
- Create or modify the Variables
- HOMEDRIVE = c:
- HOMEPATH = \your_username
These tell your Dos Cmd Line window to startup in
c:\your_username. You can change this to whatever you like,
but see the .bashrc files below.
- If you want to use the tools, especially the g++
compiler from the DOS command line, as well as from bash then
create or modify the User Variable:
- GCC_EXEC_PREFIX = n:\gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\
NOTE: the trailing " \ " is important
If you don't want to use g++ from DOS, then you can put this
line into your .bashrc below.
You may also define the following for TCL:
- GDBTK_LIBRARY = n:\gnuwin32\b18\share\gdbtcl
- TCL_LIBRARY = n:\gnuwin32\b18\tcl\lib\tcl7.6
And make sure that:
- TEMP = c:\temp
- TMP = c:\temp
- exit the control panel to make the changes.
- create a file c:\.bashrc similar to the one I've used:
Common .bashrc
- Create a .bashrc in your user area. This is the file
source'd by the common .bashrc above. For now this
can be an empty file.
- Pop a new Command Prompt (MSDOS) window:
- check that you are in the directory you should be in.
- type env and check that the environment variables set above
are correct. If you mistype anything the system leaves the old value, so
try again.
- type mount to see what "devices" are mounted.
- mount c:\temp\ /tmp
- mount n:\gnuwin32\b18\H-i386-cygwin32\bin /bin
- mount n:\gnuwin32\b18\H-i386-cygwin32\ /usr
- mount n:\d0dist /d0dist
In principle you can do these mounts from either DOS CMD or
bash but the syntax is funny in this version of bash,
and depends on exactly what you're mounting. So your best bet is to issue
the mount command from the DOS CMD shell.
All of these setups are "permanent". They, including the mounts,
survive login sessions and power cycling the computer.
Testing your setup
At this point you can begin using the cygwin32 tools, either in the
DOS command line window directly or by invoking the bash
shell (just type bash in your command window).
To try out your setup, the first thing you should try is to just run
bash and try the various unix commands. Bash is a
superset of SH. It has many of the features of csh,
tcsh and korn shell. See the
references below.
- copy the directory n:\gnuwin32\b17-1\demo\*.* (there doesn't
seem to be the equivalent for b18) to somewhere convenient.
- in your your DOS window, cd into that directory
- type bash to enter the bash shell or you can do the
following directly in the DOS Cmd shell
- type make clean to make sure you start from a clean slate
- type make
NOTE: make will end with an error. If you edit (NOTEPAD
works fine or use emacs) or cat
"makefile", you'll find a section all: that includes a list of
actions. I've rearranged this section so that the 3 items which fail are
last. Each fails in a different way. objdump and exe.exe
run fine outside of make. If anyone finds the problem(s), let me
know.
Customizations and SoftRelTools
In the setup above there are a number of customizations possible.
The most obvious customization that you'll want to do is to "mount"
other disks. There are two ways to reference disks in cygwin32.
The only "magic" directory is "/", the root. Whatever directory you
mount as "/" is where bash looks for it's
.bashrc, .bashrc_profile and .bashrc_logout
files. See the references below. And that can be anywhere!
For example, to make "/" be your user
area on \\d0server1\users, from a DOS Cmd window:
- mount \\d0server1\users\your-dir /
- copy the common .bashrc file to the new "/" directory,
and edit it appropriately. You don't need a user specific one, since
this file is in your private area.
- you might need a /tmp directory here too, but I don't think so,
since you have /tmp pointing to your c: drive. I don't know how the
two: mounted /tmp, and /tmp built from "/"+tmp interact.
Another obvious customization is your "login directory". You can change it
to be anywhere you wish, but be careful with the contents of the common
.bashrc file. In the DOS and bash shells, your
login directory is the concatenation of the two environmental variables:
HOMEDRIVE and HOMEPATH. I've got mine set to C:
and \jonckheere respectively. NOTE: emacs uses a variable
HOME to find it's .emacs resource file. I've got that
defined in terms of the other two.
One more major customization that is recommended: Since we
don't have setup (ie UPS) working on NT yet, you'll need to define
the cvs and D0RunII variables yourself. It's convenient to
put the values that you usually use into your personal .bashrc file.
That way they aren't part of the system, so they can be changed from
the command line. Unfortunately they aren't available from DOS but
you can't have everything. My .bashrc looks like:
#Jonckheere's .bashrc
export CVSROOT;CVSROOT=cvsuser@d0chb.fnal.gov:/cvsroot/d0cvs
lscvs() { /d0dist/dist/util/lscvs $@; }
export BFDIST;BFDIST=/d0dist/dist
export BFCURRENT;BFCURRENT=test
export BFARCH;BFARCH=CYGWIN32-NT`uname -r | cut -c1`
PATH=$BFDIST/releases/$BFCURRENT/bin/$BFARCH:/usr/bin:/usr/local/bin:$PATH
export PATH
#end of ~Jonckheere/.bashrc
- CVSROOT tells cvs where the D0 repository is.
The next line defines the lscvs function. These replace
setup d0cvs.
- The BF* definitions and adding $BFDIST/.../bin to the
PATH replace (some of) what setup -d D0RunII does.
These are enough to make it work for now.
- The PATH definition adds:
- the test version of SoftRelTools and the other
exe's in that release version to my PATH. This entry is
needed to use any of the SoftRelTools functionality
(newrel, addpkg, lnkpkg etc) as well as any exe's in that
release.
NOTE: BFCURRENT and the PATH are the
variables you need to change to switch between various versions of releases.
BFCURRENT can easily be done from the command line. Changing
PATH is not normally necessary to run SRT and requires
you to change this entry and restart bash.
- the cygwin32 bin directories to the beginning
of my PATH.
These entries are needed if you want the UNIX style commands to override the
DOS versions. Find is the command that I use most often. In the NT
Control Panel variables, the system part of PATH preceeds
the user part. This .bashrc entry fixes that but only within
the bash shell and only for you. Another way to do the same thing is
to add these entries to the system portion of the PATH
definition within the NT Control Panel/System/Environment. You need
to be an NT administrator or have administrator privileges to do this and it
will effect all users on your machine in both the DOS and
bash shells.
References
For a quick intro to the user tools in cygwin32, including bash etc See the
files in \\d0server1\apps\gnuwin32\b17-1\html\
- index.html for the various tools (html man
pages, quite nice)
- bash.html for a very short intro to bash (a much longer
one is included as a link in index.html)
- bash-config.html for tips on configuring bash
- bash-variables.html for a short description of useful
bash variables (PATH etc).
- faq_toc.html, cygwin32 faq
For a very nice representation of the MAN pages in Windows HELP
format, see: \\d0server1\apps\gnuwin32\b17-1\hlp\dir.hlp.
An INFO version is in ...\Info\ etc.
NOTE: all of these are for the previous version of
cywin32 (b17.1) but most haven't changed. When the equivalent is
available specifically for b18.0 I'll install them.
For a more detailed description of the Cygnus tools see the
Cygwin32 home page at
www.cygnus.com/misc/gnu-win32 and the Cygnus home page:
www.cygnus.com
Alan M. Jonckheere
Last modified: Tue Oct 21 09:10:32 CDT 1997