The build.txt that is on the repo says you have to use Python 2.7 to build Audacity. But it looks like all python 2 scripts has been updated to python3. Am I right? In that case, the instructions on build.txt might needed to be updated.
Yes you’re correct on both points. Audacity has been updated to Python 3 and the instructions need updating.
The instructions are earmarked for an update.
Here is the proposed complete build.txt (there may be 1 warning “Jack” in Cmake which is OK):
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 (not updated yet)
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 completed, you will get the message:
========= Build: 24 succeeded, 0 failed, 0 up-to-date, 0 skipped ============
Close Visuual Studio.
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)
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`
It worked like a charm! Like we say here on Brazil: It was as simple as life should be
Indeed it gave the warning you mention. Is it something that should be fixed? Or can I just ignore it?
Other thing: I just realised that if I want to debug Audacity using Debug configuration I need to build wxWidgets “DLL Debug” first. It might sounds logic… but for me it wasn’t. So MAYBE it would be nice if the instruction includes something about this.
Good, I think the old instructions are a rite of passage thing. They assume that you’ve done this before a hundred or so times, that you already have a working build, and that you can deal with the new errors as they crop up.
Yes, no need to move setup.h for Windows.
Ignore the warning. It’s just a case conversion issue that I believe is OS dependent. The full PR gets rid of the warning.
Glad to hear that the instructions are working well for you.
Why not work this out then post another pull request ? It might be simple.
How about I writing here what I have in mind and then, if you agree, you can incorporate to your PR? It might be simpler, I don’t know. Again, this is my first time trying to contribute to an open source program…
It added between /**/ what I was thinking. This is just an idea.
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 (not updated yet)
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.
/*************
Additionally, if you want to later debug Audacity, you have to build wxWidgets Debug dll.
==> in the solutions configurations drop-down list, change "DLL Release" to "DLL Debug",
==> then select Build > Build Solution
***************/
When the build completed, you will get the message:
========= Build: 24 succeeded, 0 failed, 0 up-to-date, 0 skipped ============
Close Visual Studio.
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)
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`
/********
f) Build Debug Version
If you want to do further developments on Audacity you will need to build the Debug version
You can use the same instructions above (Steps 'a' to 'e') but changing to this configurations on step 'b':
==> In the Configurations window, click the green "+", then select x86-Debug instead of x86-Release
==> Set Configuration type: Debug instead of Release
Then check the output directory to find the Audacity solution. Probably 'C:/aud300/out/'
**********/
Odd. The instructions worked worked for my installation of Visual Studio 2019 version 16.3.8. Using the same instructions starting with a new Virtualbox Windows 10 installation with the latest Visual Studio 2019 version 16.9.0 did not work with 68 errors. I am a novice Visual Studio user. Not sure what went wrong.
Severity Code Description Project File Line Suppression State
Error C3536 'playbackBufferSize': cannot be used before it is initialized C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 1914
Error C2672 'std::min': no matching overloaded function found C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 1914
Error C2780 '_Ty std::min(std::initializer_list<_Elem>)': expects 1 arguments - 2 provided C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 1914
Error C2784 '_Ty std::min(std::initializer_list<_Elem>,_Pr)': could not deduce template argument for 'std::initializer_list<_Elem>' from 'size_t' C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 1914
Error C2782 'const _Ty &std::min(const _Ty &,const _Ty &) noexcept(<expr>)': template parameter '_Ty' is ambiguous C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 1914
Error C2784 'const _Ty &std::min(const _Ty &,const _Ty &) noexcept(<expr>)': could not deduce template argument for 'const _Ty &' from 'int' C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 1914
Error C2780 'const _Ty &std::min(const _Ty &,const _Ty &,_Pr) noexcept(<expr>)': expects 3 arguments - 2 provided C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 1914
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 2006
Error C3536 'playbackBufferSize': cannot be used before it is initialized C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 2007
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\AudioIO.cpp 3006
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\Dither.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\Dither.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2065 'lrintf': undeclared identifier C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 332
Error C2568 '=': unable to resolve function overload C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 332
Error C2065 'lrintf': undeclared identifier C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 335
Error C2568 '=': unable to resolve function overload C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 335
Error C2065 'lrintf': undeclared identifier C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 339
Error C2568 '=': unable to resolve function overload C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 339
Error C2065 'lrintf': undeclared identifier C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 343
Error C2568 '=': unable to resolve function overload C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 343
Error C2065 'lrintf': undeclared identifier C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 395
Error C2568 '-': unable to resolve function overload C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\Dither.cpp 395
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\Mix.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\Mix.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\TrackPanel.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\TrackPanel.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\WaveTrack.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\WaveTrack.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\WaveTrack.cpp 1634
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\effects\Compressor.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\effects\Compressor.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 364
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 365
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 366
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 367
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 368
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 771
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 772
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Compressor.cpp 775
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\effects\Equalization.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\effects\Equalization.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Equalization.cpp 2473
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\effects\Equalization.cpp 3194
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\export\ExportCL.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\export\ExportCL.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\export\ExportCL.cpp 399
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\export\ExportCL.cpp 401
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\export\ExportMP3.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\export\ExportMP3.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\export\ExportMP3.cpp 1752
Error C2169 'lrint': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\export\ExportFLAC.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 61
Error C2169 'lrintf': intrinsic function, cannot be defined (compiling source file C:\audacity300\audacity\src\export\ExportFLAC.cpp) C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\float_cast.h 73
Error C2264 'lrint': error in function definition or declaration; function not called C:\audacity300\audacity\out\build\x86-Release\audacity C:\audacity300\audacity\src\export\ExportFLAC.cpp 278
OK, it appears that Visual Studio 2019 version 16.9.0 is now supplying intrinsic implementations for the lrint and lrintf instructions. Since VS2019 wasn’t before, Audacity was supplying it’s own version. Microsoft considers this a “fix” for a previous omission. Unfortunately, this “fix” breaks Audacity.
There is existing logic within the audacity code intended to ferret out which compilers have lrint and which ones do not, but this logic apparently needs to be adjusted.
A quick and dirty fix would be to comment out the code in float_cast where these are defined. A better solution would be to integrate into the existing inclusion logic.
Thanks. I did something similar to comment that part of code out.
I also added ASIO support by copying the ASIO SDK a creating/setting the ASIOSDK_DIR environment variable to it.
I was trying to update to use newer ffmpeg import/export libraries (i.e. avformat-.dll, avutil-.dll, avcodec-*.dll) but wasn’t successful. I read somewhere else that replacing the header files in …\audacity\lib-src\ffmpeg with ones from a newer ffmpeg release would work. Doing so does make the prompt for the ffmpeg libraries use the newer dll filenames but they don’t load.
After 4 days, trying various sources, I have finally successfully built Audacity. As a first-timer, it was very frustrating. However, in the process, I learnt a little about GitHub Actions (idek how xD), CMake and MinGW.
I also got 68 errors, which I intuitively figured to comment out, so I’m glad I’ve learnt something. Thanks a lot to @jademan
Now, I just have to figure out what to do next
The build instructions work, can confirm. Just got this built here.
The person posting above my reply suggesting additional “building debug version instructions” seem good and I think that instructions to debug from Visual Studio would be good. I had suggested some in the other thread above this.
Reproduced here briefly:
Debugging Audacity
Make sure it built first and check the output directory contains the exe.
Select the Startup Item
(show image)
Debug >Start Debugging (F5)
Also perhaps helpful is this image showing that it seems you need to set the cmake debug/x64 and the visual studio debug/x64 profile separately or you won’t get your build.