@@ -136,32 +136,95 @@ make test
136136
137137## Building Locally
138138
139- ### Python Package
139+ ### Prerequisites
140+
141+ First, install the required dependencies (pybind11):
142+
143+ ``` bash
144+ # Install prerequisites to local_install directory
145+ bash ci-utils/install_prereq_linux.sh
146+
147+ # On Windows, use:
148+ # ci-utils\install_prereq_win.bat
149+ ```
150+
151+ This creates a ` local_install ` directory with pybind11 headers and CMake configuration.
152+
153+ ### Python Package (Development Mode)
154+
155+ For local development and testing:
140156
141157``` bash
142- # Install build dependencies
143- pip install build setuptools-scm
158+ # Install in editable mode with prerequisites
159+ pip install -e .
160+
161+ # The build will automatically:
162+ # - Detect version from git using setuptools-scm
163+ # - Build C++ extensions using CMake
164+ # - Link against local_install dependencies
165+ ```
166+
167+ ### Python Package (Wheel Build)
168+
169+ To build distributable wheels (matching CI process):
170+
171+ ``` bash
172+ # Install prerequisites first
173+ bash ci-utils/install_prereq_linux.sh
174+
175+ # Install build tools
176+ pip install setuptools-scm cibuildwheel
177+
178+ # Update version files (optional, happens automatically in CI)
179+ python scripts/update_versions.py
144180
145- # Build wheel
181+ # Build wheel for current Python version
182+ pip install build
146183python -m build
147184
148- # Install locally
185+ # OR use cibuildwheel to build for multiple Python versions (like CI)
186+ export FILEPATTERN_DEP_DIR=" $( pwd) /local_install"
187+ python -m cibuildwheel --output-dir dist
188+
189+ # Install the wheel
149190pip install dist/* .whl
150191```
151192
193+ ** Note:** The ` FILEPATTERN_DEP_DIR ` environment variable tells the build where to find pybind11.
194+
152195### C++ Library
153196
154197``` bash
198+ # Install prerequisites first
199+ bash ci-utils/install_prereq_linux.sh
200+
201+ # Build C++ library
155202cd src/filepattern/cpp
156203mkdir build && cd build
157- cmake ..
158- make
204+
205+ # Configure with prerequisites
206+ cmake -DCMAKE_PREFIX_PATH=$( pwd) /../../../../local_install \
207+ -DCMAKE_INSTALL_PREFIX=$( pwd) /../../../../local_install \
208+ ..
209+
210+ # Build
211+ make -j4
212+
213+ # Install (optional)
214+ make install
159215```
160216
161217### Java Package
162218
163219``` bash
220+ # Update version files first (if not already done)
221+ python scripts/update_versions.py
222+
223+ # Build with Maven
164224mvn clean package
225+
226+ # Or install to local Maven repository
227+ mvn clean install
165228```
166229
167230## Version Management
@@ -178,6 +241,83 @@ To manually update version files (normally not needed):
178241python scripts/update_versions.py
179242```
180243
244+ ## Troubleshooting Build Issues
245+
246+ ### "pybind11 not found" errors
247+
248+ ** Problem:** CMake can't find pybind11 headers
249+
250+ ** Solution:**
251+ ``` bash
252+ # Make sure prerequisites are installed
253+ bash ci-utils/install_prereq_linux.sh
254+
255+ # Set environment variable for the build
256+ export FILEPATTERN_DEP_DIR=" $( pwd) /local_install"
257+
258+ # Or pass to CMake directly
259+ cmake -DCMAKE_PREFIX_PATH=$( pwd) /local_install ..
260+ ```
261+
262+ ### "VERSION file not found" during CMake
263+
264+ ** Problem:** CMake can't find the VERSION file
265+
266+ ** Solution:**
267+ ``` bash
268+ # Generate VERSION file
269+ python scripts/update_versions.py
270+
271+ # Or create manually with current version
272+ echo " 2.1.4" > VERSION
273+ ```
274+
275+ ### setuptools-scm version detection fails
276+
277+ ** Problem:** ` version = '0.1.dev0' ` or version detection error
278+
279+ ** Solution:**
280+ ``` bash
281+ # Ensure you're in a git repository
282+ git status
283+
284+ # Ensure git tags exist
285+ git tag -l
286+
287+ # Fetch all tags if cloning
288+ git fetch --tags
289+
290+ # If no tags exist, create one
291+ git tag v2.1.4
292+ ```
293+
294+ ### Build fails on macOS with library linking errors
295+
296+ ** Problem:** Libraries not found during wheel repair
297+
298+ ** Solution:**
299+ ``` bash
300+ # Set MACOSX_DEPLOYMENT_TARGET
301+ export MACOSX_DEPLOYMENT_TARGET=" 10.15"
302+
303+ # Set library paths
304+ export REPAIR_LIBRARY_PATH=" $( pwd) /local_install/lib:$( pwd) /local_install/lib64"
305+ export DYLD_LIBRARY_PATH=" $REPAIR_LIBRARY_PATH "
306+ ```
307+
308+ ### Tests fail during cibuildwheel
309+
310+ ** Problem:** Tests can't import the package
311+
312+ ** Solution:** Tests run inside cibuildwheel automatically. For local testing:
313+ ``` bash
314+ # Install the built wheel first
315+ pip install dist/* .whl
316+
317+ # Run tests
318+ pytest tests/
319+ ```
320+
181321## Questions?
182322
183323If you have questions or need help, please:
0 commit comments