Compiling AudacityCompiling Audacity® on Microsoft Windows™ There might be a few differences in some of the steps depending on your OS (XP, Win7 etc.; 64/32-bit), I will try to specify any significant differences. If you do not have lots of hard drive space you may need to make some choices about what to install. Try to follow these steps in the order given. If at any point you get stuck I would recommend posting a question on the Compiling Audacity forum of the Audacity Board: Compiling Audacity Microsoft Visual C++ 2008 1) Get Microsoft VC++ 2008 (this is the compiler you will need—it is free from Microsoft). You may get the 32-bit version (which will work on 64-bit) here: Microsoft VC++ 2008 Select the plus sign next to "Visual C++ 2008 Express edition with SP1", it will open up. Choose your language, click "FREE DOWNLOAD"; vcsetup.exe will be downloaded automatically by your browser. When the download finishes, open your download folder and double-click the file you just downloaded—it will start the install process (you must remain connected to the internet during the Microsoft install stuff). Install everything, accepting the defaults. You will also need the Microsoft SDK (software development kit). Which version you need depends on your operating system. Look here: Microsoft SDK Overview to get the appropriate version for your system. Be forewarned, this is a lengthy process with numerous reboots! After installing both Microsoft VC++ 2008 and SDK you will need to run Microsoft Windows Update to get everything up-to-date. You might need to reboot then "Check for updates" any number of times until there are no new ones found. Make sure "You receive updates:" is set to "For Windows and other products from Microsoft". wxWidgets 2) Get the 2.8.12 version of wxWidgets (as of 4 December 2011 it is the "currently supported" version for Audacity) from here: wxWidgets 2.8.12 choose the wxMSW installer which will start a download — wxMSW-2.8.12-Setup...when completed (it's the full package so you need not be connected to the internet to run it after it is downloaded) double-click it to install; install everything and accept the defaults. 3) Compile wxWidgets. Hereafter it starts getting complicated! 3a) You will need to set up your WXWIN environmental variable. I will give you the Windows 7 steps — open the Control Panel (if on basic view switch to "all items" view), select System, choose Advanced system settings, choose Environmental Variables, in the top half (User variables) choose New... — a dialog will open. In the top field (name) put WXWIN (use all caps), in the bottom put the exact full path to the folder in which you installed wxWidgets (if you accepted the default it will be: C:\wxWidgets-2.8.12). Click OK (DO NOT use the close window buttons!) on all three of the dialogs and close the control panel. This will need to be done before opening VC++ and may even require a reboot to take full effect. Here is a picture: 3b) Now would be a good time to open the text file: C:\wxWidgets-2.8.12\BuildCVS.txt because you need to do step c): (Copy c:\wxWidgets\include\wx\msw\setup0.h to c:\wxWidgets\include\wx\msw\setup.h), note that setup.h is staying in the same directory as setup0.h, in effect you are just changing the name of setup0.h while keeping a backup. You will need to change two of the #defines later as the default features are not appropriate for Audacity. I know that I said to follow these steps in order but now would be a good time to ignore that! If you continue on following the steps in order you'll eventually need to recompile wxWidgets. This is not necessarily a bad thing – it is good practice! However, if you wish to save yourself a bit of time you may temporarily skip down to step 6a of the Audacity section where it talks about using the custom setup.h file which Audacity supplies. To do this you will have to follow all the steps starting from the beginning of part 3 (Audacity) until you have checked out Audacity. You will then be able to use Audacity's custom setup.h file. After copying in the custom setup.h file continue on from here with step 3c. There is a very rare problem which results in a compiler error which looks like: fatal error C1083: Cannot open include file: 'wx/setup.h': No such file or directory If you get this error read the information at the bottom of the Audacity section: setup.h not found 3c) In folder C:\wxWidgets-2.8.12\docs\msw are two files: "install.txt" and "readme.txt"; it might make sense to read them but if "install.txt" is too confusing just skip it for now. 3d) Build the wxWidget libraries. Open the folder: C:\wxWidgets-2.8.12\build\msw and look for: wx_dll.dsw; it is an MS VC++ 2006 (not 2008) project and will be automatically converted to a VC++ 2008 project by double-clicking on its icon. VC++ 2008 will start, a dialog will open—choose "Yes to all" when asked about converting. After a waiting short time while VC++ converts the solution you will be ready to compile. 4) There are two methods of building everything; one requires a lot of up-front time but allows you to leave the process unattended for long periods of time (my preferred choice); the other is less tedious but requires many small steps. Here is the first process: In VC++ choose "Batch Build..." from the Build menu, a dialog will open: select ALL the items not related to "Universal" (I circled examples in green to select and red to ignore). When you have them all selected choose the Build button. The dialog will close and a LOT of work will be done (it takes 20+/- minutes on my super-fast machine). There will be some error messages —ignore them for now. You might need to re-open the Batch Build dialog quite a few times and keep doing Build (no need to change the checkboxes—they will be remembered) [The following was true for wxWidgets 2.8.11 but may no longer be true for 2.8.12: until you get two identical sets of errors in a row. These will be due to a known bug in the wxWidgets project—four DLLs are installed in lib/vc_lib not lib/vc_dll but it is easy to fix...the easiest way is to copy ALL of C:\wxWidgets-2.8.12\lib\vc_lib to C:\wxWidgets-2.8.12\lib\vc_dll (very quick—select all, but you really only NEED to find the four missing ones and copy them)] until one final pass of Batch Build... Build succeeds and all should be done for wxWidgets. 4a) The other method is to build each solution one-at-a-time; this avoids the tedious (and potentially fraught with danger of selecting a Batch Build choice in error) method above. In VC++'s Solution field choose Debug: Now, from the Build menu choose Build Solution—it should compile with no errors [but at some point you might run into the missing library problems as noted above—just keep copying them from vc_lib to vc_dll as needed]. When the Debug solution compiles successfully compile the following solutions, it is critical to do these in the following EXACT ORDER: Debug (you just did this one) Release Unicode Debug Unicode Release DLL Debug DLL Release DLL Unicode Debug DLL Unicode Release Audacity The next part is obtaining and compiling Audacity. You may first need to install an SVN package and Python™ 2.6 (unless you already have them on your system); you might need to uncompress a .tgz file, if so you will need something like 7Zip. If you want to compile the language localization project you will need msgfmt.exe. 1) Get & install 7-Zip as needed: 7-Zip get the appropriate installer. 2) Get & install Python 2.6 as needed (2.7 or later may not work with all the other tools you are getting). The most recent stable installer is at: Python 2.6 there is a source only 2.6.7 here: Python 2.6.7 which is fine but requires you to compile and install it—not necessary as 2.6 works well enough. After installing Python you will need to add it to your execution path. Follow the steps outlined above for setting the WXWIN environmental variable but in this case you will be setting a System variable (bottom of the Environmental Variables dialog). Scroll down until you see the Path variable, choose it and Edit... it. In the Variable value text field scroll all the way right, add a semi-colon ( ; ) then the full path to your Python install (probably C:\Python26): As before it is critical that you click OK in each dialog! 3) Get & install TortoiseSVN: TortoiseSVN get the appropriate installer—a re-boot may be required even thought it might not say so. 4—optional) This is only needed to build the locale project. Get & install the zipped msgfmt.exe: msgfmt.zip unzip it and put it somewhere in your path—a re-boot may be required; the correct location is not always easy to determine—it must be somewhere in your system path. 5) Get & compile the Audacity SVN HEAD. To do this... 5a) Create a new folder somewhere you have access, c:\Audacity, C:\Users\\Documents, or anywhere on any other drive—all should work but c:\Audacity might not depending on access permissions. 5b) Right-click that new folder – a context menu will pop up and one of the entries will be "SVN Checkout " – select it. A dialog will appear; in the topmost text field (URL of Repository:) enter this URL: http://audacity.googlecode.com/svn/audacity-src/trunk the next text field (Checkout directory:) should already have the location of the folder on which you right-clicked. Make sure that "Multiple, independent working copies" is NOT checked; "Checkout Depth" is set to "Fully recursive"; and Revision is set to HEAD – click OK. A transfer progress dialog will open, go grab a serving of your favorite beverage – this will take about five minutes. 6) After the dialog automatically closes it is time to do some housekeeping chores. 6a) Look in the folder into which you checked out Audacity, you will find a file called README – open it with your favorite text editor and at least give it a cursory glance. For Windows follow the instructions found in compile.txt in the "win\" subdirectory. If you skip down to the section "STEP two: Build wxWidgets" you will find the following text: 2. If you want to use the accessibility features, we have modified one of the wxWidgets files. Rather than provide a patch, we store any modified files in the Audacity code repository, and you can replace the corresponding wxWidgets files. In "audacity\win\wxWidgets_additions" is one .h file. You may want to make backups of the wxWidgets original of it, in case you also build without these accessibility features. * Copy setup.h to "C:\wxWidgets-2.8.12\include\wx\msw\". Audacity releases are built with these accessibility features. Now to make your life miserable, it is time to recompile wxWidgets unless you jumped ahead and moved this custom setup.h file as I mentioned in step 3b previously, or do not need the accessibility functions. This custom setup.h file also forces wxWidgets to use a custom database library. I have never used this custom setup.h file so have never compiled in the custom database library and I've never had any problems using my personal builds of Audacity. It is my belief that compiling in this custom database library is unnecessary but it certainly hurts nothing. Recompile all of the wxWidgets Solutions just as you did in step 4. 6b) Open the location of the folder in which you just checked out Audacity (not the folder into which you actually checked out Audacity); create a new folder and call it "wxLibs" or anything else which suits you (this will be your wxWidgets working libraries); open that new folder, and within it create a new folder "Unicode Release" (it must be exactly that). Now open your wxWidgets DLL library ( C:\wxWidgets-2.8.12\lib\vc_dll ) and copy the following five files into that newly created wxLibs\Unicode Release (or whatever you called it) folder: wxbase28u_net_vc_custom.dll wxbase28u_vc_custom.dll wxmsw28u_adv_vc_custom.dll wxmsw28u_core_vc_custom.dll wxmsw28u_html_vc_custom.dll (The above libraries will be used in compiling Unicode Release Audacity. If you wish to learn how to debug then you will also need to get a little bit fancier with your housekeeping. Instead of just having the single folder, you will end up with three new folders — wxLibs, and two new folders within it: "Unicode Release" and "Unicode Debug". In this case the above listed five libraries will end up in the Unicode Release folder and these libraries will end up in the Unicode Debug folder: wxbase28ud_net_vc_custom.dll wxbase28ud_vc_custom.dll wxmsw28ud_adv_vc_custom.dll wxmsw28ud_core_vc_custom.dll wxmsw28ud_html_vc_custom.dll You will note that these filenames are almost identical – the only difference is: ...28u_... becomes ...28ud_...). 7) It is now time to compile Audacity; from here on out I am going to make an assumption that you created a folder called D:\Audacity and D:\wxLibs when I refer to specific directory locations (you will need to modify the exact path to suit where you put your Audacity checkout and your wxWidgets working libraries). In Windows Explorer open the folder D:\Audacity\win; in another Windows Explore open the folder D:\wxLibs and select the folder(s) – not the actual DLLs themselves – you just filled with the DLLs (Unicode Release and Unicode Debug if you have it); right-click and drag them into the D:\Audacity\win folder, choose to "Copy here" – make sure you do not choose any of the other options! 8) Within that D:\Audacity\win folder you will see a file called audacity.sln double-click on that file to launch VC++ 2008; after a few seconds you will be ready to start compiling. You must change the solution because Audacity defaults to a Debug solution which is outmoded. At this point I have no idea what the toolbars on a default install of VC++ 2008 looks like so if you don't see anything on your toolbar that looks like the picture below, you will need to choose "Configuration Manager " from the Build menu – in the top left corner you see a drop down where you will be able to change the solution – choose the Unicode Release solution and then click Close. 9) The time is finally here – go to the Build menu and choose Built Solution. Go put a head on that beverage – this could take some time (more than five minutes on my screaming fast system). If all goes well you will not get any errors and will be able to run your own compiled version of Audacity. If you find yourself getting errors like: fatal error C1083: Cannot open include file: 'wx/setup.h': No such file or directory you're probably suffering from the rare but deadly "setup.h not found" bug. For an extremely detailed explanation of this I recommend that you read this post on the forum: Re: "Setup.h" not found You are going to need to go in and teach each offending solution about the sub-folders it needs to include. The problem is that wx/setup.h does not refer to WXWIN/include/wx/setup.h; it refers to WXWIN/lib/vc_dll/msw*/wx/setup.h (where msw* would be msw, mswd, mswu or mswud depending on the configuration you are building--Release, Debug, Unicode Release or Unicode Debug). The problem is that for some reason WXWIN/lib/vc_dll/msw*/ is not one of the additional dependencies for the various Audacity Projects. Here is the solution: 1) Start the Audacity VC++ solution, set the configuration you wish to build (you will need to do this for all configurations you wish to build) and open the Properties Page for the Audacity solution. 2) Under Configuration Properties choose C/C++ then its Additional Include Directories. 3) Look for $(WXWIN)\lib\vc_dll\msw (for Release), $(WXWIN)\lib\vc_dll\mswd (for Debug), $(WXWIN)\lib\vc_dll\mswu (for Unicode Release), or $(WXWIN)\lib\vc_dll\mswud (for Unicode Debug)--if it is not there you will need to add it. Extending Audacity Due to licensing restrictions, you may NOT copy or distribute builds including ASIO support to any third parties. An ASIO-enabled build is strictly for your own personal (private or commercial) use. In this part I will cover extending Audacity's default capabilities using Steinberg's Asio driver. The first thing you will need to do is obtain the Asio SDK; you will need to get it from the Steinberg website: Steinberg You will be required to register with Steinberg as a third-party developer, about halfway down the page you will see an underlined link in red text "create a new Steinberg 3rd Party Developer account": After creating your developer account go back to the Steinberg main page and login (the login link is located right below the "create a new 3rd Party Developer account" link). After you are logged in, click on ASIO SDK icon (the graphics on the page may not look exactly like this): After carefully reading the licensing agreement click in the box to check that you agree with said agreement. You will now be able to click on the DOWNLOAD ASIO SDK button which will take you to the download page: Click on the ASIO SDK link which will start a download. Unzip the archive and move the resulting folder somewhere you have access, c:\Audacity, C:\Users\\Documents, or anywhere on any other drive—all should work but c:\Audacity might not depending on access permissions. , you will need to set the environmental variable for ASIO. By now you should be familiar with setting environmental variables, the ASIO's name is ASIOSDK_DIR and its value will be the full path of the folder you just created: For an interesting look at the trials and tribulations other folks have had getting Audacity to work on Windows with Asio I recommend reading this forum thread: [Solved] Trouble compiling Audacity from SVN with ASIO You might also need to install Microsoft's DirectX SDK before ASIO will work properly. I'm not entirely clear on this but I have read this online. You'll need to go here: DirectX Software Development Kit and click the DOWNLOAD button; a download will begin which will result in an installer: DXSDK_Jun10.exe. After installing the software development kit you will need to ensure that the environmental variable is set, its name is DXSDK_DIR and the value will be the full path to the folder in which you installed: Again, after setting environmental variables uninstalling these new software development kits, I would strongly recommend that you reboot your system. Open VC++2008 on your Audacity solution and from the Build menu choose Clean Audacity, then from the Build menu choose Build Audacity. This causes Audacity to recreate a lot of it's internal compiling structure and recompile everything with ASIO support. If you ever want to remove ASIO support change the name of the ASIO system variable (so Audacity will not recognize it--you could delete it as well) then open VC++2008 on your Audacity solution and from the Build menu choose Clean Audacity, then from the Build menu choose Build Audacity. This will restore the files without ASIO support. Depending on which version of Visual C++ you are using you might need to add additional linker dependencies for ASIO. Details for this may be found in the forum post: Re: "Setup.h" not found