Difference between revisions of "Building On Windows"

From Audacity Wiki
Jump to: navigation, search
(Update for running wxwidgets samples.)
m (+deprecated)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{deprecated|https://github.com/audacity/audacity/blob/master/BUILDING.md}}
 
{{ednote|1=[[ToDo-2]] Add
 
{{ednote|1=[[ToDo-2]] Add
 
* Instructions for building modules
 
* Instructions for building modules
 
}}
 
}}
  
{{ednote|'''Peter 07Jul10''' - [[ToDo-1]] user Nick Gawronski [email protected]i.com wrote on the devel email list re updating/correcting this page.
 
*Hi, I went to the page https://wiki.audacityteam.org/wiki/Building_On_Windows and found several issues with the building process that should really be fixed on the wiki. 
 
*First, lots of URLS exist that have no links directly to them on the page.  It would be a lot easier if these were normal html links so users could just select the link.  *Second, no components are listed for Microsoft Visual C are mentioned it would be useful if such components that you need to select are listed. Third, when trying to build wxWidgets in the solution file when I tried to build the library no mention is made in the documentation that it requires the windows 8.1 SDK and no directions on how to fix this error on windows 10 pro 64 bits. 
 
**I even built the library using the command line directions but at the end of the build process no output location was given as to where the library compiled files were located. 
 
*Fourth the git clone command does not even point to the proper git location for the audacity sources so copying the command out of the page and pasting it into the command prompt gives me an error. 
 
**Also, Looking on that build page there are directions for mac components on there should those not be moved to their own section and not mixed with the windows components? *Fixing this build page on the wiki would be useful as well as stating if building the library wxWidgets from the command line as talked about in the project's documentation is supported by audacity. 
 
*Adding a command line building option for audacity for those of us who like to build using the command line and a makefile would also be useful or directions on how to generate one from the current files in the audacity sources. 
 
*Can someone please get back to me on this issue as I would like to test out the latest development sources and build the project from source to see if it works well with windows 10 pro 64 bits? 
 
**Including prebuilt binaries of the proper version of wxWidgets would also be useful as the links in that documentation do not work.
 
{{ednote|1=
 
Henric wrote:
 
*If you want to build from the command line, then I would suggest
 
putting the wxWdigets source in lib-src/wxWidgets.  That way the
 
environment variable is not necessary (although, it takes precedence
 
if it exists).  Then build wxWidgets with,
 
    msbuild /m lib-src\wxWidgets\build\msw\wx_vc15.sln "/p:Configuration=DLL Release;Platform=Win32;PlatformToolset=v141" /target:adv,base,core,html,net,qa,wxexpat,wxjpeg,wxpng,wxtiff,wxzlib,xml
 
 
and Audacity with:
 
  msbuild /m win/audacity.sln /p:Configuration=Release;Platform=Win32;PlatformToolset=v141
 
 
Replace v141 with v142 if you have VS2019 installed.
 
 
wxWidgets tries to pick a reasonable SDK, but falls back the
 
(ancient) 8.1 SDK if it doesn't recognize the Visual Studio version
 
(specifying "PlatformToolset=v141" should be enough).  17763 is used
 
by the appveyor build and is the default installed with the latest
 
version of Visual Studio 2017 (see "appveyor.yml" in the Audacity
 
repo's root directory).  The default is set in the root directory's
 
Directory.build.props, but can be overridden from the msbuild
 
command line by setting it with,
 
  /p:WindowsTargetPlatformVersion=10.0.17763.0
 
It is probably a good idea to build both wxWidgets and Audacity with
 
the same Windows SDK.
 
 
And yes, that build page should probably be updated.
 
}}
 
}}
 
  
 
{{Intro|1='''These are instructions for building on Windows'''
 
{{Intro|1='''These are instructions for building on Windows'''
Line 56: Line 20:
 
Instructions for building on Windows.
 
Instructions for building on Windows.
  
Fuller instructions that include  
+
Fuller instructions that include
 +
  * Installing CMake
 
   * Portable Settings
 
   * Portable Settings
 
   * Building an Installer
 
   * Building an Installer
can be found on our wiki at http://wiki.audacityteam.org/wiki/Building_On_Windows
+
can be found on our wiki at  
 +
http://wiki.audacityteam.org/wiki/Building_On_Windows
  
  
1. MSVC 2017: Download and install Microsoft Visual Studio 2017
+
1. MSVC 2019: Download and install Microsoft Visual Studio 2019
  
https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2017
+
  https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16
 +
  be sure to include the Desktop Development with C++ Workflow
 +
  this build was testing using VS 16.8.5
  
 
2. Git: Download and install Git, for example by installing:
 
2. Git: Download and install Git, for example by installing:
Line 71: Line 39:
 
   and optionally GitExtensions: http://gitextensions.github.io/
 
   and optionally GitExtensions: http://gitextensions.github.io/
  
download and run the .msi installer.  GitExtensions has a GUI interface, includes Git for
+
  download and run the .msi installer.  GitExtensions has a GUI interface,  
Windows and has a Git bash command line in the bottom panel of the screen.
+
  includes Git for Windows and has a Git bash command line in the bottom panel  
 +
  of the screen.
  
 
3. Python
 
3. Python
   We currently depend on Python 2.7.18 during the build. We are working on a switch to a Python 3.
+
 
   At the time of writing, Python 2.7.18 must be on your path.
+
   We no longer use Python 2.7.18 during the build. Instead we must use Python 3.
 +
   You can download Python 3.9.1 from https://www.python.org/downloads/windows/
 +
  Select the Python 3.9.1 Windows Installer (32-bit)
  
 
4. wxWidgets:
 
4. wxWidgets:
  
  1) Clone wxWidgets and checkout 3.1.3 from the Audacity fork of the  
+
  a) Clone wxWidgets and checkout 3.1.3 from the Audacity fork of the  
 
     wxWidgets project:  
 
     wxWidgets project:  
 
       https://github.com/audacity/wxWidgets/
 
       https://github.com/audacity/wxWidgets/
  
     for example, in the git-bash command line
+
     for example, in the git-bash command line:
       mkdir ./wxWidgets
+
       mkdir wxWidgets
      cd ./wxWidgets
 
 
       git clone --recurse-submodules https://github.com/audacity/wxWidgets/
 
       git clone --recurse-submodules https://github.com/audacity/wxWidgets/
 
        
 
        
Line 92: Line 62:
 
       git submodule update --init
 
       git submodule update --init
  
  2) Follow instructions for building at  
+
    It is instructive to review but do NOT follow the instructions for  
 +
    building at  
 
     https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/README-GIT.md
 
     https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/README-GIT.md
 
     https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/docs/msw/install.md
 
     https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/docs/msw/install.md
 
+
    We (currently) build the 32 bit DLL version,  
+
b) We (currently) build the 32 bit DLL version,  
 
     and Audacity is built 32 bit too.
 
     and Audacity is built 32 bit too.
  
     Set WXWIN environment variable to the appropriate directory where you installed
+
     Set WXWIN environment variable to the appropriate directory where you  
     wxWidgets. This will tell CMake where to find wxWidgets later.
+
     installed wxWidgets. This will tell CMake where to find wxWidgets later.
 
 
    To set WXWIN, click on Settings (the cogwheel icon from the start menu)
 
    Then in the 'find settings' search box type 'env'.
 
    Choose 'Edit the system environment variables'
 
    Then the 'Environment Variables' button
 
    Then in system variables, for variable and value,  add (for example)   
 
        WXWIN        C:\wxWidgets-3.1.3
 
  
    You will be building a dll version with MSVC2017 IDE, so...
+
      To set WXWIN, click on Settings (the cogwheel icon from the start menu)
 +
      Then in the 'find a setting' search box type 'env'.
 +
      Choose 'Edit the system environment variables'
 +
      Then the 'Environment Variables' button
 +
      Then in system variables, for variable and value, add (for example)   
  
    In MSVC 2017 open wx_vc15.sln, and select dll, release.
+
      WXWIN        C:\aud300\wxWidgets
    Then build.
 
  
  3) Having got this far, it is well worth trying out building some wxWidgets
+
     You will be building a dll version with MSVC2019 IDE, so...
     examples to confirm that building has worked OK.
 
  
    If you do decide to do this,  
+
    In Windows File Manager, right-click on ../wxWidgets/build/msw/wx_vc16.sln,
 +
    Select Visual Studio 2019.
 +
    In the solutions configurations drop-down list, change "Debug" to
 +
      "DLL Release",
 +
    Then select Build > Build Solution.
 +
 +
  When the build completes, you will get a message such as:
 +
  ========= Build: 24 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  
    $ copy  %WXWIN%\include\msvc\wx\setup.h %WXWIN%\include\wx\
+
    Close Visual Studio.
  
     This means that the examples will see setup.h, which they need.
+
     You can check this worked also by looking in C:\aud300\wxWidgets\lib\vc_dll
 +
    There should be dll files there with _'ud' in their name.  
 +
    The ud stands for 'unicode debug'.  If you only have files with 'u' then
 +
    you only have release.
  
    To run the samples, if you don't put the dll libs on your path, you'll
 
    need to copy the .exe file to the directory where the .dll files are
 
    ( %WXWIN%\lib\vcc_dll\ ).
 
 
    Alternatively there is a 'working directory' setting in
 
    properties->configuration-properties->debugging, 
 
    and you can set that to the dll release or debug directory.
 
  
 
5. Audacity
 
5. Audacity
  
1) Clone Audacity from the Audacity GitHub project.
+
  a) Clone Audacity from the Audacity GitHub project.
 
       https://github.com/audacity/audacity/
 
       https://github.com/audacity/audacity/
  
 
     for example, in the git-bash command line
 
     for example, in the git-bash command line
       mkdir ./audacity
