Difference between revisions of "Building Audacity on Visual Studio 2015"

From Audacity Wiki
Jump to: navigation, search
(Try again wxWidgets-3.1.x required for henricj's builds, not explicitly 3.1.0.)
m (Text replace - "http://forum.audacityteam.org" to "https://forum.audacityteam.org")
Line 94: Line 94:
You can begin to see the detail on this Permalink to the post in the forum when Henricj comes up with the goods. Thanks. I love this man ...  
You can begin to see the detail on this Permalink to the post in the forum when Henricj comes up with the goods. Thanks. I love this man ...  
:[http://forum.audacityteam.org/viewtopic.php?p=303257#p303257 Permalink to forum post by henricj]
:[https://forum.audacityteam.org/viewtopic.php?p=303257#p303257 Permalink to forum post by henricj]
This compiles with no errors as it comes. If you alter it - it will break :-) However, there are still 607 Warnings showing for the debug/Win32 build version
This compiles with no errors as it comes. If you alter it - it will break :-) However, there are still 607 Warnings showing for the debug/Win32 build version

Revision as of 12:45, 21 August 2017

Audacity is currently built with Visual Studio 2013 as outlined on Developing On Windows. This page is about experiments getting Audacity to build on VS 2015.
  • Others may like to know that to solve snprintf problems you can right-click over "Audacity" in Solution Explorer > Properties. Then expand "Configuration Properties" and click "General". Set "Platform Toolset" to "Visual Studio 2013 (v120)".
  • Or, apply the changes in the commit "Switch to VS2015 (v140)" at https://github.com/henricj/audacity/commit/dd029b2. Henricj's fork is known working as of 17 April 2016 to build Audacity using wxWidgets 3.1.x (required) and Visual Studio 2015. The changes also permit building native 64-bit builds of Audacity.


On this and other pages, I (User:Rachalmers) will be detailing just what I am doing to try and get Audacity to compile cleanly and successfully on Windows 10 using Visual Studio 2015 and its related SDKs. Please also note, if you intend following this path, that I have the latest version of wxWidgets wxWidgets-3.1.x compiled as well, using Visualstudio 2015. It pretty much compiles straight out of the box. I have compiled only the DLL Debug, and DLL Release builds, as that's all Audacity needs to run. So you have to compile both.

Stage 1

Setting up wxWidgets.

Use GIT to pull in wxWidgets, in the same manner. In my case, E:\wxWidgets-3.1.0

“E:\git clone https://github.com/wxWidgets/wxWidgets wxwidgets-3.1.0"

The current latest version. That works

You are only going to build the DLL files, for 32 and 64 bit versions, and both Release and Debug. You will probably need both if you are going to play.

Now firstly, look for E:\wxWidgets-3.1.0\build\msw\wx_vc14.sln

Don’t worry. VC14 is VisualStudio 2015. Don’t ask, I don’t know…

Open VisualStudio 2015, and select that file and open it.

Stage 2

Setting up Audacity

Use git to install Audacity into a directory that has no spaces in the directory name. Pull it in with git, the easiest way. There are two options. You can clone the repository from Henricj directly, and pretty quickly have a working 32 or 64 bit Audacity. HenriCJ - An Audacity software developer of long standing. Very knowledgeable. In a CMD window, decide where you want to put your source code repos'. I put mine on E drive. Its a spare drive for this purpose.

“E:\git clone https://github.com/henricj/audacity AudacityHenricj"

If you want to work with the generally available Audacity sources on github, use this one, and make the appropriate changes as detailed in the diff files that henricj has kindly put up on his github pages.

“E:\git clone https://github.org/audaqcity/audacity Audacity”

This will put it into a directory ready, called Audacity, right where your cursor is. So if you are on Drive E:\ in this case, you end up with E:\Audacity

ie; E:\Audacity – NOT… E:\My Souces Programs\Audacity You do NOT want to create directories with spaces. Good old Windows still has the occasional problem with such directories.

Read the Audacity Documents. Both on the wiki site, and in the source code directory.

Building Audacity® for Microsoft Windows(R)

But be careful. Some of it is now incorrect. The Audacity and early wxWidget docs ask you to open this file, [wx_dll.dsw] in the wx build part - but it no longer exists in 3.1.0.

Open E:\Audacity\win\audacity.sln

Because you are working with a later version of wxWidgets - I didn't do the patches detailed in the Audacity docs. Instead I commented out the part therein suggested, and avoided that nightmare. The patches are for 3.0 wxWidgets, and probably won't work now.

Stage 3

Building Notes

Audacity Master

However, as at Friday 15th April, 2016, I have the compile down to 21 out of 24 parts building successfully for Audacity. I am also aware of the ability to use an earlier toolset - 2013 - but hey! that's not the point of this exercise. This exercise is to try and bring the whole process up to speed with the latest VS, and run it in either x32 or x64.

Those Solutions not building in my first git pull are

  1. libnyquist
  2. libsndfile
  3. lv2

Their problems are in the main, these types of problems.

  • 22>C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1925): warning C4005: 'snprintf': macro redefinition
  • 22>C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1925): note: command-line arguments: see previous definition of 'snprintf'
  • 22>C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration

I have applied this,

  #if _MSC_VER < 1900
       #define snprintf _snprintf

to everywhere I can find a #define - and it made some little difference.... but the error persists. At the moment, I can't find the culprits.

So as of today, Friday 14th. I have 655 Errors, 558 Warnings. Meaning 21 successful and 3 not.

Note please. NB: Sunday 17th April 2016

I am doing this in two places - in that I have a git clone of the standard normally available to everyone from the front developers pages.


This is the one I talk about first. The one done so far. and a git clone of work done by Henricj.

Audacity Build by HenriCJ

The second one I talk about is done by 'Henricj'. and available here. https://github.com/henricj/audacity Note that's henri CJ <-

You can begin to see the detail on this Permalink to the post in the forum when Henricj comes up with the goods. Thanks. I love this man ...

Permalink to forum post by henricj

This compiles with no errors as it comes. If you alter it - it will break :-) However, there are still 607 Warnings showing for the debug/Win32 build version

Screenshot of successful build of the henricj work.

Continued Development

Now in order to understand what is happening and how to make it happen, I will go through my first git pull, and apply henricj's patches and see what happens. It's the perfect way of completely understanding what is going on.

And regardless, on both, I'm also working my way through the mass of warnings being reported. Some of which are proving difficult to fix. If people want to share in the excitement (sic) then I may yet also pop my first work-in-progress up to github in my own repository.

Monday 18th April. 2016 To build a successful build on VS2015, at the moment you will need Henrycj's git repository. You will also need the wxWidgets-3.1.0 repository. Build wxWidgets first, just building either the x32, or x64 DLL builds. Which ever you wish. You will need those DLLs to be able to run your Audacity. Build Audacity from \win on VS2015, building either the Debug or Release versions - to match your wxWidgets DLL versions. and either x32 or x64 versions. Which ever your preference. Not many machines these days are still x32. Certainly not many audio production machines, if any. In other words, if you are a serious Audiophile - using Audacity, you will almost certainly have an x64 bit machine. You will almost certainly have either Windows 10, or OSX 10.11 (El Capitan) as well. I know lots of people run Linux etc etc , but frankly, I've yet to see such a beast in a production studio. I could be wrong.

... Continued. Monday. 18th April. 1:33pm After some basic testing all builds on VS2015 now work. 32bit, and 64bit, or x32, x64 in both Debug and Release builds work.

This is not to say that they are stable. There are still many, upwards of 600+, warnings in a build. I'll be happier when those warnings disappear or are reduced to a bare minimum.

Latest Developments

Merge with Master. 18/04/16

Out of interest, yesterdays update/merge of henricj's repo to the Master, doesn't yet compile cleanly on VC2015. It's almost there. There are 101 Errors - every single one Error C1189, and found in 4 components. libnyquist, nibnyquist, libsndfile, lv2 and the last error a LINK error in Audacity because it can't find the others. There are 769 Warnings. Some related to C1189, most not. The details of compiling with VS2015 are to be found on henricj's github site.

Removing Warnings in Debug x64

21st April 2016

So long as a binary can be compiled for each of the (windows) platforms, users will be happy. Win-32: Windows 98 up to Windows 10 Win-64: Windows 8 and above I mean there has to be a cut off point somewhere, otherwise programmers are still trying to compile versions for the 6 Windows 98 users left...

