Skip to content
ProducerMatt edited this page Sep 6, 2023 · 12 revisions

Issues

"I want to learn more about X program, but I can't find any documentation on it"

If the program has its own directory, check for the files README.md (original author's) and README.cosmo (Cosmo-specific changelog). If it's in third_party/, look for its help files online.

If that fails, check the source code for comments and documentation strings. If that's still not good enough, try reading the code -- understandable code is a priority for the developers.

"I'm troubleshooting and need more info about my program's execution"

All Cosmo binaries include two special flags: --strace which echoes system calls, and --ftrace which echoes function calls. This provides visibility into your program on a level that normally requires a debugger.

"My program won't execute in certain situations"

An example: the program runs fine when run straight from the command line, but usage from find -exec fails with the error ENOACCESS.

  • Running the program under a shell invocation, such as sh -c 'binary.com args...' may succeed.
  • Every Cosmopolitan binary can strip its own headers, to fit your native binary format with binary.com --assimilate. This is non-reversible and means that the program will no longer work on systems with different executable formats (the groups being Windows, Linux/BSD, and Mac). However, it may dodge this issue. Be sure to back up your programs before running.

"Zipping files into an executable breaks the executable"

Some Cosmo executables can be used as ZIP archives, such as Redbean, Lua.com, QuickJS. You should be able to easily view their contents with any ZIP program. However, inserting files into the ZIP archive is much more tricky and should only be done using the included third_party/zip/zip.com. This is a port of the original PKZIP source. Although the Cosmo ZIP implementation follows the PKZIP specification, every ZIP program tested so far does not adhere strictly enough to the spec to avoid damaging the executable.

Clone this wiki locally