yglukhov / nimx

GUI library
MIT License
1.09k stars 75 forks source link

Error: Cannot open main.nim #368

Closed me2beats closed 5 years ago

me2beats commented 5 years ago

Got that error cannot open main.nim

I see this printed many times in cmd console (I'm on win7 64) like this:

Error: cannot open 'main.nim'
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: main [Processing]
Error: cannot open 'main.nim'
Hint: widestrs [Processing]
...

and finally every time nakefile.exe reports abnormal shutdown

Tho I can see that nakefile.exe and build folder are created.

my nakefile.nim is import nimx/naketools

and in cmd I write nake -d:release droid.

The content of main.nim is from this page https://github.com/yglukhov/nimx

I got this error yesterday. I'm very new to nim lang so my main goal is just compile some hello world example to make it run on android.

Before that (yesterday as well) I got SDK, NDK and SDL (HOME) not found in env vars, so for sdk/ndk I downloaded Android Studio and specify sdk/ndk paths, And for SDL I downloaded sdl2.dll to some folder and specified this path in env vars too.

Could this cause the problem I have?

0xACE commented 5 years ago

It's very unclear to me what you are trying to do.

My best guess is that you meant to nimble install && cd test && nake -d:release droid

But try building on nake -d:release default before you even try droid.

Finally I believe that this shouldn't be brought up here as it is not a issue with the library, rather a user error or lack of better documentation...

me2beats commented 5 years ago

nake -d:release default works without errors (only 1 warning — icon was not found`. Btw this doesn't work if I don't place sdl2 inside main.nim folder. And NimXApp.exe in build folder doesn't work as well (if I don't place sdl2.dll next to it)

I just want to make This hello world program run on Android. So I just followed this tutorial https://github.com/yglukhov/nimx/blob/master/doc/building-for-different-platforms.md

me2beats commented 5 years ago

PS just tried devel version https://github.com/nim-lang/nightlies/releases/tag/2019-08-28-devel-20dec10

Still get cannot open 'main.nim' https://imgur.com/a/x3ks6Xr

tho with this devel version, before that error, I could see gradle installation and unpacking

Before this devel version I had nim 0.20.2 (from the official site)

me2beats commented 5 years ago

also I get these errors https://pastebin.com/C1vUJ1bC

me2beats commented 5 years ago

After I set NDK_HOME to '...Local\Android\Sdk\ndk\20.0.5594570' it seems ndk is found (before that I set it to '...Local\Android\Sdk\ndk`)

but still cannot open main.nim. I guess because of this:

droidManifest.xml; lineNumber: 19; columnNumber: 19; Element type "activity" mus
t be followed by either attribute specifications, ">" or "/>".```

C:\Users[..].nimble\pkgs\nimx-0.1\nimx\naketools.nim(667) build C:\Users[..].nimble\pkgs\nimx-0.1\nimx\naketools.nim(466) makeAndroidBuildD ir C:\Users[..]\Desktop\nim\nim-0.20.2\lib\pure\os.nim(1534) copyFile C:\Users[..]\Desktop\nim\nim-0.20.2\lib\pure\includes\oserr.nim(94) raiseOSE rror```

yglukhov commented 5 years ago

Were you prompted with SDL_HOME env var requirement? If yes, what did you set it to? For android and iOS SDL_HOME has to point to the root of SDL2 source code.

yglukhov commented 5 years ago

Also it's better to start without -d:release as it imposes more requirements, like signing, etc.

me2beats commented 5 years ago

As for SDL_HOME: yes, I had errors something like SDL_HOME not exists in env vars. So I set it to C:\SDL, [I placed sdl2.dll from official sdl site to that folder].

As for without -d:release Same error with only nake droid

I think I missed some detail because I'm very new to nim.

... Well I can see SDL2 source code in your message above. Do you mean I need to place sdl2 Source to C:\SDL, not dll? Or Both?

yglukhov commented 5 years ago

Do you mean I need to place sdl2 Source to C:\SDL, not dll? Or Both?

You need to place sdl2 source code to C:\SDL, not the dll. After you do this, make sure to zap the build folder in nimx repo, and try nake again.

me2beats commented 5 years ago

How to make sure to zap the build folder in nimx repo?

yglukhov commented 5 years ago

In the directory where you run nake, delete the build subdir.

me2beats commented 5 years ago

yes I do this every time.

Still have

Error: cannot open 'main.nim'

but now I can see something new: https://pastebin.com/NwZxBeQk

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_121
 contains a valid JDK installation.

now I'm trying to google it

me2beats commented 5 years ago

I copied tools.jar like here https://stackoverflow.com/a/51317008

Now I get these errors (besides cannot open 'main.nim') https://pastebin.com/zH1R4PRi

yglukhov commented 5 years ago

I've tried to reproduce in on a windows 10 vm, ran into all sorts of stupid issues, but still succeeded in the end and couldn't reproduce the cannot open main.nim.

Now regarding the opengl bug you're having, I think it's a windows-specific ndk bug paired with the fact that there's a # char in the c source file name. To work it around, rename %HOME%/.nimble/pkgs/opengl-#head to %HOME%/.nimble/pkgs/opengl-0.1. This should get you a bit further.

me2beats commented 5 years ago

Ok I'll try it Btw I can see # in these folders as well

asynctools-#pr_fix_compilation
sdl2_nim-#master
me2beats commented 5 years ago

Ok, I give up so far :) Don't have much time for this I'll try to solve it later. And because of my problem is too specific and difficult to reproduce, I think for now I can close this issue. Thanks for the support