[Solved] Trouble compiling Audacity from SVN with ASIO

Hi, I got very aggravated with this last night after it taking me four days to finally get all the programs, SDKs and other various things together.

I first downloaded Visual Studio 2010 and then after trying to compile and it failing I found it said on the forum that 2010 doesn’t work so I searched for 2008 and finally found it, I left 2010 installed and installed 2008. Hopefully 2010 isn’t still screwing this up even though it isn’t being used. Do you think I should uninstall 2010? Please give your opinion.

Here is some background on my development environment:

  • Win XP SP 3
  • 2.4GHz Celeron
  • 1.5GB RAM
  • Environment Variables:(The guide didn’t say whether they should be “User” or “System” so after failing a couple times I made them “System” variables as well.)
    • User:
      • ASIOSDK_DIR = E:Building_AudacityASIOSDK2
      • WXWIN = E:Building_AudacitywxWidgets-2.8.11
    • System:
      • ASIOSDK_DIR = E:Building_AudacityASIOSDK2
      • WXWIN = E:Building_AudacitywxWidgets-2.8.11
      • DXSDK_DIR = D:Pragram FilesMicrosoft DirectX SDK (June 2010)
      • PATH = (Appended to the end) D:Python27
  • The Audacity source code is located at E:Building_AudacityAudacity SVN
  • I am using revision 10959 as of 3:07 pm EST-5 2-25-2011
  • I am using Visual C++ 2008 Express Edition (Version 9.0.30729.1 SP)
  • I also have C++ 2010 installed but I am not using it.

Starting at the beginning of the compile instructions here is how it goes:

MSVC++ STEP 1: Download wxWidgets

I downloaded wxMSW-2.8.11-Setup.exe and installed it to E:Building_AudacitywxWidgets-2.8.11


MSVC++ STEP 2: Build wxWidgets

I don’t understand why wxWidgets doesn’t come built already but that’s how it is.

  1. I loaded E:Building_AudacitywxWidgets-2.8.11buildmswwx_dll.dsw I now have a file named wx_dll.sln.

  2. I moved the files access.cpp and setup.h from E:Building_AudacityAudacity SVNwinwxWidgets_additions to E:Building_AudacitywxWidgets-2.8.11srcmswoleaccess.cpp and E:Building_AudacitywxWidgets-2.8.11includewxmswsetup.h

  3. This guide does not say how to build projects so you are left to find it yourself. The first time I just did “Build Solution” under the build menu. Later down it says to use “Batch Build…” under the Build menu. So I went to Build->Batch Build…" I selected DLL Debug, DLL Release, DLL Unicode Debug, and DLL Unicode Release for projects: adv, base, core, html, and net. And then I hit “Build” it is now throwing many errors, is this normal?
    The build failed.
    ========== Build: 0 succeeded, 24 failed, 20 up-to-date, 0 skipped ==========

Please read the build log which you can see here as I do not know what the errors mean and there are too many to list here unless I need to.

On previous days I have gone on but today I am not going to because it is not going to work and I am sure this needs to work first.

Please help me out with this, thanks in advance, Ricky.

As to keeping 2010, the answer is “probably not”. It might be OK to keep (but still would not compile Audacity) if 2008 was installed first. Unless you really need 2010 as a development environment I would uninstall it (if you have a system image from just before you started all this I would suggest you revert to it as I had registry problems after uninstalling 2010). Part of the problem seems to be that VC++2008 Express in a bit incompatible with VS2010 because of conflicting libraries and system variables. Also, installing VS2010 hijacks the file associations to it is difficult to open VC++2008 files in VC++2008–they want to open on VS2010.

Until you get wxWidgets & Audacity both compiling rename your ASIO system variable xASIOSDK_DIR so it will not be found; remove the ASIO user variable if you have not done so and do not reimplement it–my experience having it a USER variable was a show stopper. WXWIN may be a USER variable but I would suggest it not being both–why ask for confusion; I have never set it as a system variable but only have one user on my box (Win7 now, previously Vista).

I don’t understand why wxWidgets doesn’t come built already but that’s how it is.

Building wxWidgets is a rite of passage!

