Open theSherwood opened 5 months ago
The first issue seems to be a problem where building opir
(the helper tool for Futhark) on your machine fails because it can't find the C standard library. Are you able to compile other Nim programs?
The second issue seems to be that stdlib.h
can't be found, not quite sure why that would happen. Only guess is that you've set up your paths incorrectly somehow. This works for me:
[peter /tmp/treesitter ] $ tree
.
├── tree-sitter
│ └── lib
│ └── include
│ └── tree_sitter
│ └── api.h
└── treesitter.nim
5 directories, 2 files
[peter /tmp/treesitter ] $ cat treesitter.nim
import futhark
importc:
path "tree-sitter/lib/include/tree_sitter"
"api.h"
[peter /tmp/treesitter ] $ nim c treesitter.nim
Hint: used config file '/home/peter/.choosenim/toolchains/nim-2.0.4/config/nim.cfg' [Conf]
Hint: used config file '/home/peter/.choosenim/toolchains/nim-2.0.4/config/config.nims' [Conf]
...............................................................................................................................................
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(810, 7) Hint: Running: opir -I/usr/lib/clang/17/include -I/tmp/treesitter/tree-sitter/lib/include/tree_sitter /home/peter/.cache/nim/treesitter_d/futhark-includes.h [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(828, 3) Hint: Parsing Opir output [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(839, 5) Hint: Caching Opir output in /home/peter/.cache/nim/treesitter_d/opir_ED44B79224F7527D.json [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(842, 3) Hint: Generating Futhark output [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(854, 3) Hint: Gathering symbols [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(888, 3) Hint: Find all imported symbols [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(900, 3) Hint: Generate temporary names [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(916, 3) Hint: Add name changes [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(924, 3) Hint: Generate Nim code [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(207, 5) Hint: Renaming "type" to "typefield" in structtsquerypredicatestep [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(207, 5) Hint: Renaming "end" to "endarg" [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(207, 5) Hint: Renaming "end" to "endarg" [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(207, 5) Hint: Renaming "end" to "endarg" [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(207, 5) Hint: Renaming "end" to "endarg" [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(965, 3) Hint: Add setting up imports [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(1014, 3) Hint: Adding extra types [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(1018, 3) Hint: Adding opaque types [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(1030, 3) Hint: Adding decl guards [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(1043, 3) Hint: Adding types [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(1047, 3) Hint: Adding second level of decl guards [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(1060, 3) Hint: Adding generated procs [User]
/home/peter/.nimble/pkgs2/futhark-0.13.1-f8ed16e56f65c86bacdfc3f6b4ae27ae5f9a185d/futhark.nim(1066, 3) Hint: Caching Futhark output in /home/peter/.cache/nim/treesitter_d/futhark_8DB65A1214405120.nim [User]
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/system/exceptions.nim
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/std/private/digitsutils.nim
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/system/dollars.nim
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/system.nim
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/pure/times.nim
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/std/envvars.nim
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/std/cmdline.nim
CC: ../../home/peter/.choosenim/toolchains/nim-2.0.4/lib/system/nimscript.nim
CC: treesitter.nim
Hint: [Link]
Hint: mm: orc; threads: on; opt: none (DEBUG BUILD, `-d:release` generates faster code)
68242 lines; 1.275s; 167.855MiB peakmem; proj: /tmp/treesitter/treesitter.nim; out: /tmp/treesitter/treesitter [SuccessX]
Using nim 2.0.4, Futhark 0.13.1, and clang 17.0.6. But your setup should work as well.
The first issue seems to be a problem where building opir (the helper tool for Futhark) on your machine fails because it can't find the C standard library. Are you able to compile other Nim programs?
Yes. On my mac I can install other nimble packages and compile and run Nim programs without issue.
The second issue seems to be that stdlib.h can't be found, not quite sure why that would happen. Only guess is that you've set up your paths incorrectly somehow.
I've got a very similar directory tree in my replit
codebase:
.
├── tree-sitter
│ └── lib
│ └── include
│ └── tree_sitter
│ └── api.h
└── main.nim
And I can compile and run C source files that include stdlib.h
and I can compile and run Nim files that don't use Futhark's importc
.
For me it errors when building opir:
nimble install futhark
-> ld.exe: cannot find -lclang
nimble install --passL:"-L\"C:\Program Files\LLVM\lib\"" futhark
-> gcc.exe: error: Files/LLVM/lib: No such file or directory
Here are a couple errors I'm getting. On my mac, I'm getting an error on installation of
futhark
. On replit, I'm getting an error trying to use it.mac
I'm on macOS Monterey 12.6.3
Error message attempting to install
futhark
:Clang Version
Nim Version
Nimble Version
replit
Here's the url: https://replit.com/@theSherwood/EarlyBlueSpreadsheets It's public, so you should be able to see it if you're so inclined.
Here's the nim file:
Here's the error when trying to run the nim file (
nim c -r main.nim
):Nim version
Nimble version
Clang version