godex icon indicating copy to clipboard operation
godex copied to clipboard

Godex doesn't compile as godot module

Open navx2810 opened this issue 3 years ago • 14 comments

Hi. I'm trying to build Godex from the latest Godot master branch 364ea7f280a3f074795e542b16b1d0ec76cf6ce2.

I am using MSVC and building for windows. The error I'm getting is:

Linking Program        ==> bin\godot.windows.tools.64.exe
   Creating library bin\godot.windows.tools.64.lib and object bin\godot.windows.tools.64.exp
module_godex.windows.tools.64.lib(register_types.windows.tools.64.obj) : error LNK2019: unresolved external symbol "public: __cdecl Components3DGizmoPlugin::Components3DGizmoPlugin(void)" (??0Components3DGizmoPlugin@@QEAA@XZ) referenced in function "public: void __cdecl Ref<class Components3DGizmoPlugin>::instance(void)" (?instance@?$Ref@VComponents3DGizmoPlugin@@@@QEAAXXZ)
module_godex.windows.tools.64.lib(ecs.windows.tools.64.obj) : error LNK2019: unresolved external symbol "public: void __cdecl WorldECS::pre_process(void)" (?pre_process@WorldECS@@QEAAXXZ) referenced in function "private: void __cdecl ECS::dispatch_active_world(void)" (?dispatch_active_world@ECS@@AEAAXXZ)
module_godex.windows.tools.64.lib(ecs.windows.tools.64.obj) : error LNK2019: unresolved external symbol "public: void __cdecl WorldECS::post_process(void)" (?post_process@WorldECS@@QEAAXXZ) referenced in function "private: void __cdecl ECS::dispatch_active_world(void)" (?dispatch_active_world@ECS@@AEAAXXZ)
module_godex.windows.tools.64.lib(dynamic_query.windows.tools.64.obj) : error LNK2019: unresolved external symbol "public: class World * __cdecl WorldECS::get_world(void)const " (?get_world@WorldECS@@QEBAPEAVWorld@@XZ) referenced in function "public: void __cdecl godex::DynamicQuery::begin_script(class Object *)" (?begin_script@DynamicQuery@godex@@QEAAXPEAVObject@@@Z)
bin\godot.windows.tools.64.exe : fatal error LNK1120: 4 unresolved externals
scons: *** [bin\godot.windows.tools.64.exe] Error 1120
scons: building terminated because of errors.

Out of curiosity, I tried this setup again from the 28f56e2cbf03a164741f2eade17f9515f887482c commit. I had the same error.

I am able to build Godot from master without Godex installed.

How can I resolve this issue?

Thanks.

navx2810 avatar May 28 '21 16:05 navx2810

Hey, Can you please share some more info on how your project is setup? Is Godex set as Module or external module?

Maybe related to: https://github.com/GodotECS/godex/issues/158

AndreaCatania avatar May 28 '21 16:05 AndreaCatania

Hey @AndreaCatania. Sorry about that. Let me clarify:

I believe it is compiled as a module. I followed the instructions found here.

Is there a different way I should set this up? #158 claims the PR #159 is already merged in. I did run this under master for both Godot and Godex.

Should I try an external module install?

Thanks.

navx2810 avatar May 28 '21 16:05 navx2810

No that's absolutely fine, I was just asking. Sorry for the delay but I'm improving the script systems and bundle usage, so I been a bit busy.

