User Tools

Site Tools


wiki:software:winccdtlong

This is an old revision of the document!


Running CCDT on Windows - The Long Version

This article is something of a companion-piece to this one, which explains (briefly!) how to use Cygwin to get a piece of software -the Classical CD Tagger- written for Linux running happily on Windows. That short-form article assumed you knew what Cygwin was and how to use it to install necessary Linux software.

In this article, the end-result is the same: we want to be able to run the Classical CD Tagger within Windows, using Cygwin to provide the Linux-capabilities it needs. But I shall assume you've never really used Cygwin before and will thus describe things at length and use lots of screenshots to make things clear!

1.0 Introducing Cygwin

It's been possible for many, many years to run Unix-y programs on Windows by installing Cygwin. Cygwin is a Linux compatibility layer for Windows, much as Wine is a Windows compatibility layer for Linux. You install it, then you can download and compile all sorts of Linux-native programs and have them run 'within' the Cygwin environment, still inside your Windows operating system.

You might well ask: surely, there are lots of ways of running Linux on Windows? For example, install VirtualBox, define a virtual machine, install Ubuntu (or whatever distro floats your boat!): da-da! Linux on Windows!! Well, sort of. What you'd actually end up with is a complete Linux environment running on top of, but outside of, Windows. A file on your C: drive will be invisible to the Linux environment, because they are two completely separate, distinct environments. Running a VM on Windows also requires a lot of CPU and RAM.

What about the new(ish) Windows Subsystem for Linux (WSL)? Wouldn't that achieve the requirement? Well, it might -but there are already 2 distinct versions of WSL which makes recommending it problematic. Version 1 was very much like Cygwin: it intercepted Linux software's kernel calls in real time and translated them into something the Windows kernel could handle. That resulted in a lightweight, unified environment in which Linux and Windows really did seem to cohabit nicely… but version 2 is a very different beast and is, essentially, a virtual machine running Linux. It does so more transparently than, say, VirtualBox, but the result is basically the same: you still need lots of RAM and lots of CPU.

Cygwin, however, provides a thin, mostly transparent way of running Linux software on Windows, without major virtualization taking place. It's free, like WSL; it's lightweight, like WSL v1, but unlike VirtualBox; it gets the job done. So that's why I'll be showing you how to install Cygwin and get it to run CCDT now.

2.0 Installing Cygwin

So, first visit the Cygwin download page. Click on the link that says, “Install Cygwin by running setup-x86_64.exe…”: there is also a link to a 32-bit version of Cygwin's setup.exe, but I've not used that and therefore haven't tested it. Stick to the 64-bit version (assuming you are running a 64-bit version of Windows, of course!)

Save the setup-x86_64.exe file somewhere on your Windows' hard drive (I'm going to store it in my Downloads folder for the purposes of what follows). In Windows Explorer, double-click the setup program when it's fully downloaded and confirm you want to run it, if asked. Depending on your Windows version, you may get a pop-up asking if you 'want to allow this app from an unknown publisher to make changes to your device': answer [Yes] if so.

A fairly standard installation wizard then appears:

Click [Next] to start things off. You are first asked where you will source Cygwin's software packages from: if this is your first time running Cygwin, you're going to be pulling everything from the Internet (so a fast Internet connection is very desirable at this point!). That 'from the Internet' option is the default option, so just check it's selected and then click [Next] once more.

Now you are asked where, on your local PC, you want to store all the software packages that Cygwin will download from the Internet. It will suggest a 'C:\Cygwin64' directory by default:

That option is fine to leave as-is, and the other option shown there -to install for all users, rather than just yourself- is probably also fine to leave selected, depending on what sort of computing environment you are using. If you want to stop your 3-year old experimenting in Linux software, maybe a different response would be in order, but… I'm sticking to the defaults you see here!

Next, you're asked where on your Windows hard drive you want these software packages installed. The default suggestion in this case is probably not such a good idea:

As you can see, it threatens to put everything into your standard Downloads directory. This isn't bad as such -but I tend to use that directory as a temporary holding area for things I will download, install then delete. Cygwin's packages aren't like that: they are what will make Linux software run on your Windows PC and, as such, need to be considered a permanent part of your PC's software 'furniture'. As such, I always change the suggested destination here to something Cygwin-specific, such as C:\cygwin\downloads. When you try clicking [Next] having done that, this happens:

That's the installer realising the altered downloads directory doesn't acutally exist, so it has to ask you if it's OK to create it. Go ahead and tell it to do so.

Now, you told Cygwin earlier to download its software from the Internet. It will now therefore ask you how it should connect to the Internet:

You can probably accept the default option here (to “use system proxy”), because that will either work if you are actually using a proxy server to connect to the Internet, or it will work because you don't use a proxy server at all! Provided your PC is able to connect to the Internet in a browser, say, then the 'System Proxy' option here will work fine for Cygwin's purposes too.

Now Cygwin will fetch a list of 'software mirrors' and offer it to you to select one from as the server you'll use to download the various software packages:

