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

build issue: create_table_with (emscripten) #1626

Closed
hsdk123 opened this issue Sep 12, 2024 · 5 comments
Closed

build issue: create_table_with (emscripten) #1626

hsdk123 opened this issue Sep 12, 2024 · 5 comments

Comments

@hsdk123
Copy link

hsdk123 commented Sep 12, 2024

Hi, I'm getting the following error while building on emscripten:

In file included from D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/sol.hpp:58:
In file included from D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state.hpp:27:
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:855:11: error: call to member function 'create_table_with' is ambiguous
  855 |                         return create_table_with(lua_state(), std::forward<Args>(args)...);
      |                                ^~~~~~~~~~~~~~~~~
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:77:14: note: in instantiation of function template specialization 'sol::state_view::create_table_with<const std::string &, void *&>' requested here
   77 |                                 loaded = create_table_with(key, sr);
      |                                          ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:96:5: note: in instantiation of function template specialization 'sol::state_view::ensure_package<void *>' requested here
   96 |                                 ensure_package(key, static_cast<void*>(L));
      |                                 ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:219:11: note: in instantiation of function template specialization 'sol::state_view::require_core<(lambda at D:\a\Light.vn-core\Light.vn-core\_deps\sol2\9d60b8d5f5d9991dfff0de5dea2635b2925ea792\include\sol\state_view.hpp:218:18) &>' requested here
  219 |                         return require_core(key, action, create_global);
      |                                ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:854:9: note: candidate function [with Args = <lua_State *, const std::string &, void *&>]
  854 |                 table create_table_with(Args&&... args) {
      |                       ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:868:23: note: candidate function [with Args = <const std::string &, void *&>]
  868 |                 static inline table create_table_with(lua_State* L, Args&&... args) {
      |                                     ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:855:11: error: call to member function 'create_table_with' is ambiguous
  855 |                         return create_table_with(lua_state(), std::forward<Args>(args)...);
      |                                ^~~~~~~~~~~~~~~~~
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:77:14: note: in instantiation of function template specialization 'sol::state_view::create_table_with<const std::string &, sol::stack_reference &>' requested here
   77 |                                 loaded = create_table_with(key, sr);
      |                                          ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:102:4: note: in instantiation of function template specialization 'sol::state_view::ensure_package<sol::stack_reference &>' requested here
  102 |                         ensure_package(key, sr);
      |                         ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:219:11: note: in instantiation of function template specialization 'sol::state_view::require_core<(lambda at D:\a\Light.vn-core\Light.vn-core\_deps\sol2\9d60b8d5f5d9991dfff0de5dea2635b2925ea792\include\sol\state_view.hpp:218:18) &>' requested here
  219 |                         return require_core(key, action, create_global);
      |                                ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:854:9: note: candidate function [with Args = <lua_State *, const std::string &, sol::stack_reference &>]
  854 |                 table create_table_with(Args&&... args) {
      |                       ^
D:/a/Light.vn-core/Light.vn-core/_deps/sol2/9d60b8d5f5d9991dfff0de5dea2635b2925ea792/include\sol/state_view.hpp:868:23: note: candidate function [with Args = <const std::string &, sol::stack_reference &>]
  868 |                 static inline table create_table_with(lua_State* L, Args&&... args) {

      |                                     ^

2 errors generated.

@hsdk123 hsdk123 changed the title creat_table_with ambiguity (emscripten) build issue: create_table_with (emscripten) Sep 14, 2024
@deadlocklogic
Copy link
Contributor

No minimal repro?
Can you reproduce this issue on other platforms?

@hsdk123
Copy link
Author

hsdk123 commented Oct 5, 2024

No minimal repro?

Nope, my code doesn't even use create_table_with.
Seems like a similar issue to #1611

Can you reproduce this issue on other platforms?

Nope, just emscripten. With code that worked prior - now failing to build after perhaps an emscripten update.

@deadlocklogic
Copy link
Contributor

Without a minimal repro I doubt anyone could help you then.
You need to isolate your issue so we can assist you further.

@hsdk123
Copy link
Author

hsdk123 commented Oct 5, 2024

Without a minimal repro

  1. As stated above, the function is not used in my code hence a minimal repo doesn't seem feasible.
  2. As also stated above, and the linked closed PR, this is likely due to the emscripten compiler doing more checks.

Considering 1 and 2, I believe that a minimal reproducible example would be created by just adding a github action to this repo that attempts to compile the sol code with emscripten.

@deadlocklogic
Copy link
Contributor

I am afraid to tell you that your issue won't likely be solved without a repro.
I even was able to compile sol2 from develop branch, with lua and box2d from vcpkg to webassembly via emscripten with complete ease.
Here my sample example which I compiled:

#include <iostream>
#include <sol/sol.hpp>

int main() {
  sol::state lua;
  int x = 0;
  lua.set_function("beep", [&x] { ++x; });
  lua.script("beep()");
  std::cout << "The value was: " << x << std::endl;
}

So again, I am on Windows11, develop branch of sol2, with no problems compiling with emscpriten.

@hsdk123 hsdk123 closed this as completed Oct 8, 2024
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