If you can try to compile this as external module it would be useful (since this is the way I'm using it, and the CI is using it). So, we will know for sure if the problem is related to how the Godex module is imported and so if #158 is still relevant. This will allow me to dig into the problem and eventually fix it.

To compile Godex as external module you have to:

  • Clone godot
  • Checkout the tested commit you find on the Readme.md
  • Clone godex just outside the godot directory (or where you prefer)
  • Go inside the repository and compile using scons target=release_debug custom_modules="../godex"

You can find more info on the custom modules here If you need more direct support, you can join the Discord channel here: https://discord.gg/EFmWpf869q

AndreaCatania avatar Jun 01 '21 08:06 AndreaCatania

similar problem for me on linux:

/usr/bin/ld: modules/libmodule_godex.linuxbsd.tools.64.a(register_types.linuxbsd.tools.64.o): in function `Ref<Components3DGizmoPlugin>::instantiate()':
/home/matt/Code/games/godot/godot/./core/object/ref_counted.h:227: undefined reference to `Components3DGizmoPlugin::Components3DGizmoPlugin()'
/usr/bin/ld: modules/libmodule_godex.linuxbsd.tools.64.a(dynamic_query.linuxbsd.tools.64.o): in function `godex::DynamicQuery::begin_script(Object*)':
/my/matt/Code/games/godot/godot/modules/godex/iterators/dynamic_query.cpp:126: undefined reference to `WorldECS::get_world() const'
/usr/bin/ld: modules/libmodule_godex.linuxbsd.tools.64.a(dynamic_query.linuxbsd.tools.64.o): in function `WorldECS* Object::cast_to<WorldECS>(Object*)':
/home/matt/Code/games/godot/godot/./core/object/object.h:629: undefined reference to `typeinfo for WorldECS'
/usr/bin/ld: modules/libmodule_godex.linuxbsd.tools.64.a(ecs.linuxbsd.tools.64.o): in function `ECS::dispatch_active_world()':
/home/matt/Code/games/godot/godot/modules/godex/ecs.cpp:792: undefined reference to `WorldECS::pre_process()'
/usr/bin/ld: /home/matt/Code/games/godot/godot/modules/godex/ecs.cpp:799: undefined reference to `WorldECS::post_process()'
collect2: error: ld returned 1 exit status
scons: *** [bin/godot.linuxbsd.tools.64] Error 1
scons: building terminated because of errors.

running scons platform=linuxbsd target=release_debug custom_modules="../godex" works fine

matthew-salerno avatar Jun 29 '21 20:06 matthew-salerno

@matthew-salerno perfect thanks!

AndreaCatania avatar Jun 30 '21 08:06 AndreaCatania

I get the same issue

No that's absolutely fine, I was just asking. Sorry for the delay but I'm improving the script systems and bundle usage, so I been a bit busy.

If you can try to compile this as external module it would be useful (since this is the way I'm using it, and the CI is using it). So, we will know for sure if the problem is related to how the Godex module is imported and so if #158 is still relevant. This will allow me to dig into the problem and eventually fix it.

To compile Godex as external module you have to:

  • Clone godot
  • Checkout the tested commit you find on the Readme.md
  • Clone godex just outside the godot directory (or where you prefer)
  • Go inside the repository and compile using scons target=release_debug custom_modules="../godex"

You can find more info on the custom modules here If you need more direct support, you can join the Discord channel here: https://discord.gg/EFmWpf869q

I attempted following these steps and running scons platform=windows target=release_debug custom_modules="../godex". Unfortunately, I am encountering this error:

Compiling ==> D:\workspace\godot\godex\modules\godot\systems\physics_process_system.cpp
physics_process_system.cpp
D:\workspace\godot\godex\modules\godot\systems\physics_process_system.cpp(15): error C2039: 'set_in_physics_frame': is not a member of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\../databags/godot_engine_databags.h(6): note: see declaration of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\physics_process_system.cpp(19): error C2039: 'set_in_physics_frame': is not a member of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\../databags/godot_engine_databags.h(6): note: see declaration of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\physics_process_system.cpp(53): error C2039: 'set_physics_frames': is not a member of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\../databags/godot_engine_databags.h(6): note: see declaration of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\physics_process_system.cpp(76): error C2039: 'set_in_physics_frame': is not a member of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\../databags/godot_engine_databags.h(6): note: see declaration of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\physics_process_system.cpp(89): error C2039: 'set_in_physics_frame': is not a member of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\../databags/godot_engine_databags.h(6): note: see declaration of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\physics_process_system.cpp(105): error C2039: 'set_physics_frames': is not a member of 'Engine'
D:\workspace\godot\godex\modules\godot\systems\../databags/godot_engine_databags.h(6): note: see declaration of 'Engine'
scons: *** [D:\workspace\godot\godex\modules\godot\systems\physics_process_system.windows.opt.tools.64.obj] Error 2
scons: building terminated because of errors.

navx2810 avatar Jul 14 '21 21:07 navx2810

It looks like the patch wasn't properly applied, since those methods are missing: https://github.com/GodotECS/godex/blob/main/patches/add_custom_iterator.patch#L29-L32

AndreaCatania avatar Jul 15 '21 09:07 AndreaCatania

Just to add more info, when trying to compile on Windows as a module in the current commit, the build fails with

D:\repos\godot\modules\godex\systems/system.h(6): fatal error C1083: Cannot open include file: 'godex/ecs_types.h': No such file or directory
scons: *** [modules\godex\utils\fetchers.windows.tools.64.obj] Error 2
scons: building terminated because of errors.

If I change the 'godex/ecs_types.h' include to 'modules/godex/ecs_types.h' the compiling continues until it breaks with the same message on the opening post of the issue.

Compiling godex as a custom module (scons target=release_debug custom_modules="../godex") worked properly on the current master branch of godot (43a9a9f6803da19c813f2bd9604cab75b444709c)

fnzr avatar Sep 09 '21 12:09 fnzr

I just had the same problem as @fnzr, except I'm on Linux; however, I can verify that compiling https://github.com/godotengine/godot/commit/5f69218edc4f4af574c7a65f077e2e0bf1f28365 (current) with Godex specified as a custom module works fine.


Relatedly, @AndreaCatania, I forked the wiki and drastically updated the setup page, as you can see here. I think it's much easier for new users to follow. It also adds the -j$(nproc) option to scons for building with Linux, taking advantage of all available processor cores.

To my knowledge, I cannot submit a PR for the wiki, so you may want to see these instructions on merging wikis if you think my setup page is an improvement.

reeseschultz avatar Sep 12 '21 15:09 reeseschultz

@reeseschultz Wow, the new Setup wiki is really nice, thanks a lot! :) :)

AndreaCatania avatar Sep 13 '21 17:09 AndreaCatania

@AndreaCatania, you're welcome, but I don't think the code blocks in your update to the setup page are quite right. It looks like you may be trying to fit the ``` blocks on a single line, and if that's the case, you'll want to do just a single `. I see this in all the summary sections.

Anyway, I'll let you know if I update the wikis further.

I'll keep an eye out for when Godex transitions into a native extension; that will definitely warrant more changes to the wikis, good ones nonetheless. As my familiarity increases, I will try to contribute more as I find the time.

reeseschultz avatar Sep 13 '21 18:09 reeseschultz

@reeseschultz I've fixed it, not sure why but I needed to add a new line, like this, to make it work:

<details>
  <summary>MacOS</summary>

  '''
scons platform=osx target=release_debug custom_modules="../godex"
  '''

</details>

AndreaCatania avatar Sep 14 '21 07:09 AndreaCatania

@AndreaCatania Sorry to keep @'ing you—the compilation sections look good, but the SSH and HTTPS sections still need that fix with the newline. Anyway, thanks for incorporating my updates!

Edit: Actually, if you think it would help, I'm happy to volunteer as a technical writer for Godex. I can edit docs and wiki modifications before you publish them, just to make sure we catch these issues ahead of time. We can go back-and-forth on things to ensure you get the verbiage you want. This would be good for me to familiarize myself further with Godot and Godex. If you're interested, we can DM on Discord.

reeseschultz avatar Sep 14 '21 22:09 reeseschultz

@reeseschultz Hey, apparently I didn't test enough that wiki page, even if I'm pretty sure I did :thinking: In any case, fixed now.

If you would like helping with the doc, it would be really helpful so let's continue on godex Discord, I'll be glad to organize things so you can help :metal: :smiley:

AndreaCatania avatar Sep 15 '21 07:09 AndreaCatania