Debian Codegraph @

HOW_TO_BUILD_ONE.md

raw symbols SCIP
1 # How to build and test Praat for one platform
2
3 Developing Praat means two things: *building* the Praat executable from the Praat
4 source code, and *testing* the correctness of the Praat executable.
5
6 **Building** is largely automated:
7
8 - On the Mac, you use an existing Xcode project (these files are included in the releases).
9 - On other platforms (Windows and Unixes), you use existing makefiles
10 (these files are included in the source tree).
11
12 **Testing** on a platform can be done by starting up Praat on that platform,
13 and then go through to types of tests. Basic GUI functionality is tested as follows:
14
15 1. record a sound (New -> `Record mono Sound...`)
16 2. open the sound (`View & Edit`)
17 3. select a part of the sound (drag the mouse across the waveform)
18 4. play the sound (click on the rectangle below or above the selection)
19
20 The integrity of Praats’s algorithms (e.g. signal processing)
21 and of the Praat scripting language is tested as follows:
22
23 1. open the script `test/runAlltests.praat` (Praat -> `Open Praat script...`)
24 2. run the script (Run -> `Run`)
25 3. after 2 to 10 minutes, the Info window should contain a big “OK” graph
26 4. go through steps 1 through 3 for `dwtest/runAllTests.praat`
27 5. if you feel adventurous, try some tests in the folder `test/manually`
28
29 ## 1. Developing Praat for Windows
30
31 On Windows, Praat is **built** through the makefiles provided in Praat’s source tree.
32
33 One could use Cygwin or MSYS2. As we like to provide not only an x64 and an Intel32 edition,
34 but an ARM64 edition as well, and Cygwin has no toolchains for ARM64, we work with MSYS2 instead.
35
36 After installing MSYS2, we see that a `mingw64` toolchain (*could* be used for Praat’s x64 edition)
37 and a `mingw32` toolchain (*is* used for Praat’s Intel32 edition) are already available.
38 Make sure you have installed at least `make`, `gcc`, `g++` and `pkg-config` to make those work.
39 To also install a `clangarm64` toolchain (for Praat’s ARM64 edition),
40 run `clangarm64.exe` to get a `clangarm64` shell. In that shell, run `pacman -Syu` to update and
41 `pacman -S mingw-w64-clang-aarch64-clang` to install the build tools package.
42 In the same way you can create a `clang64` toolchain and a `clang32` toolchain
43 (`pacman -S mingw-w64-clang-x86_64-clang`),
44 which is a good alternative to `mingw64`
45 (in 2025, MSYS2 ended support for Intel32, so you can only use `mingw32` for that).
46
47 Move the Praat sources folders somewhere in your `/home/yourname` tree,
48 perhaps even in three places, e.g. as `/home/yourname/praats-arm64`,
49 `/home/yourname/praats-x64` and `/home/yourname/praats-intel32`;
50 the folders `fon` and `sys` should be visible within each of these folders.
51
52 If you now want to build Praat’s ARM64 edition, start the shell `clangarm64` and type
53
54 make -j12
55
56 If you want to build Praat’s x64(v3) or x64(v1) editions, start the shell `clang64` and type
57
58 make PRAAT_ARCH=x64v3 -j12
59
60 or
61
62 make PRAAT_ARCH=x64v1 -j12
63
64 respectively (you can also try this in the shell `mingw64`).
65
66 If you want to build Praat’s Intel32 edition, start the shell `mingw32` and type
67
68 make -j12
69
70 (With Cygwin, you would install the Devel package `mingw64-x86_64-gcc-g++`
71 for Praat’s x64 edition and `mingw64-i686-gcc-g++` for Praat’s Intel32 edition,
72 plus perhaps `make` and `pkg-config` if you dont’t have those yet.)
73
74 If you want to compile Praat with optimal settings for *your* computer, then often
75
76 make PRAAT_ARCH=native -j12
77
78 will work (though e.g. `clang64` will assume that `native` means some x64 version,
79 even if your computer is an ARM64 computer). You can also just set
80
81 export PRAAT_ARCH=native
82
83 in you `.bashrc` file or so. See the `Makefile` for details.
84
85 **Code-signing.** From version 6.4.25 on, we have signed the three Praat executables
86 with an “open-source code-signing certificate” (by Certum)
87 under the name “Paulus Boersma” (the Dutch-legal name of one of the authors).
88 This is designed to make it easier for Praat to pass the SmartScreen checks
89 on Windows 11. Early testing shows that the signature is seen by SmartScreen,
90 but that SmartScreen can still block Praat, so that users still have to
91 click “Run Anyway” (or “Unblock” under Properties).
92 It seems that the card reader for this certificate cannot be used yet for code-signing on ARM64 Windows
93 or on MacOS Sonoma/Sequoia/Tahoe, so for the moment we have to fall back
94 on an Intel64/AMD64 Windows 10 or 11 machine.
95
96 Thorough **testing**, including of the GUI, should ultimately be done on a Windows computer,
97 though `runAllTests` will successfully run on a virtual machine on an Intel64 Mac with Parallels Desktop
98 (for 64-bit Windows 7, Windows 8.1, Windows 10 and Windows 11),
99 or on an ARM64 Mac with Parallels Desktop (for Windows 11 only).
100 Here are a couple of issues we observed, though:
101
102 - For the Intel32 edition, `runAllTests.praat` doesn’t succeed on (macOS) ARM64 hardware,
103 because of floating-point imprecisions; to test the Intel32 edition, use Intel64 hardware instead.
104 - In December 2025, two-finger horizontal scrolling in the Sound window worked correctly in Parallels Desktop
105 but not on a Windows computer; to reliably test the GUI, use a Windows computer instead.
106
107 ## 2. Compiling for Macintosh
108
109 To **build** Praat on the Mac, extract the *praatXXXX_xcodeproj.zip* file
110 from [Praat’s latest release](https://github.com/praat/praat.github.io/releases)
111 into the folder that contains `sys`, `fon`, `dwtools` and so on (e.g. `~/Dropbox/Praats/src`).
112 Then open the project `praat.xcodeproj` in Xcode 26.1.1 (or later),
113 and edit the Intermediate and Product build paths to something that suits you
114 (Xcode -> Settings... -> Locations -> Derived Data -> Advanced... -> Custom -> Absolute,
115 then type something after Products, e.g. `~/Dropbox/Praats/bin/macos`,
116 as well as something after Intermediates, e.g. `~/builds/mac_intermediates`, then click Done).
117 After this preliminary work, choose Build or Run for the target `praat_mac`.
118 You can compile with the 14.2 SDK, which will work as far back as macOS 10.11 El Capitan,
119 which is our deployment target, and will look good even on macOS 26 Tahoe.
120
121 If you get an error message like “Code Signing Identity xxx does not match any valid, non-expired,
122 code-signing certificate in your keychain”, then select the target `praat_mac`, go to Info → Build,
123 and switch “Code Signing Identity” to “Don’t Code Sign”,
124 or sign with your own certificate if you have one as a registered Apple developer.
125
126 If you get lots of errors saying “Expected unqualified-id” or “Unknown type name NSString”,
127 then you may have to switch the Type of some .cpp file from “C++ Source” to “Objective-C++ Source”
128 (under “Identity and Type” in the righthand sidebar).
129
130 If you want to build Praat as a library instead of as an executable,
131 try the target `praat_mac_a` (static) or `praat_mac_so` (dynamic).
132
133 **Notarization.** If you want others to be able to use your Mac app,
134 you will probably have to not only *sign* the executable, but also *notarize* it. To this end,
135 do Xcode (version 16) -> Product -> Archive -> Distribute App -> Developer ID -> Upload ->
136 Automatically manage signing -> Upload -> ...wait... (“Package Approved”) ...wait...
137 (“Ready to distribute”) -> Export Notarized App). If your Praat.app was built into
138 `~/Dropbox/Praats/bin/macos/Configuration64`, then you can save the notarized
139 `Praat.app` in `~/Dropbox/Praats/bin/macos`, then drag it in the Finder to
140 `~/Dropbox/Praats/bin/macos/Configuration64`, overwriting the non-notarized
141 Praat.app that was already there. If on the way you receive an error
142 “App Store Connect Operation Error -- You must first sign the relevant contracts online”,
143 or “Couldn’t communicate with a helper application“,
144 you will have to log in to `developer.apple.com` and do Review Agreement -> Agree;
145 you may then also have to either wait for a couple of minutes,
146 and or go (or log in) to App Store Connect, then Business (or Agreements, Tax, and Banking)
147 -> Paid Apps Agreement -> View and Agree to Terms (even if you have no paid apps).
148
149 **Testing** on multiple Intel64/AMD64 platform versions can be done on older Intel64 Macs,
150 using virtual machines with Parallels Desktop. For instance, a 2013 Macbook Pro can handle
151 OS X 10.11 El Capitan, 10.12 Sierra, 10.13 High Sierra, macOS 10.14 Mojave, 10.15 Catalina,
152 and macOS 11 Big Sur, while a 2018 Macbook Pro can handle macOS 10.14 Mojave, 10.15 Catalina,
153 macOS 11 Big Sur, macOS 12 Monterey, and macOS 14 Sonoma natively.
154 Testing on multiple ARM64 platform versions can be done on an older ARM64 Mac,
155 using virtual machines with Parallels Desktop. For instance, a 2020 Mac Mini could handle
156 macOS 11 Big Sur, and macOS 12 Monterey, and macOS 13 Ventura (and macOS 14 Sonoma natively),
157 while a 2023 Macbook Pro can do macOS 15 Sequoia, or macOS 26 Tahoe natively.
158
159 ## 3. Compiling on Linux and other Unixes
160
161 To set up the system libraries required for **building** with the Clang or GCC compiler,
162 install the necessary build tools as well as some graphics and sound packages:
163
164 # on Ubuntu or Debian command line (Intel64/AMD64 or ARM64 processor)
165 sudo apt install make rsync pkg-config
166 # either:
167 sudo apt install clang libc++-dev libc++abi-dev
168 # or:
169 sudo apt install gcc g++
170 sudo apt install libgtk-3-dev
171 sudo apt install libasound2-dev
172 sudo apt install libpulse-dev
173 sudo apt install libjack-dev
174
175 On Fedora you would do instead:
176
177 # on Fedora command line:
178 sudo dnf install make rsync pkg-config
179 # either:
180 sudo dnf install clang libcxx-devel libcxxabi-devel
181 # or:
182 sudo dnf install gcc g++
183 sudo dnf install gtk3-devel
184 sudo dnf install pulseaudio-libs-devel
185 sudo dnf install alsa-lib-devel
186 sudo dnf install pipewire-jack-audio-connection-kit-devel
187 # i.e. normaly *not* jack-audio-connection-kit-devel
188
189 On Centos you would do something like:
190
191 # on Centos command line:
192 sudo dnf install dnf-plugins-core # Centos-specific preparation
193 sudo dnf config-manager --set-enabled crb # Centos-specific preparation
194 sudo dnf install epel-release # Centos-specific preparation
195 sudo dnf install make rsync pkg-config
196 sudo dnf install gcc g++
197 sudo dnf install gtk3-devel
198 sudo dnf install pulseaudio-libs-devel
199 sudo dnf install alsa-lib-devel
200 sudo dnf install pipewire-jack-audio-connection-kit-devel
201
202 To build the Praat executable, go to Praat's sources directory (where the folders `fon` and `sys` are)
203 and type one of the following commands:
204
205 # on Ubuntu or Fedora command line (x64 or ARM64 processor)
206 # or on Centos command line (x64 or ARM64 processor)
207 # either:
208 make PRAAT_ARCH=x64v3 PRAAT_COMPILER=gcc -j12
209 # or:
210 make PRAAT_ARCH=x64v3 PRAAT_COMPILER=clang -j12
211
212 # on Ubuntu or Fedora command line (ARM64 processor)
213 # or on Centos command line (ARM64 processor)
214 # or on Chromebook command line (x64v1 or ARM64 processor)
215 make -j12
216
217 # on Raspberry Pi command line (ARMv7 processor)
218 # or on Ubuntu command line (s390x processor)
219 make -j4
220
221 # on FreeBSD command line
222 make PRAAT_OS=freebsd -j12
223
224 If your Unix isn’t Linux, you may have to edit the library names in the makefile
225 (you may need pthread, gtk-3, gdk-3, atk-1.0, pangoft2-1.0, gdk_pixbuf-2.0, m, pangocairo-1.0,
226 cairo-gobject, cairo, gio-2.0, pango-1.0, freetype, fontconfig, gobject-2.0, gmodule-2.0,
227 gthread-2.0, rt, glib-2.0, asound, jack).
228
229 When compiling Praat on an external supercomputer or so, you will not have sound.
230 If you do have `libgtk-3-dev` or `gtk3-devel` (and its dependencies), do
231
232 # on Ubuntu or Fedora command line (x64 or ARM64 processor)
233 make PRAAT_AUDIO=none -j12
234
235 Then type `make -j12` or so to build the program. If your Unix isn’t Linux,
236 you may have to edit the library names in the makefile (you may need pthread, gtk-3, gdk-3, atk-1.0,
237 pangoft2-1.0, gdk_pixbuf-2.0, m, pangocairo-1.0, cairo-gobject, cairo, gio-2.0, pango-1.0,
238 freetype, fontconfig, gobject-2.0, gmodule-2.0, gthread-2.0, rt, glib-2.0).
239
240 When compiling Praat for use as a server for commands from your web pages,
241 you may not need sound, a GUI, and graphics. In that case, do
242
243 # on Ubuntu or Fedora command line (x64 or ARM64 processor)
244 # either:
245 make PRAAT_GRAPHICS=barren PRAAT_AUDIO=none -j12
246 # or:
247 make PRAAT_GRAPHICS=barren PRAAT_AUDIO=none PRAAT_COMPILER=none -j12
248
249 # on Ubuntu command line (s390x processor)
250 make PRAAT_GRAPHICS=barren PRAAT_AUDIO=none -j4
251
252 which creates the executable `praat_barren`.
253 If your Unix isn’t Linux, you may have to edit the library names in the makefile.
254
255 The above works exactly the same for x64 and ARM64 processors, with the same Makefile.
256
257 **Testing** on multiple platform versions can be done with virtual machines.
258 On an x64 Mac with Parallels Desktop 20, we test with virtual machines for
259 e.g. Ubuntu 20.04, Ubuntu 22.04, Fedora 38, Mint 20.2,
260 Debian GNU Linux 10.10, Debian GNU Linux 12, CentOS 8.4, and CentOS Stream 9.
261 On an ARM64 Mac with Parallels Desktop 26, we test with virtual machines for
262 e.g. Ubuntu 22.04, Ubuntu 24.04, Fedora 38, Fedora 40, Fedora 42, and Debian GNU Linux 12 ARM64.
263
264 ## 4. Developing Praat on all platforms simultaneously
265
266 For this, see [HOW_TO_BUILD_ALL.md](HOW_TO_BUILD_ALL.md).