Open mjfh opened 7 years ago
@mjfh in my project's nim.cfg I'm using this:
# Windows cross-compile via mingw
@if crosswin:
gcc.linkerexe = "x86_64-w64-mingw32-gcc"
gcc.exe = "x86_64-w64-mingw32-gcc"
gcc.path = "/usr/bin"
gcc.options.linker = ""
os = "windows"
define:windows
@end
@mjfh oh, yeah, your example hangs forever on compilation even on my PC with mingw 64bits...
lol - this was my surprise as well.
Problem is that the MinGW compiler aborts with errors (see the NIM forum thread).
My solution is basically here.
And NIM correctly reports errors on native NimGW but this has a different process mangement. I do not see this annoyance a high priority as it is easily circumvented. It is just a bit annoying. So people should just know about.
Jordan
Same issue on Debian. Running command via --listCmd:
gcc -c -w -mno-ms-bitfields -I/usr/x86_64-w64-mingw32/include/ \
-static -I/home/jamieson/nim-0.17.2/lib -o /home/jamieson/nim-0.17.2/nimcache/stdlib_md5.o \
/home/jamieson/nim-0.17.2/nimcache/stdlib_md5.c'
results in (tail end):
/home/jamieson/nim-0.17.2/nimcache/stdlib_md5.c:1247:1: error: expected ‘{’ at end of input
}
^
In file included from /usr/x86_64-w64-mingw32/include/minwindef.h:146:0,
from /usr/x86_64-w64-mingw32/include/windef.h:8,
from /usr/x86_64-w64-mingw32/include/windows.h:69,
from /home/jamieson/nim-0.17.2/nimcache/stdlib_md5.c:12:
/usr/x86_64-w64-mingw32/include/winnt.h:138:25: note: the ABI of passing struct with a flexible array member has changed in GCC 4.4
#define DECLSPEC_IMPORT __declspec (dllimport)
^
/usr/x86_64-w64-mingw32/include/winnt.h:251:18: note: in expansion of macro ‘DECLSPEC_IMPORT’
#define NTSYSAPI DECLSPEC_IMPORT
^
/usr/x86_64-w64-mingw32/include/winnt.h:6895:5: note: in expansion of macro ‘NTSYSAPI’
NTSYSAPI WORD NTAPI RtlCaptureStackBackTrace (DWORD FramesToSkip, DWORD FramesToCapture, PVOID *BackTrace, PDWORD BackTraceHash);
^
Maybe it was just md5, so took out md5; ten it hung on osproc. Also took that out and now strace says it's hanging on 31002.
write(1, "gcc -c -w -mno-ms-bitfields -st"..., 213gcc -c -w -mno-ms-bitfields -static -I/usr/x86_64-w64-mingw32/include/ -I/home/jamieson/nim-0.17.2/lib -o /home/jamieson/nim-0.17.2/nimcache/stdlib_unicode.o /home/jamieson/nim-0.17.2/nimcache/stdlib_unicode.c
) = 213
close(85) = 0
close(86) = 0
close(3) = 0
close(84) = 0
wait4(31002,
jamieson 31002 0.0 0.0 4336 808 pts/5 S+ 21:26 0:00 \_ /bin/sh -c gcc -c -w -mno-ms-bitfields -static -I/usr/x86_64-w64-mingw32/include/ -I/home/jamieson/nim-0.17.2/lib -o /home/jamieson/nim-0.17.2/nimcache/compiler_shim.o /home/jamieson/nim-0.17.2/nimcache/compiler_shim.c
~ strace -p 31002
Process 31002 attached
wait4(-1,
Also hangs on macOS
:
brew install nim mingw-64
mkdir problem && cd problem
problem.nim
:
# nim test file: problem.nim
{.passC: "-DWIN32_LEAN_AND_MEAN".}
var PROV_RSA_FULL {.importc,
header: "
echo ">>> PROV_RSA_FULL=", PROV_RSA_FULL
4. `cat nim.cfg`:
cpu = i386 i386.windows.gcc.path = "/usr/local/bin/" i386.windows.gcc.exe = "i686-w64-mingw32-gcc" i386.windows.gcc.linkerexe = "i686-w64-mingw32-gcc"
5. `env -i PATH=/usr/local/bin:/usr/bin:/bin nim cc --os:windows --verbosity:3 --listCmd problem.nim` hangs.
Unfortunately, I am not skilled enough in `nim` to even call myself a `nim` newbie! so I haven't the first clue of how to debug this.
Possibly an osproc
issue?
@dom96 - if that was to me, the fact I don't even know what osproc
means should tell you at what level I am at with nim
:-). I have spent too many decades being an "enterprise" developer (Java, Spring, Clojure) etc., I am absolutely bowled over with joy as I read about nim
, but it is going to take a while before I can contribute.
@yatesco no worries. I wasn't directing at anyone in particular, just saying it for anyone that wishes to look further into this issue. The osproc
module is the likely culprit.
Glad you're enjoying Nim :)
This is a follow up from the NIM forum trying to avoid polluting it with listings. This is my environment
The problem is reproducible on my system when I dispatch NIM with a clean environment as in
where the source looks like
The NIM compiler just hangs at
which results in a a process table like (some line feeds added)
Just to make sure the context is all right I have a look at the cgroups
Tracing the last MinGW command I get
and the open file streams look like
All the other commands below the NIM compiler are explicitly waiting for the child (wait4(<pid>,..)) except the shell which waits for any child (wait4(-1,..)).
I have no clue what is happening here.