+
       mkdir audacity
      cd ./audacity
 
 
       git clone https://github.com/audacity/audacity/
 
       git clone https://github.com/audacity/audacity/
  
    Audacity itself does not use/need git submodules.
+
  b) Open the CMake GUI
 +
 
 +
    Open VS 2019 > "continue without code" > File > Open > CMake
 +
    Open CMakeLists.txt in root of audacity source folder you cloned
  
 +
    Wait for the CMake Overview Pages tab to appear (be patient)
 +
  Click "Open the CMake Settings Editor" in this new tab
 +
  Scroll up to the top of the window and settings
 +
  In the Configurations window, click the green "+", then select x86-Release
 +
  Set Configuration type: Release
  
2) Open the CMake GUI.
+
  Verify Toolset: msvc_86
    Set the 'Where is the source code' location to where your copy of the git repo is.
+
  Keep Build Root: ${projectDir}\out\build\${name} (default, you can
     Set the 'Where to build the binaries' to where you want the results.
+
     change it) (this corresponds to CMAKE_BINARY_DIR)
  
    Click on configure.
+
    Click on "Show advanced settings" (scroll down).
    (notice where it found / did not find wxWidgets if it did not find wxwidgets check
+
  Change CMake generator: VS 16 2019 (was Ninja)
    that you set WXWIN coreectly )
