Skip to content

Issue Occurring running protoc-gen-js command on windows 11 #142

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

Closed
gitcrumbs opened this issue Oct 9, 2022 · 15 comments · Fixed by #166
Closed

Issue Occurring running protoc-gen-js command on windows 11 #142

gitcrumbs opened this issue Oct 9, 2022 · 15 comments · Fixed by #166
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation packaging & distribution triaged Issue has been triaged

Comments

@gitcrumbs
Copy link

gitcrumbs commented Oct 9, 2022

Two errors :

  1. libstdsc++-6.dll was not found
  2. libwinpthread-1.dll was not found

image

image.

image

#Unable to generate js files using protoc-gen-js files

@dibenede
Copy link
Contributor

Can you please describe your setup?

One thing we didn't mention in the release notes for the binaries is that the windows one is built for mingw. We do not presently have a visual studio version. Additionally, the prebuilt protoc-gen-js binaries are dynamically linked, so wondering if it's a version mismatch.

@dibenede dibenede added the question Further information is requested label Oct 10, 2022
@gitcrumbs
Copy link
Author

gitcrumbs commented Oct 10, 2022

image

I added this exe file in the environment variables path and trying to generate the files using protoc command.
I get the below error on executing the command.

image

image

@heggi
Copy link

heggi commented Oct 17, 2022

I rebuilt this project using bazel and VS Build Tools 2019.
New exe-file works fine.

I think the original file was built via mingw with dynamic library which is not included in archive.
But I didn't find a way to build via mingw.

@Cmc0
Copy link

Cmc0 commented Oct 25, 2022

I also encountered this problem, please help me ! ! !

@dibenede
Copy link
Contributor

We dynamically link against libstdc++ and do not provide a DLL with the expectation that it and other dependencies are already in your PATH. Can you confirm if you already have libstdc++ available?

@dibenede dibenede assigned dibenede and unassigned gitcrumbs Oct 25, 2022
@heggi
Copy link

heggi commented Oct 25, 2022

Libraries libstdc++-6.dll and libwinpthread-1.dll does not exists in OS Windows by default.
Installing MinGW only to get two libraries is not a good idea for js developers.
Also MinGW installer doesn't copy libraries to any (system) directory where program can find it.

@dibenede
Copy link
Contributor

Thank you for the info. For this particular plugin, we expected users to have MinGW. However, if the installer isn't placing the libraries anywhere useful, then we have a problem. At a minimum we should document the steps required to get it running.

We can also look into the feasibility of distributing the DLLs themselves. Ideally we would use static linking, but it's just not how we're setup at present.

@dibenede dibenede added bug Something isn't working documentation Improvements or additions to documentation packaging & distribution triaged Issue has been triaged and removed question Further information is requested labels Oct 25, 2022
@Gateswong
Copy link

Gateswong commented Dec 18, 2022

+1 to this problem.

I have tried several pre-built version of MinGW libraries, when I copy the dlls into same folder where protoc-gen-js located, the error from #issue-1402244641 disappeared. Instead, showing an another error:

image

protoc-gen-js is from https://github.com/protocolbuffers/protobuf-javascript/releases/download/v3.21.2/protobuf-javascript-3.21.2-win64.zip

@3107RU
Copy link

3107RU commented Dec 18, 2022

+1

1 similar comment
@lucannez64
Copy link

+1

@invokermain
Copy link

Similar to @Gateswong, having found and added those two .dll's to the same directory as the protoc-gen-js executable I still fail to run the protoc command:

> protoc --js_out=import_style=commonjs:grpc proto/tv.proto
--js_out: protoc-gen-js: Plugin failed with status code 3221225781.

It doesn't help that the error message is basically meaningless.

@invokermain
Copy link

For what it's worth I just generated the client I wanted inside WSL and copied files back into windows. Doesn't take that long.

Faster than install c++ redistributables, VS build tools, MinGW etc and finding out none of it helps 😆

@yinzara
Copy link
Contributor

yinzara commented Feb 14, 2023

Using the following I can generate an .exe that works great when run from Powershell with Node 14 installed:

  1. Install VC Tools 2019: choco install visualstudio2019buildtools visualstudio2019-workload-vctools
  2. $env:BAZEL_VC="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC"
  3. git clone https://github.com/protocolbuffers/protobuf-javascript && cd protobuf-javascript
  4. git checkout v3.21.2
  5. npm install
  6. bazel build plugin_files

Get protoc-gen-js.exe from .\bazel-bin\generator

Right now the distributed version (3.21.2) of protoc-gen-js.exe for Windows is effectively useless as there are no work arounds known that allows it to function. I even attempted to use it within MinGW to no avail.

I've recently created the protoc-gen-js npm project (https://github.com/yinzara/protoc-gen-js) that creates a simple way of getting the appropriately compiled binary available on any supported OS however it's currently ineffective for Windows because of this issue.

I have to say the sudden an unannounced decision to remove the "protoc-gen-js" plugin from being built into protoc yet not actually making it function separately for all supported platforms has made us have to lock our protoc to an old unsupported version for all languages now. Prevents us from properly using proto3 optional and other newer features across our enterprise. Makes 3rd party protobuf projects like ProtobufJS and buf's Protobuf-ES actually be better supported than the reference implementation plugins.

I assume your normal internal build tools that currently make the releases will always use MinGW and using a different environment is hard or impossible.

What if you disabled the release for the win32 and win64 assets in Github from that internal tool and instead used Github Actions?

A community member (I'd be happy to) could submit a github actions configuration and you could use that to do the release of just the windows binaries.

@dibenede
Copy link
Contributor

Sorry for the delay; I was trying to see if I could get the build going, but running into problems that would take some time to sort through. We don't have an inherent limitation preventing windows builds; the current setup is just an artifact of what support was available to me at the time (it's bootstrapped off the work of others).

That said, if you or anyone else is able to contribute a GitHub Action, I think that would significantly improve the situation. My main request is that the action pull down a pre-built protoc from the official GitHub project like we currently do in our other actions.

Feel free to assign the review directly to me.

@dibenede
Copy link
Contributor

I've just updated the latest release with new protoc-gen-js binaries for win32/64 (thanks again @yinzara for the build actions that produced them).

Please let me know if you encounter any issues with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation packaging & distribution triaged Issue has been triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants