Skip to content

Commit 87e5c8b

Browse files
committed
update CLAUDE.md and docs
1 parent 5b56465 commit 87e5c8b

File tree

2 files changed

+213
-13
lines changed

2 files changed

+213
-13
lines changed

CLAUDE.md

Lines changed: 131 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ DawDreamer uses a **multi-step build process**:
165165
# - CMake (can install via Homebrew: brew install cmake)
166166
# - Faust compiler (can install via Homebrew: brew install faust)
167167
# - Python 3.11-3.14 installed
168+
# Note: ncurses/tinfo NOT needed on macOS (part of system)
168169

169170
# Setup environment
170171
export PYTHONMAJOR=3.11
@@ -209,21 +210,113 @@ python3.11 -c "import dawdreamer as daw; print('Success!')"
209210

210211
#### Linux (CMake/Makefile)
211212
```bash
212-
# Setup Python paths
213-
export PYTHONLIBPATH=/usr/lib/python3.10
214-
export PYTHONINCLUDEPATH=/usr/include/python3.10
213+
# Prerequisites:
214+
# - build-essential, clang, pkg-config
215+
# - libboost-all-dev, libfreetype6-dev
216+
# - X11 development libraries (libx11-dev, libxinerama-dev, libxrandr-dev, libxcursor-dev, libxcomposite-dev)
217+
# - ALSA/audio libraries (libasound2-dev, freeglut3-dev, mesa-common-dev)
218+
# - ncurses library (libncurses-dev or libtinfo-dev) - required for Faust LLVM linking (Linux only, not needed on macOS)
219+
# - CMake, Python 3.11-3.14 with development headers
220+
# - Git
215221

216-
# Build libsamplerate
222+
# Step 1: Initialize git submodules (required on first build)
223+
git submodule update --init --recursive
224+
225+
# Step 2: Download prebuilt libfaust libraries
226+
cd thirdparty/libfaust
227+
python3 download_libfaust.py
228+
cd ../..
229+
230+
# Step 3: Build libsamplerate dependency
217231
cd thirdparty/libsamplerate
218232
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release
219-
make -C build_release
233+
cmake --build build_release --config Release
220234
cd ../..
221235

222-
# Build via Makefile
236+
# Step 4: Build DawDreamer via Makefile (for Python 3.12, adjust version as needed)
237+
export PYTHONLIBPATH=/usr/lib/python3.12
238+
export PYTHONINCLUDEPATH=/usr/include/python3.12
239+
223240
cd Builds/LinuxMakefile
224241
make CONFIG=Release CXXFLAGS="-I$PYTHONINCLUDEPATH" LDFLAGS="-L$PYTHONLIBPATH"
225242
cd ../..
243+
226244
# Output: dawdreamer/dawdreamer.so
245+
246+
# Step 5: Install Python package in development mode
247+
python3 setup.py develop
248+
249+
# Note: On WSL2/NTFS, setup.py develop can take 1-2 minutes due to processing
250+
# thousands of Faust library files with slower cross-filesystem I/O.
251+
252+
# Step 6: Verify installation
253+
python3 -c "import dawdreamer as daw; engine = daw.RenderEngine(44100, 512); print('Success!')"
254+
```
255+
256+
**Quick Install (if C++ library is already built):**
257+
```bash
258+
# If dawdreamer/dawdreamer.so already exists, just install the Python package:
259+
python3 setup.py develop
260+
261+
# This installs in editable mode - changes to Python code take effect immediately
262+
# The installation processes many Faust library files, which can take time on WSL2
263+
```
264+
265+
**Streamlined Install for LLMs/Automation (Minimal Output):**
266+
```bash
267+
# If C++ library is already built, install with minimal output:
268+
python3 setup.py develop --quiet 2>&1 | grep -E '(Successfully|ERROR|Failed|Traceback)' || \
269+
(echo "Installation in progress (this takes 1-2 min on WSL2)..." && \
270+
python3 setup.py develop --quiet && \
271+
echo "✓ DawDreamer installed successfully")
272+
273+
# Or use pip for even quieter installation:
274+
pip install -e . --quiet --disable-pip-version-check 2>&1 | \
275+
grep -vE '(Preparing|Building|Installing build dependencies)' || \
276+
echo "✓ Installation complete"
277+
278+
# Verify silently (exit code 0 = success):
279+
python3 -c "import dawdreamer; dawdreamer.RenderEngine(44100, 512)" && \
280+
echo "✓ DawDreamer working" || echo "✗ Import failed"
281+
```
282+
283+
**Full Build (Streamlined for Automation):**
284+
```bash
285+
# Complete build with minimal output (Linux)
286+
set -e # Exit on any error
287+
288+
# Check if already built
289+
if [ -f dawdreamer/dawdreamer.so ]; then
290+
echo "✓ C++ library already built, skipping to installation..."
291+
else
292+
echo "Building C++ library..."
293+
294+
# Build libsamplerate if needed
295+
if [ ! -f thirdparty/libsamplerate/build_release/src/libsamplerate.a ]; then
296+
cd thirdparty/libsamplerate
297+
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild_release >/dev/null 2>&1
298+
cmake --build build_release --config Release >/dev/null 2>&1
299+
cd ../..
300+
echo "✓ libsamplerate built"
301+
fi
302+
303+
# Build DawDreamer (requires PYTHONLIBPATH/PYTHONINCLUDEPATH set)
304+
cd Builds/LinuxMakefile
305+
make CONFIG=Release 2>&1 | grep -E '(error|Error|ERROR|warning:)' || true
306+
cd ../..
307+
echo "✓ DawDreamer C++ library built"
308+
fi
309+
310+
# Install Python package quietly
311+
echo "Installing Python package (1-2 min on WSL2)..."
312+
python3 setup.py develop --quiet 2>&1 | grep -E '(Successfully installed|ERROR|Failed)' || \
313+
python3 setup.py develop --quiet
314+
echo "✓ Installation complete"
315+
316+
# Verify
317+
python3 -c "import dawdreamer; dawdreamer.RenderEngine(44100, 512)" && \
318+
echo "✓ DawDreamer verified and ready" || \
319+
(echo "✗ Verification failed" && exit 1)
227320
```
228321

229322
#### Windows (Visual Studio 2022)
@@ -246,7 +339,7 @@ msbuild Builds/VisualStudio2022/DawDreamer.sln /property:Configuration=Release
246339
### Wheel Packaging (setup.py)
247340
1. Expects pre-compiled native binary at expected path
248341
2. Copies binary to `dawdreamer/` package directory (renamed to .so/.pyd/.dll)
249-
3. Includes Faust architecture files and faustlibraries as package data
342+
3. Includes Faust architecture files and faustlibraries as package data (~200+ files)
250343
4. Creates multi-platform wheel with native extension
251344
5. Uses `BinaryDistribution` class to force platform-specific wheel tag
252345

@@ -255,6 +348,13 @@ msbuild Builds/VisualStudio2022/DawDreamer.sln /property:Configuration=Release
255348
- Platform-specific binary path detection
256349
- Bundles licenses and Faust resources
257350
- Creates non-zip-safe wheel (binary extension)
351+
- Processes many files during editable install (can take 1-2 min on WSL2)
352+
353+
**Reducing Verbosity (for LLMs/Automation):**
354+
- Use `--quiet` flag: `python3 setup.py develop --quiet`
355+
- Filter output: `python3 setup.py develop 2>&1 | grep -E '(Successfully|ERROR|Failed)'`
356+
- Use pip: `pip install -e . --quiet --disable-pip-version-check`
357+
- The verbose package_data list (~200 lines) is suppressed with `--quiet`
258358

259359
---
260360

@@ -649,6 +749,30 @@ audio = engine.get_audio()
649749
- Intel Mac: `export ARCHS=x86_64`
650750
- Check your architecture: `uname -m`
651751

752+
**setup.py develop is very slow (Linux/WSL2)**
753+
- **Cause**: Processing thousands of Faust library files across NTFS filesystem boundary
754+
- **Behavior**: Installation can take 1-2 minutes (normal on WSL2)
755+
- **What's happening**:
756+
- Building editable wheel with ~200+ architecture files and ~50+ Faust library files/directories
757+
- Cross-filesystem I/O between WSL2 Linux and Windows NTFS is slow
758+
- You'll see "Building editable for dawdreamer (pyproject.toml): still running..." for ~30-60 seconds
759+
- **Solution**: Be patient, this is expected. Process will complete successfully.
760+
- **Verification**: Once complete, you'll see "Successfully installed dawdreamer-0.8.4"
761+
762+
**Python version compatibility (Linux)**
763+
- **Supported**: Python 3.11-3.14 (tested with 3.12 on WSL2)
764+
- **Note**: No special environment variables needed for installation step on Linux
765+
- **Check version**: `python3 --version`
766+
767+
**Missing libtinfo.so dependency (Linux)**
768+
- **Symptom**: `ImportError: libtinfo.so.6: cannot open shared object file`
769+
- **Cause**: Missing ncurses/tinfo library
770+
- **Solution**:
771+
- Ubuntu/Debian: `sudo apt-get install libncurses-dev` or `libtinfo-dev`
772+
- RedHat/CentOS/Fedora: `sudo yum install ncurses-devel`
773+
- Verify: `ldd dawdreamer/dawdreamer.so | grep tinfo`
774+
- **Why needed**: Faust compiler uses LLVM which depends on libtinfo for terminal handling
775+
652776
### Runtime Issues
653777

654778
**ImportError: cannot import dawdreamer**

docs/installation.rst

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ System Requirements
2727
**Linux:**
2828

2929
* x86_64 CPU
30-
* 64-bit Python 3.11-3.14
30+
* 64-bit Python 3.11-3.14 (tested with 3.12 on Ubuntu/WSL2)
31+
* For WSL2 users: Expect longer installation times (1-2 minutes) due to cross-filesystem I/O
3132

3233
Building from Source
3334
--------------------
@@ -80,17 +81,28 @@ Linux
8081
freeglut3-dev \
8182
libxcomposite-dev \
8283
libcurl4-gnutls-dev \
84+
libncurses-dev \
8385
git \
8486
cmake \
8587
python3 \
86-
python3.11-dev
88+
python3-dev
8789
88-
2. Set environment variables:
90+
.. note::
91+
Replace ``python3-dev`` with your specific Python version if needed (e.g., ``python3.12-dev``).
92+
Python 3.11-3.14 are supported. Check your version with ``python3 --version``.
93+
94+
.. note::
95+
**ncurses/tinfo dependency (Linux only)**: The ``libncurses-dev`` package provides ``libtinfo.so`` which is
96+
required for Faust's LLVM linking on Linux. On some systems you may need ``libtinfo-dev`` instead.
97+
This is NOT needed on macOS (ncurses is part of the system).
98+
Verify after build with: ``ldd dawdreamer/dawdreamer.so | grep tinfo``
99+
100+
2. Set environment variables (adjust version as needed):
89101

90102
.. code-block:: bash
91103
92-
export PYTHONLIBPATH=/usr/lib/python3.11
93-
export PYTHONINCLUDEPATH=/usr/include/python3.11
104+
export PYTHONLIBPATH=/usr/lib/python3.12
105+
export PYTHONINCLUDEPATH=/usr/include/python3.12
94106
95107
3. Build libsamplerate:
96108

@@ -107,6 +119,44 @@ Linux
107119
108120
sh build_linux.sh
109121
122+
5. Install the Python package:
123+
124+
.. code-block:: bash
125+
126+
python3 setup.py develop
127+
128+
.. note::
129+
On WSL2 with NTFS filesystems, this step can take 1-2 minutes due to processing
130+
thousands of Faust library files across the filesystem boundary. This is normal.
131+
You'll see "Building editable for dawdreamer (pyproject.toml): still running..."
132+
which indicates progress is being made.
133+
134+
6. Verify the installation:
135+
136+
.. code-block:: python
137+
138+
python3 -c "import dawdreamer as daw; engine = daw.RenderEngine(44100, 512); print('Success!')"
139+
140+
**Streamlined Installation for Automation/LLMs:**
141+
142+
If you want minimal command-line output (useful for LLMs or automated builds):
143+
144+
.. code-block:: bash
145+
146+
# Quick install if C++ library already exists (minimal output)
147+
python3 setup.py develop --quiet 2>&1 | grep -E '(Successfully|ERROR|Failed)' || \
148+
(echo "Installing (1-2 min on WSL2)..." && \
149+
python3 setup.py develop --quiet && \
150+
echo "✓ Installed successfully")
151+
152+
# Verify silently
153+
python3 -c "import dawdreamer; dawdreamer.RenderEngine(44100, 512)" && \
154+
echo "✓ Working" || echo "✗ Failed"
155+
156+
.. note::
157+
The ``--quiet`` flag suppresses verbose output. On WSL2, you'll see a brief pause
158+
(1-2 minutes) while processing Faust libraries - this is normal.
159+
110160
Docker
111161
^^^^^^
112162

@@ -258,4 +308,30 @@ If you encounter issues:
258308
2. Verify Python version: ``python --version`` (should be 3.11-3.14)
259309
3. On macOS, ensure you're using the correct architecture arm64
260310
4. On Windows, ensure you're using the x64 Native Tools Command Prompt
261-
5. See the `CLAUDE.md <https://github.com/DBraun/DawDreamer/blob/main/CLAUDE.md>`_ file for detailed troubleshooting
311+
5. On Linux/WSL2, ``setup.py develop`` taking 1-2 minutes is normal when processing Faust libraries
312+
6. If the C++ library is already built (``dawdreamer/dawdreamer.so`` exists), you can skip the build steps and just run ``python3 setup.py develop``
313+
7. See the `CLAUDE.md <https://github.com/DBraun/DawDreamer/blob/main/CLAUDE.md>`_ file for detailed troubleshooting
314+
315+
Common Issues
316+
~~~~~~~~~~~~~
317+
318+
**Linux: "setup.py develop" is taking a long time**
319+
320+
This is expected behavior on WSL2/NTFS. The installation processes ~200+ architecture files
321+
and ~50+ Faust library directories across the filesystem boundary. Wait 1-2 minutes for completion.
322+
You'll see "Successfully installed dawdreamer-0.8.4" when done.
323+
324+
**ImportError after installation**
325+
326+
Verify that the installation completed:
327+
328+
.. code-block:: bash
329+
330+
python3 -c "import dawdreamer; print('Installed successfully')"
331+
332+
If it fails, try reinstalling:
333+
334+
.. code-block:: bash
335+
336+
python3 setup.py develop --uninstall
337+
python3 setup.py develop

0 commit comments

Comments
 (0)