build-pmars
23
总安装量
14
周安装量
#15981
全站排名
安装命令
npx skills add https://github.com/letta-ai/skills --skill build-pmars
Agent 安装分布
claude-code
11
codex
9
gemini-cli
9
antigravity
9
cursor
7
Skill 文档
Build pMARS
Overview
This skill provides guidance for building pMARS (portable Memory Array Redcode Simulator) from Debian source packages, specifically for creating headless builds without X11 dependencies. The approaches and verification strategies apply broadly to building legacy C software from source packages.
Recommended Approach
Phase 1: Preparation and Documentation Review
Before modifying any build configurations:
-
Review available documentation first
- Read Makefile comments to understand available build options
- Check README files for build instructions and configuration flags
- Review debian/control for Build-Depends to understand required dependencies
-
Check build dependencies early
- Run
apt-get build-dep <package>to install all build dependencies - Alternatively, review debian/control file and install Build-Depends manually
- Install
dpkg-devpackage if working with Debian source packages
- Run
-
Enable source repositories
- For DEB822 format (modern Ubuntu/Debian): Edit
/etc/apt/sources.list.d/*.sourcesand ensureTypes:line includesdeb-src - For traditional format: Uncomment or add
deb-srclines in/etc/apt/sources.list - Run
apt-get updateafter modifying source lists
- For DEB822 format (modern Ubuntu/Debian): Edit
Phase 2: Source Acquisition
-
Download source package
apt-get source pmars -
Extract to target location
- Move or extract source files to the required build directory (e.g.,
/app)
- Move or extract source files to the required build directory (e.g.,
Phase 3: Build Configuration for Headless Mode
To build pMARS without X11 support:
-
Modify CFLAGS in Makefile
- Remove
-DXWINGRAPHXfrom CFLAGS to disable X11 graphics - Remove
-DCURSESGRAPHXif curses support is also unwanted
- Remove
-
Remove X11 library linkage
- Remove
-lX11and any X11-related libraries from LDFLAGS/LIBS - Remove
-lcursesor-lncursesif disabling curses support
- Remove
-
Verify Makefile changes
- After editing, read the Makefile to confirm changes are correct
- Check for any conditional build logic that might override changes
Phase 4: Compilation and Installation
-
Compile the source
make clean # If previous build artifacts exist make -
Install to target location
cp pmars /usr/local/bin/pmars # Or use: make install PREFIX=/usr/local -
Verify no X11 dependencies
ldd /usr/local/bin/pmars- Output should NOT contain libX11, libXt, or other X11 libraries
Verification Strategies
Binary Verification
- Use
lddto verify linked libraries match expectations - Run the binary with
--helpor without arguments to confirm basic functionality - Check binary location and permissions
Functional Testing
- Test with actual warrior files to verify core functionality
- When testing flags like
-f(fixed position), understand the flag behavior from help text or source before testing - Create a simple test script for repeated testing rather than running similar commands multiple times
Debugging Approach
When encountering crashes or segmentation faults:
- Install debugging tools:
apt-get install gdb - Compile with debug symbols: Add
-gto CFLAGS and rebuild - Run under GDB to get precise stack traces before applying fixes
- Investigate environmental differences if behavior differs between GDB and direct execution
- Avoid speculative fixes – understand the root cause before modifying source code
Common Pitfalls
Configuration Errors
- DEB822 format confusion: Modern Debian/Ubuntu use
.sourcesfiles with YAML-like format, not the traditional one-line format - Missing dpkg-dev: Source package operations require
dpkg-devpackage - Incomplete dependency installation: Always check Build-Depends before compiling
Build Process Mistakes
- Editing wrong Makefile section: Some Makefiles have multiple configuration sections; ensure edits target the correct section
- Incomplete X11 removal: Both CFLAGS defines AND library linkage must be modified for headless builds
- Not cleaning before rebuild: After Makefile changes, run
make cleanbeforemake
Testing Mistakes
- Misunderstanding flag behavior: Read help text or source to understand flag semantics before testing
- Running repetitive similar commands: Create a test script instead of manually running variations
- Insufficient verification: A single test passing does not guarantee full functionality
Debugging Mistakes
- Applying speculative fixes: Always confirm hypothesis with debugging data before modifying source
- Ignoring environmental differences: Different behavior under GDB vs direct execution indicates environmental issues
- Not verifying edits: After editing configuration files, always read them back to confirm correctness
Decision Tree
Is the task to build pMARS from source?
âââ Yes â Continue with this skill
â âââ Need headless/non-X11 build?
â â âââ Yes â Remove XWINGRAPHX from CFLAGS, remove -lX11 from libs
â â âââ No â Use default Makefile settings
â âââ Encountering build errors?
â â âââ Missing dependencies â Run apt-get build-dep or install manually
â â âââ Source not found â Enable deb-src repositories
â â âââ Compilation errors â Check Makefile edits for typos
â âââ Encountering runtime errors?
â âââ Segfault â Use GDB with debug symbols to diagnose
â âââ Missing libraries â Check ldd output, install required libs
â âââ Unexpected behavior â Read source/help to understand expected behavior
âââ No â This skill may not apply