{"id":51181392,"url":"https://github.com/alternative-intelligence-cp/nitpick-libc","last_synced_at":"2026-06-27T07:03:08.028Z","repository":{"id":347213484,"uuid":"1193219408","full_name":"alternative-intelligence-cp/nitpick-libc","owner":"alternative-intelligence-cp","description":"Standard C library wrappers for the Aria programming language — libc without the boilerplate. 10 modules, 571 tests, static + dynamic linking.","archived":false,"fork":false,"pushed_at":"2026-06-23T06:13:46.000Z","size":2940,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-23T08:12:40.049Z","etag":null,"topics":["aria","ffi","libc","musl","networking","posix","programming-language","regex","static-linking","systems-programming"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alternative-intelligence-cp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-27T01:55:55.000Z","updated_at":"2026-06-23T06:13:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/alternative-intelligence-cp/nitpick-libc","commit_stats":null,"previous_names":["alternative-intelligence-cp/aria-libc","alternative-intelligence-cp/nitpick-libc"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/alternative-intelligence-cp/nitpick-libc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alternative-intelligence-cp%2Fnitpick-libc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alternative-intelligence-cp%2Fnitpick-libc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alternative-intelligence-cp%2Fnitpick-libc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alternative-intelligence-cp%2Fnitpick-libc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alternative-intelligence-cp","download_url":"https://codeload.github.com/alternative-intelligence-cp/nitpick-libc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alternative-intelligence-cp%2Fnitpick-libc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34844350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aria","ffi","libc","musl","networking","posix","programming-language","regex","static-linking","systems-programming"],"created_at":"2026-06-27T07:03:05.792Z","updated_at":"2026-06-27T07:03:08.023Z","avatar_url":"https://github.com/alternative-intelligence-cp.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nitpick-libc\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"assets/nitpick_logo.png\" alt=\"Nitpick logo: raccoon holding a magnifying glass\" width=\"220\"\u003e\n\u003c/p\u003e\n\n\u003e 🚧 **Rebrand in progress:** Nitpick is becoming **Nitpick**. This libc repo still\n\u003e uses Nitpick names while the migration is underway. Existing source, tests, and\n\u003e compatibility paths are being preserved; package and module renames will happen\n\u003e in later coordinated slices.\n\nPure Nitpick standard library for systems programming — libc functionality without any C dependencies.\n\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)\n\n## What is nitpick-libc?\n\nnitpick-libc provides Nitpick-native modules for I/O, memory, strings, math, time, process management, networking, POSIX, and filesystem operations. All modules are written in **100% pure Nitpick** using `sys()` syscall wrappers and compiler runtime externs — no C shim layer required. It also enables fully static builds via [musl libc](https://musl.libc.org/) for maximum portability.\n\n## Why?\n\n1. **Zero C dependencies** — Every module is pure Nitpick code. No C shims, no extern C libraries to build or link\n2. **Static builds** — Use `nitpickc --static` or the musl pipeline for zero-dependency, fully portable binaries\n3. **One canonical source** — Tested, documented standard library the whole ecosystem can depend on\n\n## Status\n\n**v0.3.0** — Standalone Release. 538 tests passing across 18 test suites, all as fully static musl-linked binaries.\n\n**Zero C shim dependencies.** All modules are pure Nitpick code using `sys()` syscalls and compiler runtime (`libnitpick_runtime.a`) externs.\n\n## Architecture\n\n```\nnitpick-libc/\n├── musl-1.2.6/          # musl source (for static builds)\n├── build/musl/          # musl install (libc.a, crt*.o, headers)\n├── compat/              # glibc→musl compatibility shim (for libstdc++)\n│   └── glibc_compat.c\n├── src/                 # Pure Nitpick source modules\n│   ├── _*.npk          # Internal implementation modules\n│   └── *.npk           # Public API modules (use-importable)\n├── tests/               # Test files\n├── scripts/             # Build \u0026 test automation\n│   ├── build_static.sh  # Static build pipeline\n│   └── run_tests_static.sh  # Static test suite runner\n└── nitpick-package.toml    # Package config\n```\n\n### Modules\n\n| Module | Description | Tests |\n|--------|-------------|-------|\n| **errno** | POSIX error codes and errno handling | 23 |\n| **identity** | System identity (uid, gid, pid, hostname) | 10 |\n| **io_core** | File I/O via sys() — open, read, write, close, seek | 27 |\n| **stat** | File stat via sys() — size, permissions, timestamps | 29 |\n| **fs_core** | Filesystem ops — mkdir, rmdir, rename, unlink, access | 14 |\n| **fs_link** | Symlinks, hardlinks, readlink, realpath | 15 |\n| **fs_dir** | Directory creation and management | 11 |\n| **fs_readdir** | Directory listing via getdents64 syscall | 22 |\n| **mmap** | Memory mapping via sys() — mmap, munmap, mprotect, msync | 16 |\n| **alloc** | Memory allocation — alloc, calloc, realloc, release, byte/int64/string R/W | 29 |\n| **buf** | Buffer management — ring buffers, byte buffers | 25 |\n| **time** | Time and clock via sys() — time_now, clock, nanosleep, formatting | 54 |\n| **net** | Networking via sys() — socket, bind, listen, accept, connect, send, recv, poll, ip parse | 65 |\n| **proc** | Process management via sys() — fork, exec, waitpid, pipes, signals, spawn | 38 |\n| **posix_extra** | POSIX extras — random, advanced signal handling, errno table | 61 |\n| **str** | String operations — search, parse, buffer, formatting | 79 |\n| **math** | Math functions — trig, sqrt, pow, log, floor/ceil/round, fmod, constants | 20 |\n\n### Static Binary Size\n\nAll nitpick-libc programs compile to ~2.2 MB fully static musl-linked binaries with zero runtime dependencies.\n\n## Quick Start\n\n### Building\n\n```bash\n# Build musl (one-time, for hermetic static builds)\ncd musl-1.2.6\n./configure --prefix=$(pwd)/../build/musl --disable-shared\nmake -j$(nproc) \u0026\u0026 make install\ncd ..\n\n# Build glibc compat shim (one-time)\ncd compat \u0026\u0026 cc -O2 -Wall -c glibc_compat.c -o glibc_compat.o \u0026\u0026 ar rcs libglibc_compat.a glibc_compat.o \u0026\u0026 cd ..\n```\n\n### Dynamic Build (default)\n\nNo special link flags needed — nitpick-libc modules are `use`-imported directly:\n\n```bash\nnpkc myfile.npk -o myfile\n./myfile\n```\n\n### Static Build (simple)\n\nAs of npkc v0.2.16+, use the `--static` flag for system static linking:\n\n```bash\nnpkc --static myfile.npk -o myfile_static\nfile myfile_static    # → \"statically linked\"\n./myfile_static       # Just works\n```\n\n### Static Build (musl — hermetic)\n\nFor zero-dependency, hermetic binaries that work on any Linux (no glibc needed):\n\n```bash\n# Using the build script:\n./scripts/build_static.sh myfile.npk -o myfile_static\n\n# The binary has zero dependencies:\nfile myfile_static    # → \"statically linked\"\nldd myfile_static     # → \"not a dynamic executable\"\n./myfile_static       # Works on any x86-64 Linux\n```\n\n### Manual Static Build\n\nThe `build_static.sh` script automates this 3-step pipeline:\n\n```bash\n# 1. Compile Nitpick → assembly\nnpkc myfile.npk --emit-asm -o myfile.s\n\n# 2. Assemble\nclang -c myfile.s -o myfile.o\n\n# 3. Link against musl + nitpick runtime\nMUSL=build/musl/lib\nclang++ -static -nostdlib -nostartfiles \\\n    $MUSL/crt1.o $MUSL/crti.o \\\n    myfile.o \\\n    /path/to/libnitpick_runtime.a \\\n    -Lcompat -lglibc_compat \\\n    -L/usr/lib/gcc/x86_64-linux-gnu/13 -lstdc++ -lgcc -lgcc_eh -latomic \\\n    $MUSL/libc.a $MUSL/crtn.o \\\n    -o myfile_static\n```\n\n## Testing\n\n```bash\n# Run all tests (static, musl-linked)\n./scripts/run_tests_static.sh\n```\n\n## Usage\n\n### With `use` Imports (recommended)\n\n```nitpick\nuse \"../src/io_core.npk\".*;\nuse \"../src/fs_core.npk\".*;\n\nfunc:failsafe = int32(tbb32:err) {\n    drop(println(\"Failsafe triggered\"));\n    exit(1);\n};\n\nfunc:main = int32() {\n    int64:fd = raw(io_open_write(\"/tmp/test.txt\"));\n    drop(raw(io_write_string(fd, \"Hello from Nitpick!\\n\")));\n    drop(raw(io_close(fd)));\n    drop(println(\"Done\"));\n    exit(0);\n};\n```\n\nSee `src/` for the full set of available modules and their public functions.\n\n## How Static Linking Works\n\nThe static build pipeline replaces glibc with musl libc:\n\n1. **nitpickc** compiles `.npk` → x86-64 assembly (via LLVM)\n2. **clang** assembles → `.o` object file\n3. **clang++** links statically:\n   - musl's CRT (crt1.o, crti.o, crtn.o) — program entry point\n   - musl's libc.a — all C standard library functions\n   - libnitpick_runtime.a — Nitpick's runtime (GC, strings, threads, math, memory primitives)\n   - libglibc_compat.a — bridges glibc-specific symbols that libstdc++ needs\n   - GCC static libs — libstdc++.a, libgcc.a, libgcc_eh.a, libatomic.a\n\nThe glibc compatibility shim (`compat/glibc_compat.c`) provides ~15 glibc-specific\nsymbols (fortified functions, LFS aliases, etc.) that libstdc++.a references when\ncompiled on glibc systems. This lets us use the system's libstdc++ with musl's libc.\n\n## Architecture\n\nAs of v0.3.0, nitpick-libc is a **standalone** pure Nitpick library:\n\n- **System calls** are made directly via Nitpick's `sys()` built-in — no C wrapper functions needed\n- **Memory primitives** (byte/word read/write, memcpy, memset, memcmp) are provided by the compiler runtime (`libnitpick_runtime.a`)\n- **Math functions** (sin, cos, sqrt, etc.) are provided by the compiler runtime\n- **String conversions** (to_float, from_float, from_int) are provided by the compiler runtime\n- **Everything else** (networking, process management, filesystem, string parsing, buffers, time formatting) is implemented in pure Nitpick\n\nThe only C code remaining is `compat/glibc_compat.c`, which is infrastructure for musl static linking (not an nitpick-libc dependency).\n\n## Installation\n\n### From source (recommended)\n\n```bash\ngit clone https://github.com/alternative-intelligence-cp/nitpick-libc\ncd nitpick-libc\n\n# Build musl (one-time, for hermetic static builds)\ncd musl-1.2.6\n./configure --prefix=$(pwd)/../build/musl --disable-shared\nmake -j$(nproc) \u0026\u0026 make install\ncd ..\n\n# Build glibc compat shim\ncd compat \u0026\u0026 cc -O2 -Wall -c glibc_compat.c -o glibc_compat.o \u0026\u0026 ar rcs libglibc_compat.a glibc_compat.o \u0026\u0026 cd ..\n```\n\n### From nitpick package registry\n\n```bash\nnpkpkg install nitpick-libc\n```\n\n## License\n\nApache License 2.0 — see [LICENSE](LICENSE)\n\n## Part of the Nitpick Ecosystem\n\n| Project | Description |\n|---------|-------------|\n| [Nitpick Compiler](https://github.com/alternative-intelligence-cp/nitpick) | The Nitpick programming language compiler (npkc, was nitpickc) |\n| [nitpick-libc](https://github.com/alternative-intelligence-cp/nitpick-libc) | C standard library wrappers (this repo) |\n| [Nitpick Packages](https://github.com/alternative-intelligence-cp/nitpick-packages) | Package registry — 103+ packages |\n| [Nitpick Documentation](https://github.com/alternative-intelligence-cp/nitpick-docs) | Language documentation and tutorials |\n| [nitpick-build](https://github.com/alternative-intelligence-cp/nitpick-build) | Build system for Nitpick projects (npkbld) |\n| [nitpick-tools](https://github.com/alternative-intelligence-cp/nitpick-tools) | Safety auditor, MCP server, developer tools |\n| [Nitpicker](https://github.com/alternative-intelligence-cp/nitpicker) | Nitpicker Linux distribution with Nitpick integration |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falternative-intelligence-cp%2Fnitpick-libc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falternative-intelligence-cp%2Fnitpick-libc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falternative-intelligence-cp%2Fnitpick-libc/lists"}