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

IDE can't debug 64 bit application (Windows) #756

Closed
Zueuk opened this issue Apr 10, 2017 · 9 comments
Closed

IDE can't debug 64 bit application (Windows) #756

Zueuk opened this issue Apr 10, 2017 · 9 comments
Assignees

Comments

@Zueuk
Copy link

Zueuk commented Apr 10, 2017

I had an error like this

error loading module 'socket.core' from file 'C:\ZeroBraneStudio/bin/clibs/socket\core.dll':
%1 is not a valid Win32 application.

and fixed it by replacing the said dll with a 64-bit version provided in the issue #500.

This worked for some time, but now I have a similar error every time I try to start ZBStudio:
default

Restoring the old dll makes it work, but obviously debugging now gives the same error as before.

@pkulchenko
Copy link
Owner

@Zueuk, you shouldn't change the library to a 64bit one as it's used by ZeroBrane Studio itself (and since it's a 32bit application, you get the error); you should put the 64bit libraries in the folder of your application and set the package.path and package.cpath to reference that location. Everything should work in terms of running/debugging after that.

I'll update the documentation to cover this.

@Zueuk
Copy link
Author

Zueuk commented Apr 11, 2017

Instruction unclear, getting "lua module 'copas' not found" now.

I'm using Torch located in C:\SomePath\Torch, which has luajit.exe in Torch\bin, but apparently I have to launch it using Torch\luarocks\systree\bin\th.bat
Where should I put core.dll, and which path should I put in package.(c)path (that's in ~/.zbstudio/user.lua - right?)

@pkulchenko
Copy link
Owner

Instruction unclear, getting "lua module 'copas' not found" now.

@Zueuk, this is probably because you replaced whatever path/cpath you had, but you only need to prepend the cpath to 64bit luasocket libs in your application to make sure they are loaded instead of 32bit libs:

package.cpath="d:/path/to/64bit/clibs/?.dll;"..package.cpath

Where should I put core.dll, and which path should I put in package.(c)path (that's in ~/.zbstudio/user.lua - right?)

Doesn't matter where you put it as long as it's the same that you set in package.cpath. This goes into your script before you call the debugger (not in user.lua settings).

@Zueuk
Copy link
Author

Zueuk commented Apr 11, 2017

Ok... Apparently I don't understand something about Lua debugging.
I want to debug some random Lua script in ZBStudio. Who is going to execute this line, if "Start debugging" starts before the 1st script line?

Another thing: I printed the existing package.cpath, and it already has a lot of Torch-related directories in it. I tried putting the 64-bit core.dll in these, but the result is the same as before.

@pkulchenko
Copy link
Owner

You are correct; I assumed you are starting the application from outside of the IDE or from the IDE using Run/F6 command. It's not going to work the way I suggested when you are using F5/Debug, so the current workaround is to use Run command (and include require('mobdebug').start() command explicitly in your script).

Another thing: I printed the existing package.cpath, and it already has a lot of Torch-related directories in it. I tried putting the 64-bit core.dll in these, but the result is the same as before.

This should work as long as the path with your 64bit core.dll is the first one being picked up by the require. You can check how the paths are searched by running package.searchpath("socket.core", package.cpath) from the Local console.

@Zueuk
Copy link
Author

Zueuk commented Apr 12, 2017

Aha! So it was looking for "socket/core.dll", not just the dll.
Moved it into the subdir and now debugging seems to be working.
Thanks!

@pkulchenko
Copy link
Owner

Sounds good; will make sure it's covered in the documentation.

@pkulchenko pkulchenko changed the title Windows: ZBS either can't debug, or won't run at all IDE can't debug 64 bit application (Windows) Apr 16, 2017
@xianzhiliao
Copy link

replace socket 64 still have problems
image

@pkulchenko
Copy link
Owner

@xianzhiliao, you should not be replacing modules in the IDE folders as some of them are used by the IDE itself (and in this case you replaced a 32bit module with a 64bit version, which caused a conflict and the error).

You should put the modules into its own folder where your application can access them.

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

No branches or pull requests

3 participants