futhark icon indicating copy to clipboard operation
futhark copied to clipboard

mupdf: Error: Unknown kind in findAlias

Open mantielero opened this issue 11 months ago • 1 comments

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":"???"}

mantielero avatar Mar 12 '25 21:03 mantielero

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.

PMunch avatar Mar 17 '25 10:03 PMunch