8000 protoc.js fails to generate CPP files from .proto file in WASM compilation · Issue #232 · protocolbuffers/protobuf-javascript · GitHub
[go: up one dir, main page]

Skip to content

protoc.js fails to generate CPP files from .proto file in WASM compilation #232

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

Open
BottleHe opened this issue Mar 18, 2025 · 2 comments
Open
Labels
question Further information is requested triaged Issue has been triaged

Comments

@BottleHe
Copy link

Hello,

While attempting to compile the library into WebAssembly (WASM), I found that the generated protoc.js cannot generate CPP files. It reports an error indicating that the proto file cannot be found. I used emsdk for the compilation.

The compilation process is as follows:

emcmake cmake -S protobuf-30.1/ -B build/ -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/home/username/WASM/protobuf-30.1 -DCMAKE_TOOLCHAIN_FILE=$(dirname $(which emcc))/cmake/Modules/Platform/Emscripten.cmake

cd build && emmake make -j 12

My .proto file content:

syntax = "proto2";

message test {
    required int32 mid = 1;
    required string content = 2;
}

When I try to use node protoc.js --cpp_out=. message.proto in the compilation directory, the following error occurs:

username@UserPC:~/Source/protobuf/build$ node protoc.js --cpp_out=. message.proto 
Could not make proto path relative: message.proto: No such file or directory

username@UserPC:~/Source/protobuf/build$ node -v
v21.7.3

I have tried this on both Ubuntu 22.04 and MacOS 13.6, and the results are consistent.

@dibenede
Copy link
Contributor

This library only generates js code for proto messages (via --js_out. We are the protoc-gen-js plugin for protoc.

It sounds like your issue is with protoc itself. Could you please file an issue against https://github.com/protocolbuffers/protobuf ?

@dibenede dibenede added question Further information is requested triaged Issue has been triaged labels Mar 18, 2025
@BottleHe
Copy link
Author

Ok, Thanks. I seem to have filled this question in the wrong place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested triaged Issue has been triaged
Projects
None yet
Development

No branches or pull requests

2 participants
0