/usr/local/bin/python3.8) on a Linux environment./opt/rh/devtoolset-7/root/usr/bin/c++), CMake 3.25.2.make, to preserve this state. make -j3 has NOT yet been run against this configure.Every prior multiple definition of DispatchStub linker failure (2026-08-26 and earlier tonight, 2026-08-29) was blamed on generic "build directory corruption from repeated reconfigures" โ that diagnosis was incomplete. The actual mechanism, confirmed via git status --porcelain:
PyTorch's per-CPU-capability dispatch codegen generates wrapper files like Activation.cpp.DEFAULT.cpp and Activation.cpp.AVX2.cpp (each #includes the real source under a capability flag) directly inside the source tree (aten/src/ATen/native/cpu/), not inside build/. Every prior session's rm -rf build/ wipe never touched these, because they were never part of build/ to begin with. Each new build attempt re-scanned the directory, found these already-wrapped files sitting alongside real source, and wrapped them again โ hence filenames compounding across the whole saga into absurd stacks like Activation.cpp.DEFAULT.cpp.DEFAULT.cpp.DEFAULT.cpp.DEFAULT.cpp.o and eventually causing the linker to find the same DispatchStub symbol defined twice.
This explains why the corruption survived every previous build/ wipe across multiple sessions โ the actual pollution was never in the directory being wiped.
git clean -fdx aten/src/ATen/native/cpu/ (targeted, narrow)git clean -fdx across the whole repo โ caught additional stale generated headers (Config.h, CUDAConfig.h, generated_cpp.txt) and leftover third-party build directories (sleef/, foxi/, confu-deps/) that the narrow fix would have missedgit submodule foreach --recursive git clean -ffdx โ cleaned stale CMakeFiles/, generated config headers, and .pc files sitting inside every individual submodule (protobuf, gloo, ideep/mkl-dnn, tensorpipe, kineto, onnx, fbgemm) โ a category of hidden staleness invisible to any top-level clean, since submodules are separate git repositoriesThe submodule-level clean removed third_party/foxi/CMakeLists.txt, breaking the subsequent cmake .. configure with:
CMake Error at cmake/Dependencies.cmake:1509 (add_subdirectory):
The source directory /root/pytorch/third_party/foxi does not contain a CMakeLists.txt file.
foxi apparently ships this file as a genuinely tracked file (not generated), but the clean treated it as untracked cruft. Fixed with a targeted re-sync of just that one submodule:
git submodule update --init --recursive third_party/foxi
Confirmed restored via ls third_party/foxi/CMakeLists.txt.
HEAD detached at v1.10.2
Changes to be committed:
modified: .gitmodules
deleted: third_party/breakpad
breakpad being deleted as a submodule is consistent with -DUSE_BREAKPAD=OFF being used throughout this whole build โ looks like an intentional prior removal, not corruption. Andrew was advised to leave this alone rather than run git restore/git rm right before a build he wants to just work โ one less variable.
cd ~/pytorch
mkdir build # after the full clean above wiped the old build/ dir
cd build
cmake .. \
-DCMAKE_C_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++ \
-DPYTHON_EXECUTABLE=/usr/local/bin/python3.8 \
-DPYTHON_LIBRARY=/usr/local/lib/libpython3.8.so \
-DPYTHON_INCLUDE_DIR=/usr/local/include/python3.8 \
-DUSE_BREAKPAD=OFF \
-DBUILD_CAFFE2=0 \
-DUSE_NUMPY=ON \
-DUSE_QNNPACK=OFF \
-DUSE_PYTORCH_QNNPACK=OFF \
-DUSE_XNNPACK=OFF \
-DUSE_FBGEMM=OFF \
-DUSE_GLOW=OFF \
-DBUILD_TEST=OFF \
-DCMAKE_CXX_FLAGS="-w" \
-Dprotobuf_DISABLE_WARNINGS=ON
Confirmed in the resulting log: Python consistently 3.8.18 across interpreter/library/includes, USE_BREAKPAD: OFF, and finishing with:
-- Configuring done
-- Generating done
-- Build files have been written to: /root/pytorch/build
No CMake Error lines anywhere in this run.
Run inside a devtoolset-7 shell (scl enable devtoolset-7 bash, confirmed gcc --version โ 7.3.1) rather than relying solely on the CMake compiler-path flags.
/swapfile) as a safety margin โ OOM killer deliberately left enabled rather than disabled (disabling risks a full unrecoverable hang on a genuine leak; a swapfile gives breathing room without removing the safety net)-j3 parallelism used throughout โ appropriate for this RAM/CPU allocation, no OOM kills observed in any session so farcd ~/pytorch/build
make -j3
This has not been run yet against this specific clean configure. Andrew is shutting Clone down and taking a full VM image/snapshot first, specifically so this clean state (pristine source tree + clean submodules + working configure) is preserved as a rollback point regardless of what make does next โ this is the first time all saga that a shutdown/image has been taken at exactly this point in the process.
make -j3 against this clean configure still fails with the same class of error, the standing decision is to drop PyTorch and find an alternative (lighter runtime, prebuilt wheel path, or a different embedding approach) rather than attempt a fourth full cyclepip install open_clip_torch, then a real CLIP embedding test against Andrew's actual uploaded images/video (previously blocked in a different environment by an egress allowlist against huggingface.co/openaipublic.azureedge.net โ Clone's own real internet access has not yet been tested against this)/root/pytorch/build[cite: 2].third_party/foxi successfully re-initialized and verified (CMakeLists.txt present)[cite: 1].make -j3) followed by system shutdown/checkpointing./opt/rh/devtoolset-7/root/usr/bin/c++)[cite: 2]/usr/local/bin/python3.8)[cite: 2]USE_BREAKPAD=OFF[cite: 2]BUILD_CAFFE2=0[cite: 2]USE_CUDA=OFF[cite: 2]USE_OPENMP=ON[cite: 2]cd ~/pytorch/build
make -j3