Giter Club home page Giter Club logo

cosmonim's People

Contributors

ajusa avatar yardanico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cosmonim's Issues

Push to Nim compiler

Hi,

Any reason to not merge asynchttpserver diff into Nim stdlib, and have cosmopolitan support from compiler, like have for musl?

Linking issue

Here's the error that I'm getting:

/usr/bin/ld.bfd: errno: TLS reference in /usr/lib64/libm-2.34.a(w_pow.o) mismatches non-TLS reference in /home/ajusa/.cache/nim/main_d/stdlib_io.nim.c.o
/usr/bin/ld.bfd: /usr/lib64/libm-2.34.a: error adding symbols: bad value
collect2: error: ld returned 1 exit status

Looks like something to do with libm. Is it trying to link against my libm rather than the cosmopolitan version maybe?

Exec format error

Hello, I wrote a little code to hexdump files in colors, but the produced executable seems not to be valid:

OSError: [Errno 8] Exec format error: './chex.com'

import terminal
import os
import strutils

proc reset() {.noconv.} =
  stdout.write("\u001b[0m\n")
  quit()

setControlCHook(reset)

let cols = terminalWidth()

var
  f: File
  i:int = 0
  l: array[1024, uint8]
  mono = false
  r: int

if isatty(stdin):
  case paramCount():
  of 0:
    echo "filename expected"
    quit()
  of 1:
    f = open(paramStr(1), fmRead)
  else:
    mono = true
    f = open(paramStr(2), fmRead)
else:
  f = stdin

r = f.readBytes(l,0,cols*2)
while r>0:
  if mono:
    for j in 0..cols*2-1:
      if j >= r: break
      stdout.write("\u001b[38;5;" & $l[j] & "m█")
      i += 1
      if (i mod cols) == 0:
        stdout.write("\n")
  else:
    for j in 0..cols-1:
      if j >= r:
        stdout.write("\u001b[0m" & " ".repeat(cols-j)) # for urxvt bug
        break
      var bg = "\u001b[48;5;" & $l[cols+j] & "m"
      if r <= cols:
        bg = "\u001b[49m"
      stdout.write( bg & "\u001b[38;5;" & $l[j] & "m▀")
      i += 1
      if (i mod cols) == 0:
        stdout.write("\n")

  r = f.readBytes(l,0,cols*2)

reset()

L_ctermid undeclared

Hello,
I tried using cosmonim to compile a command line project, but I got this error:

/home/ajusa/.cache/nim/main_r/stdlib_terminal.nim.c: In function ‘terminalWidth__s9bdJLFVciGfQ0i2sQaMF1g’:
/home/ajusa/.cache/nim/main_r/stdlib_terminal.nim.c:204:28: error: ‘L_ctermid’ undeclared (first use in this function)
  204 |  cterm = mnewString(((NI) (L_ctermid)));

My guess this is related to an OS level binding for which terminal this code is being compiled for.

https://github.com/nim-lang/Nim/blob/9819fb21d8db818c0b3027d4e6ba58dc550b77c0/lib/pure/terminal.nim#L241 appears to be the terminal code.

My nim version is

Nim Compiler Version 1.4.4 [Linux: amd64]
Compiled at 2021-02-23
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 2ff517462bf8609b30e6134c96658aa7912b628a
active boot switches: -d:release

Let me know if you need any more information!

Update to use cosmocc

Looks like as of Cosmopolitan 3.1 (and maybe 3?) https://github.com/jart/cosmopolitan/releases/tag/3.1 cosmocc is included as a C compiler that uses Cosmopolitan for building binaries.

That might be an easier way to build cross platform Nim binaries, similar to the way folks have been using zig cc and tcc - it is easier to swap out the C compiler in Nim.

I think it is as simple as adding the following to a config.nims, but I haven't tried:

  switch("cc", "cosmocc")
  switch("clang.exe", "cosmocc")
  switch("clang.linkerexe", "cosmocc")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.