Skip to content

Cannot compile projects with emsdk 4.0.9 #24398

Open
@Honya2000

Description

@Honya2000

Hello,

Today i updated emsdk to 4.0.9 and suddenly all my projects aren't compilable anymore.
There ar several issues...
But currently i'm stuck with callbacks solution:
In emscripten binding i pass emscripten::val parameter as lambda callback:

    .function("processInputBuf", &NativeEngineAI::processInputBuf, allow_raw_pointers())

The function is declared like this
  bool processInputBuf(uintptr_t buf, int width, int height, uint64_t timeStamp,
#ifdef __EMSCRIPTEN__
    emscripten::val lambda
#else
    CallbackFrame lambda
#endif
  );

And callback is invocked this way:

#ifdef __EMSCRIPTEN__
  // Convert GpuBuffer to ImageFrame.
  MP_RETURN_IF_ERROR(_gpu_helper.RunInGlContext([&packet, buf, this]() -> absl::Status 
    {
      auto& gpu_frame = packet.Get<mediapipe::GpuBuffer>();
      buf->maskTexture = this->_gpu_helper.CreateSourceTexture(gpu_frame);

      buf->m_callBack(buf);
      delete buf;

      return absl::OkStatus();
    }));
#endif

This code was working 3 years. Currently it throws error on line:
buf->m_callBack(buf);

C:\Projects\emsdk\upstream\emscripten\cache\sysroot/include\emscripten/wire.h:124:19: error: static assertion failed due to requirement '!std::is_pointer<SFrameBuf *>::value': Implicitly binding raw pointers is illegal.  Specify allow_raw_pointer<arg<?>>
  124 |     static_assert(!std::is_pointer<T*>::value, "Implicitly binding raw pointers is illegal.  Specify allow_raw_pointer<arg<?>>");
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Projects\emsdk\upstream\emscripten\cache\sysroot/include\emscripten/wire.h:147:26: note: in instantiation of template class 'emscripten::internal::TypeID<SFrameBuf *>' requested here
...
/engine-tmrw/apps/Session.cpp:226:22: note: in instantiation of function template specialization 'emscripten::val::operator()<SFrameBuf *const &, emscripten::allow_raw_pointers>' requested here
  226 |       buf->m_callBack(buf);

I tried to change the line this way:
buf->m_callBack(buf, allow_raw_pointers());

But this didn't help. It still throws error on the same line.

So how should i handle emsscripten callbacks now?

P.S SFrameBuf structure which i pass to callback is emscripten bound type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions