FFI: ExternFile::filename should be relative to the nit-compile dir
[nit.git] / src / interpreter / dynamic_loading_ffi / on_demand_compiler.nit
index 44f6854..acd783a 100644 (file)
@@ -404,7 +404,7 @@ redef class ExternCFile
                var cflags = mmodule.cflags[""].join(" ") + " " + pkg_cflags
                var obj = compile_dir / filename.basename(".c") + ".o"
 
-               var cmd = "{v.c_compiler} -Wall -c -fPIC -I {compile_dir} -g -o {obj} {filename} {cflags}"
+               var cmd = "{v.c_compiler} -Wall -c -fPIC -I {compile_dir} -g -o {obj} {compile_dir / filename} {cflags}"
                if sys.system(cmd) != 0 then
                         v.fatal "FFI Error: Failed to compile C code using `{cmd}`"
                         return false