Open
Description
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.