futhark
futhark copied to clipboard
mupdf: Error: Unknown kind in findAlias
I was trying to wrap mupdf in ArchLinux:
# nim --maxLoopIterationsVM:10000000000 c -d:futharkRebuild create
# nim c -d:futharkRebuild -d:nodeclguards -d:noopaquetypes create
import futhark,os
importc:
outputPath currentSourcePath.parentDir / "fitz.nim"
path "/usr/include/"
"mupdf/fitz.h"
and I get:
$ nim --maxLoopIterationsVM:10000000000 c -d:futharkRebuild -d:nodeclguards -d:noopaquetypes create
...
/home/jose/.nimble/pkgs2/futhark-0.15.0-50ab2e44c9d5cc99ba1c85032b63c1086c71371c/futhark.nim(779, 14) template/generic instantiation of `importcImpl` from here
/home/jose/.nimble/pkgs2/futhark-0.15.0-50ab2e44c9d5cc99ba1c85032b63c1086c71371c/futhark.nim(271, 14) Error: Unknown kind in findAlias: {"kind":"invalid","value":"???"}
This appears to be due to missing support for the types Complex and Float128 as seen in the output of Opir when Futhark is run:
Unknown type kind: 100: Complex
Unknown type kind: 30: Float128
To fix this we need to figure out how to wrap these in Nim. The biggest float type officially supported by Nim is 64-bits. And the Complex type is probably a similar story. However there might be flags you can pass to the compilation to disable these features for platforms which don't support them, so that might be a faster way to get around this.