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

No operator = matches these operands #56543

Open
liyuankunbix opened this issue Jan 10, 2025 · 1 comment
Open

No operator = matches these operands #56543

liyuankunbix opened this issue Jan 10, 2025 · 1 comment

Comments

@liyuankunbix
Copy link

liyuankunbix commented Jan 10, 2025

Version

22.13.0

Platform

macOS 11.2.3
Darwin MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Subsystem

No response

What steps will reproduce the bug?

I try to compile and build nodejs 22.13.0 from source. Below is the command I use to compile.

./configure \
  --prefix=/usr/local/Cellar/node@22/22.13.0 \
  --with-intl=system-icu \
  --shared-libuv \
  --shared-nghttp2 \
  --shared-openssl \
  --shared-zlib \
  --shared-brotli \
  --shared-cares \
  --shared-libuv-includes=/usr/local/opt/libuv/include \
  --shared-libuv-libpath=/usr/local/opt/libuv/lib \
  --shared-nghttp2-includes=/usr/local/opt/libnghttp2/include \
  --shared-nghttp2-libpath=/usr/local/opt/libnghttp2/lib \
  --shared-openssl-includes=/usr/local/opt/openssl@3/include \
  --shared-openssl-libpath=/usr/local/opt/openssl@3/lib \
  --shared-brotli-includes=/usr/local/opt/brotli/include \
  --shared-brotli-libpath=/usr/local/opt/brotli/lib \
  --shared-cares-includes=/usr/local/opt/c-ares/include \
  --shared-cares-libpath=/usr/local/opt/c-ares/lib \
  --openssl-use-def-ca-store
make -j12 install

And I got the error output

No operator = matches these operands 
deps/v8/src/wasm/wasm-engine.cc line 157 col 19

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior? Why is that the expected behavior?

Build passed.

What do you see instead?

The error output

No operator = matches these operands 
deps/v8/src/wasm/wasm-engine.cc line 157 col 19

Additional information

The error comes from source_url_ = String::cast(script->name())->ToCString(); which locates in the line157 of deps/v8/src/wasm/wasm-engine.cc.

I do believe that it is because the code is try to construct a std::shared_ptr instance from a std::unique_ptr instance using = copy assignment.

I tried the following modification, and the build succeed.

      // source_url_ = String::cast(script->name())->ToCString();
      auto unique_pointer = String::cast(script->name())->ToCString();
      auto raw_pointer = unique_pointer.get();
      auto shared_pointer = std::shared_ptr<const char[]>(raw_pointer);
      source_url_ = shared_pointer;

However, I cannot make sure whether the modification is correct since I don't know whether the std::shared_ptr object shall take the ownership of the data or it shall create a copy while leave the ownership to the std::unique_ptr.

Please check that.

@liyuankunbix
Copy link
Author

Shall I use the following modification instead?

      auto unique_pointer = String::cast(script->name())->ToCString();
      auto raw_pointer = unique_pointer.get();
      source_url_ = std::shared_ptr<const char[]>(raw_pointer, [unique_pointer = std::move(unique_pointer)](const char*) mutable {
        unique_pointer.reset();
      });

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

1 participant