Closed 29th-Day closed 1 month ago
The problem is actually not the wrapper, but Futharks code itself. There's a bug in Nim where the target is the only thing deciding whether or not the os module is available. So even if you're compiling from a host with the os module available, as long as the target doesn't have it then it's not available even for macros. The way to solve it is to use a two step process. Have one program run and create the wrapper, making sure to pass all the right flags to the C compiler (Futhark doesn't inherit the passC and passL's of the program, you need to set these in the importc block). Then a second program which uses the wrapper from the first and compiles with --os:any
. This is what I do for my FreeRTOS wrapper.
I'm trying to create a wrapper for a library on an embedded device and I use the
--os:any
flag when compiling my code. Therefore, theos
module is not available butfrom is import parentDir
is present in every wrapper file but never used. Why is this present and is there an automatic way of avoiding it?My nim file for creating the wrapper looks like this