You could scan through this list carefully, if you like, looking for a server that is geographically close to you (to make the software download stage go quickly). Or you can just pick whatever server takes your fancy, if your Internet speeds are fast enough so that you don't need to worry about geographical proximity!

Once a server is selected and you click [Next], a quick download of a catalogue of software will take place and then you'll be presented with this:

This is where you select the Linux software packages you want installed on your Windows PC. There doesn't look like much to select from, but that's because they are all hiding underneath that 'All' item. Click the '+' sign next to that and the list will expand to show multiple software categories or groups:

You could then expand each of those categories in their turn, and so on. Alternatively, if you know what software you want to install, you can simply type its name (or part of the name) in the Search window and see what matches. For example, if I type cdpara, I get this:

…which tells you that there's a package called “cdparanoia” in the “audio” group of software. Currently, it's marked as “skip”, which means it's not going to be installed. Double-click that word 'skip', though, and the word will change to the latest version available… and is then implicitly marked as “will be installed when you tell me to”. Double-click it again for now, to revert it back to “skip”: we want to start the next bit of work with a clean slate!

3.0 Installing Linux Software

To run CCDT, we need the following software prerequisites:

  • xclip
  • xorg
  • flac
  • binutils
  • gcc-core
  • git
  • make
  • mingw64-i686-runtime
  • subversion
  • yasm
  • texi2html
  • diffutils (may already be installed, ignore if so)
  • dos2unix
  • curl
  • wget

So, type each of those in turn into the 'Search' window, expand the categories displayed until you find the correct package and double-click it so that it displays the latest version of the package rather than the word 'skip'. If the word “keep” is displayed for any software package, it means that piece of software has already been installed for some reason, and there's no need to re-install it, so just skip that package.

Here's me selecting xclip, for example:

Notice that we don't want any of the 'debug' or 'devel' type packages; just the xclip package itself. The flac selection is similar:

With those packages selected, click [Next] and you'll see that Cygwin is smart enough to work out that if you want package X, you also need to install packages A, B, C and D as they are the necessary prerequisites for the one package you actually care about! For example:

Remember, too, that this is the first time you've installed any part of Cygwin, so it has to install its 'base' packages if it's to work at all. In any event, you're about to download rather more software than you just selected to install! Click [Next] again when you're ready: the software download will begin:

Be patient: everything depends on the speed of your Internet connection! Eventually, however, all the software will be downloaded and saved on disk, at which point you'll be prompted with this:

I suggest you leave both options checked on for now. Just click [Finish], and you'll see a new program launch icon appear on your desktop. You'll also find a new item in the Start menu, under 'C', for 'Cygwin'. Use either to launch the Cygwin environment.

4.0 Launching the Cygwin Environment

Double-clicking the desktop icon or clicking through the Start menu will eventually cause the Cygwin environment to launch: it will probably be a bit disappointing to look at:

Well, it's a command line environment, after all! You can customise the look-and-feel of it a bit, by clicking on the Cygwin icon in the top-left of the title bar and then selecting 'Options':

You can see I've elected to use the built-in 'Dracula' theme. I've also clicked on the 'Window' item on the left and set my default size to 132 columns and 34 rows: the default 80 x 24 is a bit small for my tastes. Click around and make yourself comfortable with your new Cygwin environment!

To illustrate how transparent it is, type the following commands:

cd /cygdrive/c
ls

You should see output similar to this:

$ ls
'$GetCurrent'    cygwin                    Intel           'Program Files (x86)'  'System Volume Information'
'$Recycle.Bin'   cygwin64                  pagefile.sys     ProgramData            Users
 bootmgr        'Documents and Settings'   PerfLogs         Recovery               Windows
 BOOTNXT         hiberfil.sys             'Program Files'   swapfile.sys           Windows10Upgrade

Does any of that look familiar? How about opening Windows Explorer and pointing it at your C: drive:

Notice how all the directories Explorer knows about were the ones listed by the Cygwin 'ls' command. Sure, Cygwin shows some 'weird' entries such as '$Recyle.Bin' which Explorer doesn't display usually, but all the main suspects are listed by both: 'Program Files', 'Windows10Upgrade' and so on. In other words, the environments are actually the same: what exists on Windows is visible to Cygwin. The reverse is also true. Try this, back in Cygwin:

cd
touch testfile.txt

Those are commands to 'go to my Cygwin home directory' and to create an empty text file, called “testfile.txt”. We can check the file exists in Cygwin:

$ ls -l
total 0
-rw-r--r-- 1 hjr None 0 Aug  8 18:51 testfile.txt

Can we see this new file in Windows? Sure -but it's not exactly where you think it is! In Cygwin, you can check where the file is said to exist:

$ pwd
/home/hjr

That 'prints the working directory' and shows Cygwin thinks we're in “/home/hjr” -a very Linux-y home folder name! But physically, as far as Windows is concerned, that maps to the download directory you selected during the Cygwin installation process. In my case, I said to store things in C:\Cygwin64… so let's check that in Explorer:

And sure enough, Windows can see the “testfile.txt” file perfectly fine. It also shows a bunch of hidden files which you don't ordinarily see when 'ls-ing' in Linux, but they're there in Cygwin's /home/hjr directory too:

$ ls -la
total 25
drwxr-xr-x+ 1 hjr None    0 Aug  8 18:51 .
drwxrwxrwt+ 1 hjr None    0 Aug  8 18:17 ..
-rwxr-xr-x  1 hjr None 1494 Aug  8 18:13 .bash_profile
-rwxr-xr-x  1 hjr None 5645 Aug  8 18:13 .bashrc
-rwxr-xr-x  1 hjr None 1919 Aug  8 18:13 .inputrc
-rw-r--r--  1 hjr None   90 Aug  8 18:46 .minttyrc
-rwxr-xr-x  1 hjr None 1236 Aug  8 18:13 .profile
-rw-r--r--  1 hjr None    0 Aug  8 18:51 testfile.txt

From this, we learn that c:\cygwin64 is regarded by Cygwin as / -the Linux-y root directory. Thus what Cygwin thinks is /home/hjr is physically found on the Windows side of things as c:\cygwin64\home\hjr. Put another way: any directory you think exists in Cygwin actually physically exists on the Windows box with “C:\cygwin64” pre-pended to it.

So now our path to using CCDT is clear: we download the file from this website in the usual way. We then move it to somewhere like c:\cygwin64\bin (which is therefore /bin to Cygwin). If we got all the pre-requisites right, the script should just run… so let's check if that's true!

5.0 Running CCDT

Stepping through that in some detail, then. First, click this link to download CCDT to your Windows PC in the usual way. Store it where you usually store your downloads -which, generally, seems to mean your Downloads folder. Remember that, on Windows, that folder is actually c:\users\<your username>\Downloads.

Now, in your Cygwin environment (that is, within the terminal window that you saw earlier that displays the Cygwin logo in its top-left corner), issue this sequence of commands, one-by-one:

cd /bin
cp /cygdrive/c/Users/hjr/Downloads/ccdt.sh .
chmod +x ccdt.sh
ln -s ccdt.sh ccdt

The first command positions us within the Cygwin /bin directory (where all executables are generally stored in Unix-y environments!). The second command copies the ccdt.sh script from the Windows Download directory where we originally stored it to our current location -i.e, the /bin directory itself. Since /bin is in the PATH for all Cygwin users, we'll be able to run it by merely typing its name: we won't need to type its full path too.

The third command is all-important: it makes the ccdt.sh shell script executable (i.e., capable of being run as a proper program).

The fourth and final command is a bit optional, but I'd strongly recommend it. The command creates a 'symbolic link' between the real ccdt.sh file and the name 'ccdt'. A symbolic link is basically a shortcut or alias: you type the one and you get the results of typing the other. In this case, the command makes it possible to invoke the ccdt.sh script by merely typing 'ccdt', without the “.sh” alias. I find it a more natural way of invoking a program -and, in any case, it saves you three keypresses every time you run the program, so it's worth it in my book!

Now, all we need are some flac music files for CCDT to process! Let's say you have ripped a CD and created some flac files using a Windows tool (such as Exact Audio Copy or dBpoweramp). Let's further assume that you've stored the resulting flac files in your Windows Music directory. The task therefore becomes: how do we run ccdt within Cygwin whilst processing files which are stored on the C: drive, outside of Cygwin's root folder?

It's quite easy. Just type this in your Cygwin command prompt window:

cd /cygdrive/c/Users/<your username>/Music

The /cygdrive/c bit tells Cygwin that you need to travel outside of its own root folder onto the 'real' Windows hard drive. If you had a D: drive or even an M: drive, you could equally well type “cd /cygdrive/d” or “cd /cygdrive/m”, for example

Once you are sitting in your Music directory, you can list the contents, to make sure there are some flac files there (otherwise CCDT itself will throw an error at you):

ls

Once you confirm you are sitting in a directory full of flacs, you can then launch CCDT with the command (assuming you created the 'ccdt' symbolic link earlier):

ccdt

Here's me doing all of that. My username is “hjr”, so my Windows Music directory is found at cygdrive/c/Users/hjr/Music:

Finally, I can launch ccdt:

You'll find that CCDT now runs almost exactly as it would on a native Linux operating system. There's just one exception: in Option 2, when you specify the name of the composition, you would expect, on a Linux PC, to be able to press Ctrl+Shift+V to paste in the current directory name as the composition name. This functionality doesn't (yet) work on the Windows+Cygwin version. However, the name of the directory is still correctly displayed in the header area of the screen, so you can still use your mouse to manually highlight that, right-click and copy, then right-click and paste. The equivalent functionality still exists, therefore, though it's not quite as convenient as it is with the Ctrl+Shift+V shortcut.

Anyway: apart from that one small glitch (which I'll try to get fixed ASAP), you can now run CCDT on Windows to tag up your audio files to the same high standard as you can on Linux.

wiki/software/winccdtlong.1566664259.txt.gz · Last modified: 2019/08/24 16:30 by dizwell