Recently, someone contacted me on Reddit about a file I’d provided years ago. Someone had asked for a tool to convert CDI files to ISO. I don’t really remember doing this, but I must have been fed up by sketchy filehoster links so I went and found the source code, built a Windows binary and re-hosted it.
Of course, two or three years later, the link I provided was broken. They wanted to know if I still had the file. I didn’t, but I thought it couldn’t have been to hard to recreate.
Problem 1: Link rot
Apparently I’d grabbed the link to the source plus some info on how it was built from Arch Linux’s AUR, but when I went back to find the pkgbuild, it was gone. Some Googling found another copy of the PKGBUILD. Great! cdirip-0.6.3-mod-v1.zip it is, then.
Problem 2: Build tools
Without spoiling the end of this article too much, the original-ish Makefile can be found at Makefile.win, which shows you it was originally built with Dev-C++ and Mingw32. Given that VS2017 is now free for open source, I could avoid installing more build tools if I could get Visual Studio to build the code for me.
Problem 3: POSIX
Okay, okay, POSIX isn’t the problem here, VS2017 just doesn’t support it.
When I imported the solution and tried to build, I got one error:
cdirip.obj : error LNK2019: unresolved external symbol strcasecmp referenced in function main
I’m not a C or C++ coder and this is where I’d normally give up trying to build something on Windows and reach for a VM, mainly because every other time I’ve seen LNK2019 there’s been 10 or more errors referencing different symbols I’ve never heard of. In this case, cdirip doesn’t rely on any external libraries so I threw that name into Google. 10 or so minutes of looking through incorrect and outdated information later I stumbled across a very angry person on the MSDN forums
One quick define in common.h later the program built and ran correctly. Thanks, angry forum poster!
At this point I sent the file to the Redditor who asked me for it and was pretty much done. However, it didn’t really satisfy me – I’ve never had a C program build that easily in VS2017 and certainly not one that had been abandoned years before.
You can probably stop reading here, or continue on to find out how I spent far, far too much time on this.
If you’re actually looking for a copy of cdirip-mod for Windows, it’s at
Bonus Problem 2: cdirip vs cdirip-mod
In the time before source control was worth billions of dollars, people passed around zip and rar files of dubious origin. cdirip was not one of those projects: it’s still at SourceForge
cdirip-mod seems to be a different story. It seems to have been passed around the Dreamcast emulation scene for a while – updated by someone under the pseudonym ‘fackue’. I went back and created a fork on GitHub of cdirip, then set about adding the -mod patches back in.
Bonus Problem 3: It’s 2018 and I still have to care about line endings
This isn’t very interesting but I ended up having to generate a .patch file from a Git repo, run format-patch and then run the resulting file through
dos2unix to stop Git thinking I’d modified every file in the repo
Bonus Problem 4:
DevOps Automated build and deployment
I’m a big fan of AppVeyor for building software on Windows, mainly because they maintain the VMs for me and I don’t have to worry about having the right build tools installed for whatever I’m working on.
For such a simple Visual Studio project, the configuration is pretty easy, defining Visual Studio 2017 plus the solution name will get you a green build.
I wanted to go a bit further than that so you’ll see some extra stuff around build artifacts. You could publish the artifacts to AppVeyor itself but they’ll be deleted in 6 months on a free account. This brings me to Bonus Problem 5.
Bonus Problem 5: distributing software on Windows sucks
(UWP/Drawbridge is one solution to this, NuGet and Chocolatey is another)
I’m not making any money off this little sidequest and I’ve already spent far too much time on it. If I were to throw the exe up on an S3 bucket it probably wouldn’t cost me much but I don’t like having my credit card attached to things unnecessarily.
Enter BinTray, who offer free hosting of binaries for open source projects. Sweet! I’ve now set up a project for cdirip-mod and added a windows-x64 package.
There are a couple of gotchas here:
The API key I need to publish to BinTray is buried in the profile page, rather than on the same page where I create a project. It’s also account-wide rather than per-project which would make me a little nervous if I was working on big projects (compromise one key, compromise a whole lot of software)
The AppVeyor documentation for BinTray is a bit wonky. It doesn’t seem like you can use organisation accounts, only user accounts and it says ‘AWS key’ where they probably mean API key. I’ve sent a quick-fix pull request to AppVeyor.