Compilation fails: 'NULL' undeclared identifier in FastNoiseLite.h
Describe the bug
Compilation fails when installing Infinigen with terrain support on macOS (Apple Silicon). The build process exits with multiple "use of undeclared identifier 'NULL'" errors in FastNoiseLite.h when compiling C++ code.
The error occurs during the make terrain step called by the build script.
Steps to Reproduce
- Clone the repository (commit 69211e1046e53345e3159792787a294714cc3a07)
- Create a fresh conda environment with Python 3.11
- Run
pip install -e ".[terrain,vis]"
What version of the code were you using?
Commit: 69211e1046e53345e3159792787a294714cc3a07
What command did you run?
pip install -e ".[terrain,vis]"What are your FULL output logs?
If this is your first time running Infinigen, what are the full install logs?
pip install -v -e ".[terrain,vis]" > build.log 2>&1Platform
- OS & OS Version: macOS 26.4.1 (25E253)
- Model: MacBook Pro M2 Pro (Mac14,9)
- Chip: Apple M2 Pro
- CPU: 10-core (6 performance + 4 efficiency)
- GPU: Apple M2 Pro (16-core integrated)
- GPU Driver: Built-in Metal driver
- RAM: 16 GB
- Compiler: Apple Clang 17.0.0 (clang-1700.6.3.2)
- Target: arm64-apple-darwin25.4.0
- Thread model: posix
Additional Context
Error Summary
The build process fails when compiling infinigen/terrain/source/cpu/utils/FastNoiseLite.cpp due to undeclared identifier 'NULL' errors in the included header file FastNoiseLite.h.
Key error snippet from the build log:
In file included from source/cpu/utils/FastNoiseLite.cpp:12:
source/cpu/utils/../../common/utils/FastNoiseLite.h:279:25: error: use of undeclared identifier 'NULL'
279 | int *is_center_tile=NULL,
| ^~~~
source/cpu/utils/../../common/utils/FastNoiseLite.h:280:25: error: use of undeclared identifier 'NULL'
280 | int *is_center_band=NULL
| ^~~~
source/cpu/utils/../../common/utils/FastNoiseLite.h:289:25: error: use of undeclared identifier 'NULL'
289 | assert(distances != NULL);
| ^~~~
source/cpu/utils/../../common/utils/FastNoiseLite.h:291:22: error: use of undeclared identifier 'NULL'
291 | if (positions != NULL) {
| ^~~~Full error log shows 20+ similar errors before compilation stops.
Analysis
- The file
FastNoiseLite.cppis being compiled as C++ (by Apple Clang) - The header
FastNoiseLite.huses C-styleNULLwithout including<cstddef>or<stddef.h> - This causes the compiler to not recognize
NULLas a valid identifier - The error occurs on macOS ARM64 (Apple Silicon) but may affect other platforms with strict C++ compilation
Proposed Fix
I have identified the fix and plan to submit a Pull Request. Options:
- Replace all
NULLwithnullptr(more idiomatic for C++11 and later) - Add
#include <cstddef>at the top ofFastNoiseLite.h(minimal change)
I would appreciate guidance on which approach the maintainers prefer.
Workaround
For anyone encountering this issue while waiting for the fix, they can manually add:
#include <cstddef>at the top of infinigen/terrain/source/common/utils/FastNoiseLite.h
Then re-run:
pip install -e ".[terrain,vis]"Additional Notes
- This is my first time installing Infinigen
- The issue is reproducible on a clean environment
- I am willing to submit a PR with the fix once confirmed
Related Files
infinigen/terrain/source/common/utils/FastNoiseLite.hinfinigen/terrain/source/cpu/utils/FastNoiseLite.cppscripts/install/compile_terrain.sh
Source: princeton-vl/infinigen