Compiling CC65 suite and Lynx libraries

Here is a quick guide to reproduce the steps needed to compile the CC65 assembler, compiler and linker suite, plus the corresponding console specific libraries.


The first step is to compile the C++ sources to create the tooling in the CC65 suite. This consists of the assembler ca65.exe, compiler cc65.exe and the cl65.exe plus additional executables. You can find important documentation at the CC65 website.

We will start by creating a clone of the Github repository for the CC65 source code. The base of the CC65 repository can be found at The documentation, wiki and mailarchive is located there. We need the source code at You can use command-line tooling to create the clone, but I will show this using Visual Studio 2013 Community Edition that is available as a free download from the Microsoft website.

Start VS2013 and go to the Team Explorer tab. Click Connect at the top and choose Clone under Local Git Repositories.


Fill in the https clone URL: and initiate the clone by clicking the Clone button.

image image

The cc65 repository is shown with the red icon. Double-click it and the view changes to this particular repo. You can see the cc65.sln solution file. Open the solution by double-clicking it and watch while it opens.

image image

Once the solution is loaded you can build it by simply pressing Ctrl+Shift+B or choose Build Solution from the Build menu.


After that you will have a clean build of CC65 using the latest CC65 sources in the bin folder.


Lynx libraries

The next step is to compile the console specific .lib libraries that you need to create images (or roms) for your console. In my case, that is the Lynx, but the steps are similar for the others.

The sources for the libraries are located under cc65\libsrc. There are subdirectories there for each of the consoles. At the location there is also a Makefile. We need to have the make.exe tool to compile these sources. For that I used MinGW, because the Unix Utilities does not have a modern enough version of make.exe.

MinGW is a “minimalist development environment for native Windows applications”. It has a lot of . The automated installer is a very handy setup program for the command-line challenged like myself. Download and run the setup from here.

image imageimage

You can select whatever package you think you need, but at a minimum you want the msys-base package. That contains the make.exe tool we need.


Click the checkbox and choose ‘Mark for Installation’. Select the Installation menu and click Apply Changes.

image image

When all packages are applied succesfully, you can click Close and dismiss the dialog.


With a default installation location at C:\MinGW the make.exe tool will be under C:\MinGW\msys\1.0\bin. Open a Command Prompt windows at the libsrc folder. Add the bin folder to your PATH environment variable, so you can just type make.exe.

SET PATH=C:\MinGW\msys\1.0\bin;%PATH%

Run the following command from the prompt:


and magic should happen. It will compile all library sources to .lib files, including our lynx.lib. Depending on the speed of your computer this might take somewhere from 1 to 15 minutes to compile.

image image

Look in the cc65\lib folder and find the freshly compiled libraries all there, including lynx.lib.

Final thoughts

Why is this useful? With these instructions you can reproduce creating the tools you need to program Atari Lynx. But it also allows you the sources and recompile the CC65 library for your favorite console. For example, if you want to slim down the lynx.lib and leave out unneeded functionality to increase available memory, you need to modify the library and recompile it.

This entry was posted in Tutorial. Bookmark the permalink.

2 Responses to Compiling CC65 suite and Lynx libraries

  1. I was able to build the project however I get the error
    Severity Code Description Project File Line Suppression State
    Warning C4476 ‘fprintf’ : unknown type field character ‘m’ in format specifier ca65 c:\users\rchen\source\repos\cc65\src\ca65\symtab.c 711

    I’m using VS 2017 Community Edition. I’ve set /W0 to turn off warnings and /WX- to ensure warnings are not treated as errors however the object file for symtab.c (ca65) does not appear to be created. Line 711 in symtab.c seems to be the offending line…

    while (S) {
    /* Ignore unused symbols */
    if ((S->Flags & SF_UNUSED) != 0) {
    fprintf (F,
    “%m%-24p %s %s %s %s %s\n”,
    GetSymName (S),
    (S->Flags & SF_DEFINED)? “DEF” : “—“,
    (S->Flags & SF_REFERENCED)? “REF” : “—“,
    (S->Flags & SF_IMPORT)? “IMP” : “—“,
    (S->Flags & SF_EXPORT)? “EXP” : “—“,
    AddrSizeToStr (S->AddrSize));
    /* Next symbol */
    S = S->List;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s