+
  Click "Save and Generate CMake cache to load variables" once, then
 +
  Click "Save and Generate CMake cache to load variables" a second time
 +
    or select Project > Generate CMake Cache
 +
 +
  c) Switch to the Ouput tab
  
3) Click on Generate.
+
    Wait for "CMake generation finished".
 +
  Check the Error List window:
 +
    you should have 0 Errors and 0 Warnings.
 +
 +
  d) Return to the CMakeSettings.json window
 +
      Review CMake variables and cache
 +
  Note that:
  
4) Click on Open Project.
+
  wxWidgets_LIB_DIR > 'C:/aud300/wxWidgets/lib/vc_dll' (your path
 +
      may be slightly different)
 +
    wxWidgets_ROOT_DIR > 'C:/aud300/wxWidgets' (your path
 +
      may be slightly different)
 +
     
  
    From here on you should be able to use the project.
+
  e) Build
  
  5)
+
      Select Build > Build All
    Choose Release or Debug.
+
      Click on the Output tab and wait for the message "Build All succeeded"
    Click compile.
+
    Check the Error List tab. There should be 0 Errors and 17 Warnings.
 +
      Check the output directory indicated in step 6 to find
 +
        `../bin/Release/Audacity.exe`
  
 
</pre>
 
</pre>
Line 168: Line 160:
 
{{note|1=These instructions for variations on building aren't in win/build.txt in the Git repo.}}
 
{{note|1=These instructions for variations on building aren't in win/build.txt in the Git repo.}}
  
===Defaulting to Portable Settings===
 
 
<pre>
 
UH?  These instructions are for Mac.
 
1. Within audacity.app/Contents add the directories:
 
    Portable Settings
 
    Portable Settings/AutoSave
 
 
2. Set permissions on these two directories to 777
 
    chmod 777 "Portable Settings"
 
    chmod 777 "Portable Settings/AutoSave"
 
</pre>
 
  
  
===Optional Features===
+
===Official Full Releases===
 
 
<pre>
 
Some functionality in Audacity is currently turned on in its default
 
configuration, but requires that extra libraries be downloaded
 
separately to use it.
 
 
 
To change the libraries enabled in Audacity, edit 
 
"win\configwin.h" and comment or uncomment the entries.
 
 
 
You might also try modifying the features enabled in
 
"src\experiemntal.h"
 
</pre>
 
 
 
 
 
===Supporting ASIO===
 
 
 
<pre>
 
ASIO (from Steinberg) is a sound card interface protocol that is faster
 
than standard WMME. Unlike WMME, not all soundcard drivers support it.
 
 
 
Because ASIO is a proprietary, closed standard, we (or any third party)
 
cannot distribute its SDK. That means we cannot distribute builds of
 
Audacity that support ASIO, because Audacity is licensed under the GPL
 
(http://audacityteam.org/about/license), which requires we
 
distribute all source code.
 
 
 
So, although you can build your own copies of Audacity with
 
ASIO support, for personal use, you cannot distribute them without
 
violating the Audacity license and the ASIO license.
 
If you build ASIO support into Audacity, do not distribute that build.
 
 
 
For ASIO support, get the ASIO SDK from Steinberg
 
(http://www.steinberg.net/en/company/developers.html),
 
install at C:\ASIOSDK, then define an environment variable called
 
ASIOSDK_DIR.
 
 
 
The value should be the full path to the base directory of the
 
ASIO SDK, e.g.,
 
 
 
  set ASIOSDK_DIR=C:\ASIOSDK
 
 
 
</pre>
 
 
 
==Official Full Releases==
 
  
 
Official full releases:
 
Official full releases:
Line 238: Line 174:
 
* Are signed.
 
* Are signed.
  
===Updating GitIdent===
 
  
<pre>
 
The Audacity "About" box can contain a link to the git commit at which
 
Audacity was built. To create this, run this batch script in /mac/scripts/
 
using the git-bash command  line
 
 
  bash get_gitident.sh
 
 
If you do this, you are responsible for making sure the ident is correct
 
in future builds.  The script overwrites RevisionIdent.h in the src directory.
 
If you make further changes to your local copy after this step, or merge a
 
more recent version from git, this file, and hence the ident in the build,
 
stays the same, and so would be misleading.
 
 
To reset RevisionIdent.h you could do:
 
 
  git reset --hard origin/master
 
</pre>
 
 
 
===Fetching The Manual===
 
===Fetching The Manual===
  
 
We have [[Building The Manual|instructions for fetching the manual]] on another page.
 
We have [[Building The Manual|instructions for fetching the manual]] on another page.
  
 
===Preparing Languages===
 
 
{{note|1=In the MSVC project languages are not built by default, so be careful you are not using an out of date version of the translations for release.}}
 
 
<pre>
 
  1.  In the MSVC project, click on 'locale' project and build.
 
</pre>
 
 
 
{{note|1=It looks like this step is historic and no longer needs to be done.}}
 
 
<pre>
 
1. Open the "gl_ES", "ko_KR" and "pt" folders in turn and move the "wxstd.mo" file
 
    in each to the "gl", "ko" and pt_PT folders respectively.
 
2. Delete the "gl_ES", ko_KR and "pt" folders.
 
3. COPY (do not move) wxstd.mo from "eu" into "eu_ES".
 
</pre>
 
  
 
===Building the Installer===
 
===Building the Installer===

Latest revision as of 11:52, 19 August 2021

Warning icon This page has been deprecated. Newer information can be found here: https://github.com/audacity/audacity/blob/master/BUILDING.md
The information on this page are likely out-of-date and will not be updated in the forseeable future. It may be removed at any time.
ToDo-2 Add
  • Instructions for building modules


These are instructions for building on Windows

The build family of pages:

Instructions in win/build.txt

These instructions for building on Windows are in win/build.txt in the Git repo.
Instructions for building on Windows.

Fuller instructions that include
   * Installing CMake 
   * Portable Settings
   * Building an Installer
can be found on our wiki at 
http://wiki.audacityteam.org/wiki/Building_On_Windows


1. MSVC 2019: Download and install Microsoft Visual Studio 2019

  https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16
  be sure to include the Desktop Development with C++ Workflow
  this build was testing using VS 16.8.5

2. Git: Download and install Git, for example by installing:

  Git for Windows: https://git-scm.com/download/win
  and optionally GitExtensions: http://gitextensions.github.io/

  download and run the .msi installer.  GitExtensions has a GUI interface, 
  includes Git for Windows and has a Git bash command line in the bottom panel 
  of the screen.

3. Python

  We no longer use Python 2.7.18 during the build. Instead we must use Python 3.
  You can download Python 3.9.1 from https://www.python.org/downloads/windows/
  Select the Python 3.9.1 Windows Installer (32-bit)

4. wxWidgets:

 a) Clone wxWidgets and checkout 3.1.3 from the Audacity fork of the 
    wxWidgets project: 
       https://github.com/audacity/wxWidgets/

    for example, in the git-bash command line:
      mkdir wxWidgets
      git clone --recurse-submodules https://github.com/audacity/wxWidgets/
      
    IF you forgot the --recurse-submodules, you can correct that later by:
      git submodule update --init

    It is instructive to review but do NOT follow the instructions for 
    building at 
    https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/README-GIT.md
    https://github.com/audacity/wxWidgets/blob/audacity-fixes-3.1.3/docs/msw/install.md
 
 b) We (currently) build the 32 bit DLL version, 
    and Audacity is built 32 bit too.

    Set WXWIN environment variable to the appropriate directory where you 
    installed wxWidgets. This will tell CMake where to find wxWidgets later.

      To set WXWIN, click on Settings (the cogwheel icon from the start menu)
      Then in the 'find a setting' search box type 'env'.
      Choose 'Edit the system environment variables'
      Then the 'Environment Variables' button 
      Then in system variables, for variable and value,  add (for example)     

      WXWIN         C:\aud300\wxWidgets

    You will be building a dll version with MSVC2019 IDE, so...

	    In Windows File Manager, right-click on ../wxWidgets/build/msw/wx_vc16.sln,
	    Select Visual Studio 2019.
	    In the solutions configurations drop-down list, change "Debug" to 
      "DLL Release",
     	Then select Build > Build Solution.
	
	  When the build completes, you will get a message such as:
	  ========= Build: 24 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

	    Close Visual Studio.

    You can check this worked also by looking in C:\aud300\wxWidgets\lib\vc_dll
    There should be dll files there with _'ud' in their name.    
    The ud stands for 'unicode debug'.  If you only have files with 'u' then 
    you only have release.


5. Audacity

  a) Clone Audacity from the Audacity GitHub project.
       https://github.com/audacity/audacity/

    for example, in the git-bash command line
      mkdir audacity
      git clone https://github.com/audacity/audacity/

  b) Open the CMake GUI

     Open VS 2019 > "continue without code" > File > Open > CMake
     Open CMakeLists.txt in root of audacity source folder you cloned

     Wait for the CMake Overview Pages tab to appear (be patient)
	   Click "Open the CMake Settings Editor" in this new tab
	   Scroll up to the top of the window and settings
	   In the Configurations window, click the green "+", then select x86-Release
	   Set Configuration type: Release

	   Verify Toolset: msvc_86
	   Keep Build Root: ${projectDir}\out\build\${name} (default, you can 
     change it) (this corresponds to CMAKE_BINARY_DIR)

     Click on "Show advanced settings" (scroll down).
	   Change CMake generator: VS 16 2019 (was Ninja)
	   Click "Save and Generate CMake cache to load variables" once, then
	   Click "Save and Generate CMake cache to load variables" a second time
	     or select Project > Generate CMake Cache
	 
  c) Switch to the Ouput tab

     Wait for "CMake generation finished".
	   Check the Error List window:
	     you should have 0 Errors and 0 Warnings.
		 
  d) Return to the CMakeSettings.json window
       Review CMake variables and cache
	   Note that:

	   wxWidgets_LIB_DIR > 'C:/aud300/wxWidgets/lib/vc_dll' (your path 
       may be slightly different)
     wxWidgets_ROOT_DIR > 'C:/aud300/wxWidgets' (your path 
       may be slightly different)
       

  e) Build

       Select Build > Build All
       Click on the Output tab and wait for the message "Build All succeeded" 
	     Check the Error List tab.  There should be 0 Errors and 17 Warnings.
       Check the output directory indicated in step 6 to find 
         `../bin/Release/Audacity.exe`

Variations

These instructions for variations on building aren't in win/build.txt in the Git repo.


Official Full Releases

Official full releases:

  • Have a GitIdent, visible in the about box build information, that says what branch was used in building.
  • Come with translations
  • May be as a zip file
    • No manual provided
  • May be as a windows installer.
    • These come with help files in html format.
  • Are signed.


Fetching The Manual

We have instructions for fetching the manual on another page.


Building the Installer

The Inno setup installer requires certain files in certain places to be able to produce the installer.

 1. Copy msvcp140.dll and vcruntime140.dll from 
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.14.26405\x86\Microsoft.VC141.CRT
    to \win\release

    The 64 bit version will not work on 32 bit machines.

Now to actually make the installer...

  1. Install the latest Unicode Inno Setup (http://www.jrsoftware.org/isinfo.php). 
  2. Open the Inno Setup script:
       \win\Inno_Setup_Wizard\audacity.iss
  3. Click 'Compile'.
Bulb icon  
  • If installing on Windows 8 or 10, you will need to set permissions on the C:\Program Files (x86)\Inno Setup 5\Languages\dummy directory to allow .isl files to be written there.
  • You will also need to obtain the 'unofficial' .isl files yourself and place them in C:\Program Files (x86)\Inno Setup 5\Languages\unofficial. They aren't installed by Inno setup, but you can obtain them from GitHub.

Making the Zip File

Do this step after making and testing the installer.

  Having installed from the installer

  1. Use 7-zip to create a new archive from the installed files excluding:
    - The manual
    - The unins* files
    - FirstTimeInit.txt

Note that the .exe in this zip file and dlls are not code signed. Audacity loads dlls dynamically at run time, possibly unsigned ones, so signing the exe itself is misleading for security. The integrity and security of the zip file is provided by its published checksukm. The situation is different for the installer where the code signature protects the entire bundle.


Signing the Installer

More detailed information on obtaining and verifying the cert is available at Codesigning On Windows

Codesigning uses a USB dongle (smart card reader) and a timestamp server at certum:

signtool sign /n "James Crook" /t http://time.certum.pl/ /fd sha256 /v <path-to-audacity-git>\win\Output\audacity-win-2.3.0.exe

If you don;t have the path to signtool.exe pre set, you might find it here:

C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe
Bulb icon To test the signing, upload the installer to dropbox and then download it again. Then double-click to open. When you launch Audacity, you now get a warning about having downloaded from the internet, with the identity of the signing key shown.