원클릭으로
cpp-build
Building C++ (FireCore/SPFF) — build dirs, cmake targets, ASAN vs opt modes
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Building C++ (FireCore/SPFF) — build dirs, cmake targets, ASAN vs opt modes
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Before writing new code — search existing implementations, topical audits, READMEs, file-header caveats
After implementing — update file headers, README, topical audits; note duplication
Navigate and debug OrbitalWar / SpaceCraft — design, truss sim, combat, radiosity, orbits; hub to docs and tests
Diagnostic plots/visualizations — shared utilities, output paths, plot style conventions
Dedicated documentation work — OKF format, topical audits, extract-overview and inline-doc workflows
Writing new code — inventory-first, module-vs-script placement, no-new-files, STOP triggers for duplication
SOC 직업 분류 기준
| name | cpp-build |
| description | Building C++ (FireCore/SPFF) — build dirs, cmake targets, ASAN vs opt modes |
We always build in $REPO_ROOT/cpp/Build/, which is a symlink.
Switch it to point to either:
cpp/Build-opt/ — production / fast runscpp/Build-asan/ — AddressSanitizer instrumentationcd $REPO_ROOT/cpp
ln -sfn Build-opt Build # or Build-asan
Python loads only through the symlink, not Build-opt or Build-asan directly:
pyBall/SPFF.py → cpp/Build/libs/Molecular/libSPFF_lib.sopyBall/cpp_utils_.py → cpp/Build/libs/Optional override: export CPP_BUILD_PATH=/abs/path/to/cpp/Build/libs/
Prefer tests/tSPFF/run.sh for SPFF tests — it recompiles fresh code and (when used for ASAN) sets sanitizer library paths. Ensure the script’s build tree matches the run mode (see ASAN section below).
After switching Build symlink, rebuild in that tree (mixed .o files across trees cause ASAN symbol errors or silent corruption):
cd $REPO_ROOT/cpp/Build
cmake --build . --target DynamicOpt SPFF_lib
# or legacy per-target make (as in tests/tSPFF/run.sh):
# cd Build/libs/Molecular && make SPFF_lib
Verify opt build is not linked against ASAN objects:
nm -D $REPO_ROOT/cpp/Build/libs/Molecular/libSPFF_lib.so | grep -i asan
# must print nothing for Build-opt
| Mode | Build → | Before Python | LD_PRELOAD |
|---|---|---|---|
| opt | Build-opt | unset LD_PRELOAD ASAN_OPTIONS LSAN_OPTIONS | off |
| asan | Build-asan | rebuild full dep chain in Build-asan | libasan.so required |
ASAN run (Hessian/debug only — no matplotlib in same process):
export LD_PRELOAD=$(g++ -print-file-name=libasan.so)
export ASAN_OPTIONS=detect_leaks=0:halt_on_error=1:symbolize=1
export LSAN_OPTIONS=detect_leaks=0
| Error | Cause | Fix |
|---|---|---|
undefined symbol: __asan_* | opt .so or mixed asan/opt .o | ln -sfn Build-asan Build, rebuild all targets; or unset LD_PRELOAD for opt |
ASAN + matplotlib ft2font crash | interceptor conflict | Hessian scripts without import matplotlib; plot in separate process |
| Stale library | Build symlink changed but .so not rebuilt | cmake --build cpp/Build --target SPFF_lib |
tests/tSPFF/run.sh caveatThe script currently hardcodes cpp/Build-opt for make but always exports LD_PRELOAD=libasan. For trustworthy ASAN runs: point Build → Build-asan, rebuild there, preload ASAN, and run without mixing opt artifacts. For production: Build → Build-opt, unset LD_PRELOAD.
cd tests/tSPFF
bash run_asan_minimal.sh asan # or opt
Uses test_asan_minimal.py (numpy only). Default os._exit(0) after PASS avoids teardown false negatives.
cpp-memory skill → doc/dev_notes/SPFF/Memory_Ownership_and_Deallocation.mddoc/Topics/FTIR_Nanocrystals/Debug_ASan.mddoc/Topics/FTIR_Nanocrystals/Debug_negative_phonon_freqs.md