Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't use openMP in nim_2.0, and it needs to put dll files ,like libgomp-1, the same folder to built exe file to execute it. #43

Open
kiyoken1594 opened this issue Sep 4, 2024 · 0 comments

Comments

@kiyoken1594
Copy link

Hello, I've been trying to use OpenMP in windows,nim 2.0.8, but some errors occurred.

Firstly, it can't be built in nim 2.0.
I tryed to build examples/ex02_omp_parallel_for.nim, but gcc couldn't built it.
This is the error log.
C:\Users\User\nimcache\ex02_omp_parallel_for_r\@mex02_omp_parallel_for.nim.c: In function 'doOp__ex485095omp95parallel95for_u5':
C:\Users\User\nimcache\ex02_omp_parallel_for_r\@mex02_omp_parallel_for.nim.c:97:98: error: invalid branch to/from OpenMP structured block
97 | if (idx < 0 || idx >= (*s_p0).len){ raiseIndexError2(idx,(*s_p0).len-1); goto BeforeRet_;
| ^~~~
C:\Users\User\nimcache\ex02_omp_parallel_for_r\@mex02_omp_parallel_for.nim.c:99:98: error: invalid branch to/from OpenMP structured block
99 | if (idx < 0 || idx >= (*s_p0).len){ raiseIndexError2(idx,(*s_p0).len-1); goto BeforeRet_;
| ^~~~
C:\Users\User\nimcache\ex02_omp_parallel_for_r\@mex02_omp_parallel_for.nim.c:103:98: error: invalid branch to/from OpenMP structured block
103 | if (idx < 0 || idx >= (*s_p0).len){ raiseIndexError2(idx,(*s_p0).len-1); goto BeforeRet_;
| ^~~~
Error: execution of an external compiler program 'gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -fopenmp -O3 -fno-strict-aliasing -fno-ident -fno-math-errno -IC:\Users\kiyok\.choosenim\toolchains\nim-2.0.8\lib -IC:\Users\User\source\repos\nim_test\laser-master\examples -o C:\Users\User\nimcache\ex02_omp_parallel_for_r\@mex02_omp_parallel_for.nim.c.o C:\Users\User\nimcache\ex02_omp_parallel_for_r\@mex02_omp_parallel_for.nim.c' failed with exit code: 1
And this is c file.
@mex02_omp_parallel_for.nim.c.txt

I can build it in version 1.6 or lower. But there is the other problem.

Second, to run a built exe, it must put dll files in the same folder as the exe.
When I try to execute the exe, it says "The code execution cannot proceed becouse libgomp-1. dll was not found. Reinstalling the program may fix this problem.".
I was able to fix it by copying the dll files, which are libgomp-1.dll, libwinpthread-1.dll, libdl.dll and libgcc_s_seh-1.dll, to the folder.
I suspect that these libraries weren't linked statically at compile time.

Could you tell me how to fit them?


These is my environment.
OS : Windows 10 Home
version : 22H2
OS build : 19045.4780
my tried nim versions
: nim-1.0.8
: nim-1.4.0
: nim-1.6.0
: nim-1.6.20
: nim-2.0.0
: nim-2.0.8
gcc version
: gcc.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 11.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@kiyoken1594 and others