在越狱的 iPhone 上从源代码编译 Node.js 18,以运行 Claude Code
1 分•作者: BryanTheCynic•21 天前
在已越狱的 iPhone 12 Pro Max (iOS 16.5, Dopamine) 上原生构建 Node.js 18.20.4,以运行 Claude Code - 无需 SSH 到服务器。<p>关键发现:
- 苹果的 -fembed-bitcode 标志为每个 .o 文件增加了 11MB 的开销,而实际代码只有 58KB,导致 V8 库膨胀到 6.8GB + 4.5GB
- 从 common.gypi 中移除该标志后,构建体积从 29GB 降至 8GB 以下
- 由于 iOS 没有 Xcode,因此需要伪造 xcrun/xcodebuild 脚本
- 每个构建工具(mksnapshot、torque 等)都需要在构建过程中进行 ldid 签名
- 最终的二进制文件需要 --no-wasm-code-gc 标志,因为 iOS 存在内存管理方面的特殊问题<p>最终结果:71MB 的 node 二进制文件,具有完整的 WebAssembly + ICU 支持,Claude Code 可交互运行。<p>视频:https://www.youtube.com/shorts/NXgqi1jgSq0
查看原文
Built Node.js 18.20.4 natively on a jailbroken iPhone 12 Pro Max (iOS 16.5, Dopamine) to run Claude Code - no SSH to a server.<p>Key discoveries:
- Apple's -fembed-bitcode flag added 11MB overhead per .o file vs 58KB actual code, bloating V8 libraries to 6.8GB+4.5GB
- Removing the flag from common.gypi dropped the build from 29GB to under 8GB
- Required fake xcrun/xcodebuild scripts since iOS has no Xcode
- Every build tool (mksnapshot, torque, etc.) needs ldid signing mid-build
- Final binary needed --no-wasm-code-gc flag due to iOS memory management quirks<p>Final result: 71MB node binary with full WebAssembly + ICU support, Claude Code running interactively.<p>Video: https://www.youtube.com/shorts/NXgqi1jgSq0