Now, I had a look this morning. Pulled a fresh copy from the vs2015 github repo, and built the x64 Debug version. I started at the top of the list of Warnings, and went hunting. It's painstaking, but not difficult. I started by watching for the platform and inserting _int64 where it may work better. It certainly stops the warnings in those 2 sections.

Example. [b]Beginning line 36 in id3tag.h,[/b] for this one. Removed the first warnings. Using a couple of handy defines in case I need them later. (code from Stackexchange)

#typedef unsigned char id3_byte_t;
// Check windows
#if _WIN32 || _WIN64
#if _WIN64
typedef __int64 id3_length_t;
typedef unsigned long id3_length_t;

// Check GCC
#if __GNUC__
#if __x86_64__ || __ppc64__
typedef __int64 id3_length_t;
typedef unsigned long id3_length_t;

//typedef unsigned long id3_length_t;


... and because there are also declarations in the .c files -[b] like as in file.c[/b]

Beginning line 213

/* check for duplication/overlap */
	  // Check windows
#if _WIN32 || _WIN64
#if _WIN64
	  _int64 begin1, end1, begin2, end2;
	  unsigned long begin1, end1, begin2, end2;

	  // Check GCC
#if __GNUC__
#if __x86_64__ || __ppc64__
	  _int64 begin1, end1, begin2, end2;
	  unsigned long begin1, end1, begin2, end2;
    //unsigned long begin1, end1, begin2, end2;

So it looks like working through the .c files may be the big mission for this. I can't see any other way of getting around - globally in a .h file, the problem of declarations in the .c files. Maybe I'm wrong.

GIT Hub Repositories

Double Shuffle

Now this may seem convoluted - but it's the best way for me to track henricj's vs2015 repo, without having to worry about sending my commits upstream to that site.

Here's how I've done it.

I pull down henricj's repo to my PC: Like this

“E:\git clone https://github.com/henricj/audacity AudacityHenricj"

Which creates the E:\AudacityHenricj directory

I can "git pull" into that to keep my local code updated with changes from upstream. It doesn't overwrite my changed files. When I am ready - every day of so - I commit my changes with "git commit -a" I can then send those changes up to MY OWN git hub site at https://github.com/ShanghaiTimes/Audacity2015 - So that site now containes the up to date code from henricj's repo, plus my changes. I push those changes up to my site, from my working repo on my PC with

E:\AudacityHenricj >git push -f http://github.com/ShanghaiTimes/Audacity2015 vs2015:master

Just to ensure that I have a good working backup. You never know.. I have also created a local

E:\Audacity2015 repo with a direct copy of https://github.com/ShanghaiTimes/Audacity2015

So the flow is easy now. henricj github -> my-pc ->ShanghaiTimes github

ShanghaiTimes is my github username, as well as my Twitter account name.

As of today, tracking the Warnings in the DEBUG, x64 version is painstaking - but there are enough warnings there to convince me that if they are removed in the main, Audacity will run a lot better, because some of those Warnings actually amount to serious Errors.

24th April. 2016

I note too, that having that up to date repo on github, should allow me to track the mac changes as well. I'm trying to get it to build using 10.11.4 plus 10.11SDK in XCode.

Current Status

Built with wxWidgets-3.1.0 with both x32 and x64 DLL files built and suitable PATH in place for Audacity to build against.

x64 Release Build. 0 Errors, 613 Warnings
x64 Debug Build. 0 Errors, 797 Warnings
x32 Release Build
x32 Debug Build

  • Rebuild All: 24 succeeded, 0 failed, 0 skipped.
  • Audacity.vcxproj -> E:\AudacityHenricj\win\x64\Release\Audacity.exe ( and .pdb) (Full PDB)
  • Audacity.vcxproj -> E:\AudacityHenricj\win\x64\Debug\Audacity.exe ( and .pdb) (Full PDB)
  • The required wsWidgets *.DLL files are also placed in these respective directories.
For those interested, screen shots of the result with a live Audiobook project.

The About page of Audacity 2.1.3-Alpha. x64 bit build
ACX-Check details for half hour segment, x64 build example
Processing time for x64 ACX-Check on x64 Release build
Some detailed information on the build of x64 Audacity 2.1.3-Alpha