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

From Audacity Wiki
Jump to: navigation, search
Line 4: Line 4:
 
* 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 Visual Studio 2015.}}
 
* 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 Visual Studio 2015.}}
  
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.
 
  
You should also note, if you intend following this path, that I have the latest version of wxWidgets wxWidgets-3.0.1 compiled as well using Visualstudio 2015 - using the GUI/IDE. Not the command line. It pretty much compiles straight out of the box.
+
==Introduction==
 +
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.0''' 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 VC15. Don’t ask, I don’t know…
 +
 +
Open VisualStudio2015, 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.
 
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.
 
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.
Line 41: Line 91:
 
'''Note please. NB: Sunday 17th April 2016'''
 
'''Note please. NB: Sunday 17th April 2016'''
  
I am doing this in two places - a masochist at heart - in that I have a git clone of the standard normally available to everyone from the front developers pages.
+
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.
 
:https://github.org/Audacity/Audacity
 
:https://github.org/Audacity/Audacity
This is the one I talk about first. The one done so far.
+
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 one done by one of the developers. ''''''Henricj''''''.  and available here. https://github.com/henricj/audacity Note that's henri CJ <-
 
The second one I talk about is one done by one of the developers. ''''''Henricj''''''.  and available here. https://github.com/henricj/audacity Note that's henri CJ <-
  
Line 50: Line 102:
 
:[http://forum.audacityteam.org/viewtopic.php?p=303257#p303257] Permalink to forum post by henricj
 
:[http://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 errors 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
  
 
[http://www.chalmers.com.au/audacity/build-1.png] Screenshot of successful build of the Henrcj work.
 
[http://www.chalmers.com.au/audacity/build-1.png] Screenshot of successful build of the Henrcj 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.
 
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.
Line 61: Line 115:
 
'''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.'''
 
'''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 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 production machines.
+
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.
 
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.

Revision as of 12:34, 18 April 2016

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 the snprintf problem 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 Visual Studio 2015.


Introduction

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.0 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 VC15. Don’t ask, I don’t know…

Open VisualStudio2015, 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
  #endif

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.

https://github.org/Audacity/Audacity

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 one done by one of the developers. '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 ...

[1] 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

[2] Screenshot of successful build of the Henrcj 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.