EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.72k stars 287 forks source link

C# exception unable to load "emmy_core" when trying to use Emmy Debugger (NEW) in tolua Unity project #513

Closed david-grem-armstrong closed 1 year ago

david-grem-armstrong commented 1 year ago

Environment(环境)

name version
IDEA version RD-222.4459.9
EmmyLua version v 1.3.7.2-IDEA222
OS OSX 12.6

What are the steps to reproduce this issue?(重现步骤?)

  1. have a Unity project that is using the "tolua" plugin
  2. add appropriate code for emmy debugger

package.cpath = package.cpath .. '' //this ends with "?.dylib" is that correct? local dbg = require('emmy_core') dbg.tcpListen('localhost', 3001) dbg.waitIDE()

  1. attempt to run Unity

What happens?(出现什么问题?)

An exception is thrown: error loading module 'emmy_core' from file '': dynamic libraries not enabled; check your Lua installation

Based on a translation of this post https://www.jianshu.com/p/571422aeb5b0 It seems that I need to "recompile the module where the lua c code is located to include LUA_USE_MACOSX and add -DLUA_USE_DLOPEN to the cmake file". But I don't understand where that is.

What were you expecting to happen?(期望?)

I should be able to reasonably easily add a bit of lua code to have EmmyLua/Rider add breakpoints into lua code.

Any logs, error output, etc?(有没有什么log, error输出?)

See errors above.

Any other comments?(其它说明)

Thank you for your assistance.

CppCXY commented 1 year ago

Tolua doesn't have a cmakelists(but xlua have), you can go to luaconfig.h and add #define LUA_USE_DLOPEN and #define LUA_USE_MACOSX recomplie tolua. after replacement, restart unity.

david-grem-armstrong commented 1 year ago

after a bit of hoop jumping, I got this to work with the above suggestion. Thanks!

chebedzic commented 4 months ago

Hey @david-grem-armstrong can you please give a little bit more information, it would mean a lot to me.

Where did you find the luaconfig.h? How did you rebuild it?

Or any other useful links would be helpfull.

david-grem-armstrong commented 4 months ago

I was able to get the source code of the Tolua plugin and build the dylib in an xCode project with the modifications recommended above.