Opir generates json successfully, Futhark `key not found: pragmas [KeyError]`
arkanoid87 opened this issue · 4 comments
I was trying to wrap https://github.com/max2344/pcsc-lite/blob/master/src/PCSC/pcsclite.h
import futhark
importc:
path "/usr/include/PCSC"
"pcsclite.h"
but
futhark.nim(464, 14) template/generic instantiation of `importcImpl` from here
nim-1.6.10/lib/pure/collections/tables.nim(234, 5) Error: unhandled exception: key not found: pragmas [KeyError]
so I've run Opir separately
$ opir -I/usr/include/PCSC/ ~/.cache/nim/pcsclite_d/futhark-includes.h | jq > pcsclite.h.json
and I've got a json without errors pcsclite.h.json.txt
after some elementary tracing, it happens on first execution of createVar
, during parsing of g_rgSCardRawPci
relevant json section
{
"kind": "var",
"file": "/usr/include/PCSC/pcsclite.h",
"position": {
"column": 63,
"line": 88
},
"name": "g_rgSCardRawPci",
"linkage": "external",
"type": {
"kind": "alias",
"value": "SCARD_IO_REQUEST"
}
},
relevant C section
extern const SCARD_IO_REQUEST g_rgSCardT0Pci, g_rgSCardT1Pci, g_rgSCardRawPci;
how does Futhark deals with extern declarations?
Just found this problem happens in stable
, but doesn't in devel
maybe node['pragma']
has changed?
What do you mean it happens in stable
and not in devel
? Futhark doesn't have a stable/devel version split. I will look into it, there was recently some changes made with pragmas.
Are you on the latest (0.7.4) version? As of f568c80 there shouldn't be any access to "pragma" in the Futhark module.
you are right, this problem was due to me hopping between nim devel and nim stable, not realizing that they use separate package folder pkgs/pkgs2
, and also not realizing that if -#head
version of library is installed, nimble install X
would download the latest tag, but nimble build would still use -#head
, which might be older that latest tag.
notes for the future:
- pin requirements version