The big hurdle is to compile wxWidgets; you must use voodoo magic (i.e. follow the steps exactly as specified paying attention to all the little undocumented ones!

I am going to offer some tips for compiling wxWidgets–hope the forum police do not hate me!

  1. look at this: http://wiki.audacityteam.org/index.php?title=Developing_On_Windows (if you are not using Windows, the links at the very top of this page to other operating systems will be of interest). You will need to follow the instructions for getting wxWidgets and Audacity compiled very carefully and explicitly.

  2. look at this: http://wiki.wxwidgets.org/Microsoft_Visual_C%2B%2B_Guide if the following is not enough!

As with all things digitally logical it is imperative to follow the initial instructions explicitly. Make sure that before you do anything else you do those two file things (setup.h and #define wxUSE_ODBC) and set the environmental variable WXWIN. If you have tried to compile already without following these steps or are having failure to compile problems, completely delete wxWidgets, reinstall it, set the environmental variable, copy setup.h and then do the #define.

WxWidgets – Setup.h not found? Before you try to compile any of wxWidgets you must make sure to follow the directions about copying Setup.h into the appropriate directory for your system! Read the WxWidgets Forum FAQ on this http://wxforum.shadonet.com/viewtopic.php?t=255.

Make sure to choose the proper workspace—there are two vc++ 6 workspaces – wx.dsw and wx_dll.dsw, you absolutely must choose wx_dll to convert into a VC++ 9 Solution (that’s what VC++ and Visual Studio 2008 use). Use your favorite method to open wx_dll in VC++ 2008 Express (or Microsoft Visual Studio 2008). A dialog will open offering you the chance to “convert all” – do so. After the conversion is done and IntelliSense is finished scanning all files (watch the status bar at the extreme lower left corner) close VC++ and say yes to saving the solution. You will now have a Visual Studio Solution—wx_dll.sln, from now on this is what you want to open in VC++.

Open the newly saved solution, use the Configuration Manager (either from the toolbar or from the menu) to first build the Debug configuration. Because the build order is not always set correctly you may have to rebuild any given configuration a few times until you get zero errors. If for some reason after rebuilding 5 times you still are failing to build completely you have a problem, most likely it is with the hierarchy of dependencies (refer to 2 above).

After the Debug solution is built build the other configurations in this EXACT order: Release, Unicode Debug, Unicode Release, DLL Debug, DLL Release, DLL Unicode Debug, DLL Unicode Release. You may safely ignore all the Universal configurations.

Instead of trying to build the entire Sample solution at once, go in and choose a single sample; the last couple of days I have been working on the scroll sample, let’s try that specific one now.

Open the scroll folder and look for scroll.dsp (a VC++ project). Use your favorite method to open it in VC++ 2008 Express (or Microsoft Visual Studio 2008). A dialog will open offering you the chance to “convert all” – do so. After all the conversion is done and IntelliSense is finished scanning all files (watch the status bar at the extreme lower left corner) close VC++ and say yes to saving the solution. You will now have a Visual Studio Solution—scroll.sln, from now on this is what you want to open in VC++. Open it, using the Configuration Manager use Unicode Debug to build a solution—if it runs build a Unicode Release solution, if that runs you are all set to go! If you cannot get to this point get back in touch with me with specific questions and problems.

Now for the Audacity stuff…

Start here: http://wiki.audacityteam.org/index.php?title=Developing_On_Windows

Download and install TortoiseSVN (make sure you get the 64-bit versions if your OS is 64-bit). After you have gotten wxWidgets and Audacity to compile and run but BEFORE you make any changes to the code use Windows Explore to make copies of both of those entire folders. WxWidgets should remain static but you never know you might need to make changes; if you do make the changes in the original folder keep the copy pristine.

On my system I have Audacity SVN HEAD here:
D:\AudacitySVN
after TortoiseSVN is installed on your system, single-right-click that SVN folder to open the context menu; one of the items should be “SVN checkout…”, choose it and a dialog will open:
checkout.jpg
make sure the repository is:

http://audacity.googlecode.com/svn/audacity-src/trunk/

make sure the checkout directory points to where you want the Audacity code to go; make sure depth is Fully recursive; make sure HEAD is checked–click OK. It will take a few minutes.

Getting wxWidgets and Audacity to play nicely together the first time is a chore. If you start out wrong with wxWidgets sometimes you have to delete the entire wxWidgets directory and reinstall it because of the way they use setup.h. Once you have all the wxWidgets libraries built they need to be copied (not moved) into your win folder (mine is at: D:\AudacitySVNwin); the easiest I have found is to store copies in your Audacity folder so you have a structure which looks like:
Directory of D:Audacity
build directories

Directory of D:Audacitybuild directories
ALL wx2.8.11 libs

Directory of D:Audacitybuild directoriesALL wx2.8.11 libs
Debug
Release
Unicode Debug
Unicode Release

Directory of D:Audacitybuild directoriesALL wx2.8.11 libsDebug
205,824 wxbase28d_net_vc_custom.dll
2,038,784 wxbase28d_vc_custom.dll
1,024,512 wxmsw28d_adv_vc_custom.dll
4,643,840 wxmsw28d_core_vc_custom.dll
713,216 wxmsw28d_html_vc_custom.dll

Directory of D:Audacitybuild directoriesALL wx2.8.11 libsRelease
115,712 wxbase28_net_vc_custom.dll
1,093,120 wxbase28_vc_custom.dll
674,816 wxmsw28_adv_vc_custom.dll
2,745,856 wxmsw28_core_vc_custom.dll
468,480 wxmsw28_html_vc_custom.dll

Directory of D:Audacitybuild directoriesALL wx2.8.11 libsUnicode Debug
210,944 wxbase28ud_net_vc_custom.dll
2,173,440 wxbase28ud_vc_custom.dll
1,043,968 wxmsw28ud_adv_vc_custom.dll
4,789,248 wxmsw28ud_core_vc_custom.dll
719,360 wxmsw28ud_html_vc_custom.dll

Directory of D:Audacitybuild directoriesALL wx2.8.11 libsUnicode Release
118,784 wxbase28u_net_vc_custom.dll
1,145,856 wxbase28u_vc_custom.dll
677,888 wxmsw28u_adv_vc_custom.dll
2,761,216 wxmsw28u_core_vc_custom.dll
472,064 wxmsw28u_html_vc_custom.dll

The newer Audacity VC++2008 solutions are all ready to go (no conversion required) so open audacity.sln with VC++2008 (on my system it is at D:\AudacitySVNAudacity.sln). Before you compile Audacity copy all four of the configuration folders (Debug, Release, Unicode Debug & Unicode Release) from D:Audacitybuild directoriesALL wx2.8.11 libs (or wherever you have your storage folder) into the win folder (again, mine is at D:\AudacitySVNwin). For now (22Feb11–as of the last few days the Debug & Release configurations will not build) select one of the Unicode configurations and “Build Audacity” from the Build menu.

Please let me know if you find any errors of omission or commission in these posts!

Now that you have wxWidgets compiled and Audacity compiled and running you may attempt ASIO. Be warned, once you define the ASIO system variable it can be a hassle to go back!

After you download the ASIO SDK you will have a zip file: asiosdk2.2.zip; unzip it and you will have asiosdk2.2/ASIOSDK2, the system variable must point to the ASIOSDK2 folder (on my system I put it at: D:asiosdk2.2ASIOSDK2).

Open VC++2008 on your Audacity solution and from the Build menu choose “Clean Audacity”, then from the Build menu choose “Build Audacity”. This cause 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.

Thanks for the info Edgar I will try your method. I do have a restore point from before starting so I guess I will try that and then reinstall VC++2008, DXSDK, TortoiseSVN, Python and anything else I missed that I need.

A restore point is not a system image. A system image is an exact bitwise compressed copy of your C: drive. Resetting to an older restore point is generally a waste of time and often causes many more problems (IMVHO).

Oh great, well thanks for telling me that, I guess I should undo the system restore and go in with RevoUninstaller and get rid of M$VC++2010 fully. How does that sound?

As with all things digitally logical it is imperative to follow the initial instructions explicitly. Make sure that before you do anything else you do those two file things (setup.h and #define wxUSE_ODBC) and set the environmental variable WXWIN. If you have tried to compile already without following these steps or are having failure to compile problems, completely delete wxWidgets, reinstall it, set the environmental variable, copy setup.h and then do the #define.

Where am I supposed to do this “#define wxUSE_ODBC” none of the guides I have read so far mention anything about it. Excuse me, I take part of that back, the wx install.txt file does list it and says where it is but it does not say it is required for Audacity. However I did some investigating and searched the setup.h file that the Audacity compile.txt says to put into “wxWidgets-2.8.11includewxmsw” and I found:

// Define 1 to use ODBC classes
#define wxUSE_ODBC          1 // Turn it on for Audacity.

So unless I am mistaken the defining has already been done by the Audacity devs and does not need to be done again. Am I right?

Thanks for helping me.

Yes, sounds good. I really suggest you find a tool (I do not recall if XP has one built in) to make system images.

Yes, just make sure that you completely re-compile wxWidgets after making the setup.h change.

Are you having any luck? I have been doing a lot of Audacity hacks (non-Developer supported code tweaks) under Windows (Vista at first, now 7). I also do a bit of bug testing and (very rarely) offer code to the Developers in support of bugs (they are in feature freeze so will not consider my tweaks). This last week I got roped into installing Linux and compiling Audacity & wxWidgets to work on a Linux-specific bug–I feel your pain !

That’s a good idea. I prefer open source and free programs so any recommendations would be appreciated. To anyone reading this, you can recommend software also, Edgar doesn’t have to do all the posting.

I haven’t gotten it to compile once yet and I changed setup.h before trying to compile wxWidgets.

I have not attempted it again yet since the last post because I have so much to do with removing MSVC++2010 first.

Can a windows version of Audacity be compiled on linux? I have Ubuntu and would be willing to use it if it would be easier.

There’s a list of possibilities here: http://www.thefreecountry.com/utilities/backupandimage.shtml

From what I can tell, XP does not have a built-in GUI-based disk imaging program (you might find dd on your install disk and might be able to work with that but…) looking at the link Steve offers I see some reasonable choices. Having no experience with any of them I am not qualified to make a recommendation. Unfortunately, the process of trying one out is fraught with danger–I doubt that creating an image would cause problems but restoring the image (if defective) could be fatal.

If you have time and a spare hard drive I would partition it 60%/40% (XP/backup), install XP (no need to activate), make a bunch of changes to the look & feel–install some software to C: (obviously the imaging softwares you are to test), create some text files and generally make the drive quite different from its initial installed state. Now use a few of the solutions to create images on the backup partition and test. Depending on disk size you may have to delete each image after testing–just quick reformat the backup partition and do one test at a time. To do a good test, after taking the image, make some radical changes to the look & feel and uninstall some of the software. Restore from image and compare the restored drive to your recollection of the state when you took the image.

Back to topic–how are coming compiling?

@Steve: Thanks I’ll check those out.

On Topic: Ok, something must be going screwy here. I removed MSVC++ 2010 and tried again with no success, well, that is to say I had incomplete success. After trying to build the Debug solution I get:
========== Build: 5 succeeded, 15 failed, 0 up-to-date, 0 skipped ==========

The errors are:



Rebuilding the solution multiple times does not help.

Just to make sure there weren’t any ill effects from 2010 carrying over I made a virtual machine and installed Windows XP, VC++2008, wxWidgets-2.8.11, Tortoise-SVN, Python2.7, DirectX SDK (June 2011), Microsoft SQL Server 2008(it was included with VC++2008), Silverlight , and .Net 4. I have a system variable for WXWIN = C:wxWidgets-2.8.11 and on the Path variable I added “;C:Python27”. And I did copy the new setup.h and access.cpp files.

And… I got the same exact results as above. Then I decided to try reverting back to the wx files to see if it would work, first I used Audacity’s setup.h and wx’s access.cpp and it failed, then I swapped them, wx’s setup.h and Audacity’s access.cpp and it worked. So there must be a problem with the version of setup.h that is provided in the Audacity SVN.

I think I may have found the problem, line 1057 of setup.h, the wx version of the file reads:

// instance is running.

The Audacity version reads:

w// instance is running (available only under Win32).

Note the “w” which appears to be incorrect to me.

WOOT! Building the Debug solution worked! :smiley:
========== Build: 15 succeeded, 0 failed, 5 up-to-date, 0 skipped ==========

This was probably the problem all along, now I need to build the other solutions but that will have to wait till tomorrow.

P.S. In case you didn’t notice this was my log for the day.

Well done! You are most likely right. It has been many months since I built wxWidgets. I looked at my copy of setup.h from SVN HEAD which I grabbed yesterday and this stray is in mine as well. I will post a bug immediately.

Perseverance is rewarded by success! Keep us posted on your progress. Be warned that the current SVN HEAD is broken for compiling the (non-Unicode non-Debug) Release solution. the fix is:

The setting that needs to be changes is the “Link Time Code Generation” setting:

  1. Load the Audacity solution into Visual Studio
  2. Switch to the “Release” configuration
  3. Select “Audacity Properties” from the “Project” menu
  4. Expand the “Linker” item on the left
  5. Select the “Optimization” item
  6. Change the “Link Time Code Generation” property to “Default”
  7. Click OK

I do not know why if has not been fixed yet.

Well wxWidgets compiled successfully in all the configurations you previously suggested to build. :smiley:

Unfortunately, Audacity will not compile even after applying the fix you mentioned. I have posted the logs here:

As you probably noticed I did not “Clean” the solution after each compile this time.
Here is part of the release log with most of it truncated to give you an idea of what’s wrong.

------ Build started: Project: filedialog, Configuration: Release Win32 ------
Compiling…
cl : Command line warning D9035 : option ‘Wp64’ has been deprecated and will be removed in a future release
FileDialog.cpp
e:building_audacityaudacity svnlib-srcfiledialogFileDialog.h(24) : fatal error C1083: Cannot open include file: ‘wx/defs.h’: No such file or directory
FileDialogPrivate.cpp
…lib-srcFileDialogwinFileDialogPrivate.cpp(24) : fatal error C1083: Cannot open include file: ‘wx/wxprec.h’: No such file or directory
Build log was saved at “file://e:Building_AudacityAudacity SVNwinProjectsfiledialogReleaseBuildLog.htm”
filedialog - 2 error(s), 1 warning(s)

========== Build: 0 succeeded, 3 failed, 24 up-to-date, 4 skipped ==========

Basically it seems to be looking for “wx/somefile.h” if I knew where it thought the directory “wx” was supposed to be then I could probably fix the problem.

Do you know how to fix this?

Your WXWIN path may not be set up properly. This is often a problem after running Visual Studio (not VC++ Express) then reverting to Express. Look at my environmental variables:
env.jpg
Feel free to post a screen shot of yours!

With fear & trembling you may also examine the Registry entry with regedit (this is not for the uninitiated–if you do not understand the Registry DO NOT EDIT IT! though it is probably safe to search it ):
reg.jpg

Yep, that was the problem, I had checked the variable yesterday but I didn’t notice that the path was wrong.

So I tried to build the release project and everything was going good until near the end where I got this error:

FileNames.cpp
…srcFileNames.cpp(234) : error C2664: ‘GetModuleHandleExA’ : cannot convert parameter 2 from ‘LPCWSTR’ to ‘LPCSTR’
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Audacity - 1 error(s), 0 warning(s)
========== Build: 26 succeeded, 1 failed, 0 up-to-date, 4 skipped ==========
The debug project had the same error
========== Build: 26 succeeded, 1 failed, 0 up-to-date, 4 skipped ==========

Then I built the unicode debug project and it worked! :slight_smile:
========== Build: 5 succeeded, 0 failed, 23 up-to-date, 3 skipped ==========
I went to the exe and it loaded up Audacity just like it should, I didn’t test it except for going to “about Audacity”.

Then I built the unicode release project and it also worked! :slight_smile:
========== Build: 29 succeeded, 0 failed, 0 up-to-date, 2 skipped ==========
I went to the exe and it loaded up Audacity just like it should, I didn’t test it except for going to “about Audacity”.

What is the difference between the unicode and non-unicode versions?

Congratulation!

Recently the (non-Unicode) Debug & Release builds have been broken. If you grab a SVN HEAD today they should build.

The non-Unicode builds are not really supported anymore and as soon as 2.0 releases should become completely extinct. The problem is that Windows98 will not run the Unicode versions and Audacity wishes to release a final stable Release version of 2.0 for Win98.

Have you ever seen a non-English word with letters like these?: [editorial aside–how do you punctuate a question mark and colon]
letters.jpg
If you try to use Unicode characters in a non-Unicode version bad things will happen, especially when you try to save to disk or open a project someone else sends you with Unicode characters. The moral is, on any system except Win98, stick with Unicode to be safe.

Thank you! :slight_smile:

So they published the fix today. I just recompiled the debug project and it worked I also recompiled the release project and it worked.

Ok, so non-English letters require Unicode. And the Unicode release is all-around better.

I suppose I am ready to try to compile with ASIO now. Do I pretty much just need to define the “ASIOSDK_DIR” environment variable and recompile Audacity?

The only think to remember is that once you define the ASIO environmental variable and compile it is cumbersome to go back to standard. To revert, you will need to remove (or rename) the ASIO environmental variable and completely delete the entire Audacity directory into which you first SVNed the trunk. Then re-create the directory and do a new SVN checkout into it and recompile. I do not think there is anything in audacity.cfg (the configuration file) which will impact restoring to standard, but it might be a good idea to at least inspect it for ASIO related entries–if found then delete or initialize (i.e. remove all but the first line) it.

Good luck so far, keep us posted on your ASIO results. Don’t be surprised if you find pitfalls along the way and do not expect wondrous results–YMMV!