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

GLSL Lint: Failed to spawn 'glslangValidator' binary #34

Closed
lnorton89 opened this issue Mar 8, 2021 · 26 comments
Closed

GLSL Lint: Failed to spawn 'glslangValidator' binary #34

lnorton89 opened this issue Mar 8, 2021 · 26 comments

Comments

@lnorton89
Copy link

lnorton89 commented Mar 8, 2021

Getting the following error after install all prerequisites: GLSL Lint: Failed to spawn 'glslangValidator' binary. Error: spawn /home/lawrence/glslang/bin/glslangValidator ENOENT

I'm on Windows and have tried using the Windows binary as well as the Linux one in WSL and both give different errors with the correct path set: "glsllint.glslangValidatorPath": "/home/lawrence/glslang/bin/glslangValidator",

(base) lawrence@wsl:~/glslang/bin$ ls -l
total 7104
-rwxr-xr-x 1 lawrence lawrence 6495497 Mar  8 11:38 glslangValidator
(base) lawrence@wsl:~/glslang/bin$ pwd
/home/lawrence/glslang/bin
(base) lawrence@wsl:~/glslang/bin$

Using the Windows binary gives different errors:

GLSL Lint: Wrong parameters when starting glslangValidator. Arguments: -l --stdin -S -Ic:\Users\Lawrence\Documents\Synethesia\vein_melter_dup.synScene stderr:
GLSL Lint: GLSL Lint: failed to map file: 'c:\Users\Lawrence\Documents\Synethesia\vein_melter_dup.synScene\main', you can add it's extension setting 'glsllint.additionalStageAssociations'

What gives?

@hsimpson
Copy link
Owner

hsimpson commented Mar 9, 2021

The error GLSL Lint: Failed to spawn 'glslangValidator' binary. Error: spawn /home/lawrence/glslang/bin/glslangValidator ENOENT means, that the binary could not be found at the given path.

Your 2nd error seams that the shader stage (-S <STAGE>) could not be determined correctly:
GLSL Lint: failed to map file: 'c:\Users\Lawrence\Documents\Synethesia\vein_melter_dup.synScene\main', you can add it's extension setting 'glsllint.additionalStageAssociations'

What type of shader is your file c:\Users\Lawrence\Documents\Synethesia\vein_melter_dup.synScene\main
Are you able to rename the file to main.vert or main.frag (if it is a vertex or fragment shader)

@lnorton89
Copy link
Author

After switching from using the Linux binary in WSL to the Windows binary I get a different error:

GLSL Lint: Wrong parameters when starting glslangValidator. Arguments: -l --stdin -S -Ic:\Users\Lawrence\Documents\Synethesia\vein_melter_dup.synScene stderr:

Along with the same map error. The file extension is .glsl -- it's a shader for the program Synesthesia. Here is the contents of it:

vec2 resolution = RENDERSIZE;

vec4 fragColor = vec4(0.0);

float saturate(float x) { return clamp(x, 0, 1); }

vec3 saturate(vec3 x) { return clamp(x, 0, 1); }

vec3 hue2rgb(float h)

{

  h = fract(saturate(h)) * 6 - 2;

  return saturate(vec3(abs(h - 1) - 1, 2 - abs(h), 2 - abs(h - 2)));
}

vec4 renderMain(void)

{

  float scale = 27.0 / resolution.y; // grid scale

  vec2 area =
      vec2(floor(13 / resolution.y * resolution.x), 13); // size of inner area

  vec2 p0 = gl_FragCoord.xy - resolution / 2; // position (pixel)

  vec2 p1 = p0 * scale; // position (grid)

  // gray background with crosshair

  float c1 = 1 - step(2, min(abs(p0.x), abs(p0.y))) * 0.5;

  // grid lines

  vec2 grid = step(scale, abs(0.5 - fract(p1 * 0.5)));

  c1 = saturate(c1 + 2 - grid.x - grid.y);

  // outer area checker

  vec2 checker = step(0.49999, fract(floor(p1 * 0.5 + 0.5) * 0.5));

  if (any(greaterThan(abs(p1), area)))
    c1 = abs(checker.x - checker.y);

  float corner = sqrt(8) - length(abs(p1) - area + 4); // corner circles

  float circle = 12 - length(p1); // big center circle

  float mask = saturate(circle / scale); // center circls mask

  // grayscale bars

  float bar1 = saturate(p1.y < 5 ? floor(p1.x / 4 + 3) / 5 : p1.x / 16 + 0.5);

  c1 = mix(c1, bar1, mask * saturate(ceil(4 - abs(5 - p1.y))));

  // basic color bars

  vec3 bar2 = hue2rgb((p1.y > -5 ? floor(p1.x / 4) / 6 : p1.x / 16) + 0.5);

  vec3 c2 = mix(vec3(c1), bar2, mask * saturate(ceil(4 - abs(-5 - p1.y))));

  // big circle line

  c2 = mix(c2, vec3(1), saturate(2 - abs(max(circle, corner)) / scale));

  fragColor = vec4(c2, 1);

  corner *= 0.5;

  if ((_uv.x < 0.5) && (_uv.y > 0.5)) {

    fragColor +=
        (step(1.0 - syn_BassLevel, corner) - step(1.2 - syn_BassLevel, corner));

  } else if ((_uv.x < 0.5) && (_uv.y < 0.5)) {

    fragColor +=
        (step(1.0 - syn_HighLevel, corner) - step(1.2 - syn_HighLevel, corner));

  }

  else if ((_uv.x > 0.5) && (_uv.y < 0.5)) {

    fragColor +=
        (step(1.0 - syn_Presence, corner) - step(1.2 - syn_Presence, corner));

  }

  else if ((_uv.x > 0.5) && (_uv.y > 0.5)) {

    fragColor +=
        (step(1.0 - syn_BPMTri2, corner) - step(1.2 - syn_BPMTri2, corner));
  }

  return fragColor;
}

@hsimpson
Copy link
Owner

hsimpson commented Mar 9, 2021

GLSL Lint: Wrong parameters when starting glslangValidator. Arguments: -l --stdin -S -Ic:\Users\Lawrence\Documents\Synethesia\vein_melter_dup.synScene stderr: this means that the -S parameter does not specify the stage correctly, because it can not be detected.

If I look at your example code it looks like it is not a complete valid shader, probably a partial fragment shader, but there are some things missing like a main function:

void main() {
  // content of main
}

Partial shader files are not supported by this extension.

I have done a quick look into what Synesthesia is, it looks very interesting and it seams that it has its own shader format SSF: https://synesthesia.live/docs/creating_scenes/ssf.html which contains a fragment shader (main.glsl) file. But this is as I mentioned a partial shader file and there are some standard things like uniforms and functions injected.

So it is nearly impossible to support these Synesthesia shaders, because there system is very dynamic.

@lnorton89
Copy link
Author

Thanks for the thorough reply; that makes total sense and I would've never figured that out by myself (new to openGL/shaders).

@animanoir
Copy link

I can't get it to work, yo.

@hsimpson
Copy link
Owner

hsimpson commented Dec 5, 2021

I can't get it to work, yo.

Could you describe your problem with more details, like:

  • What error happen
  • Which glslangValidator version: glslangValidator --version
  • Which OS
  • Your configuration for the extension
  • Example shader file which does not lint

@animanoir
Copy link

animanoir commented Dec 5, 2021

@hsimpson

What error happen: Using VSCode, with the extension installed, it doesn't findes the validator

GLSL Lint: Failed to spawn 'glslangValidator' binary. Error: spawn C:\Program Files\glslang-master\glslang-
master\Test\glslangValidator ENOENT

Which glslangValidator version: dunno, but I downloaded from multiple GitHub repos. I guess the latest.
Which OS: W11
Your configuration for the extension:

    "glsllint.glslangValidatorPath": "C:\\Program Files\\glslang-master\\glslang-master\\Test\\glslangValidator",
    "glsllint.additionalStageAssociations": {".jxs": "STAGEID"}

Example shader file which does not lint: (this is using Max 8 Jitter shader implementación)

<jittershader name="myFirstShader">
  <description>Mi primer shader en Max8</description>
  <param name="position" type="vec3" state="POSITION" />
  <param name="vertexColor" type="vec4" state="COLOR" />
  <param name="modelViewProjectionMatrix" type="mat4" state="MODELVIEW_PROJECTION_MATRIX" />

  <language name="glsl" version="1.5">

    <bind param="position" program="vp" />
    <bind param="vertexColor" program="vp" />
    <bind param="modelViewProjectionMatrix" program="vp" />

    <program name="vp" type="vertex">
      <![CDATA[
          #version 330 core
          // vertex shader
          in vec3 position;
          in vec4 vertexColor;
          uniform mat4 modelViewProjectionMatrix;
          out vec4 outVertexColor;
          void main()  {
            gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);
            outVertexColor = vertexColor;
          }
      ]]>
    </program>
    <program name="fp" type="fragment">
      <![CDATA[
          #version 330 core
          // Fragment shader
          in vec4 outVertexColor;
          out vec4 outColor;

          void main(){
            outColor = outVertexColor;
          }
      ]]>
    </program>
  </language>
</jittershader>

@hsimpson
Copy link
Owner

hsimpson commented Dec 6, 2021

This type of shader is not supported. Never see this "jittershader" thing.

@hsimpson
Copy link
Owner

hsimpson commented Dec 6, 2021

@animanoir I have created a new Issue for this, see #40

@erlogerik
Copy link

erlogerik commented Feb 3, 2022

Hello,

I am having this same issue in Ubuntu 20.04
The file is there, I can even execute it from VS Code Tasks with the same path with no issue.
I even tried with a symbolic link (in case the 1.2.198.0 caused the issue ) and it still wont work in the extension, VS Code Tasks manages to execute it with no problem with both path options.
With symbolic link path:
/home/name/opt/glsl/glslangValidator
"glsllint.glslangValidatorPath": "/home/name/opt/glsl/glslangValidator"

Full path:
/home/name/Documents/cpp/vulkan_sdk/1.2.198.0/x86_64/bin/glslangValidator
"glsllint.glslangValidatorPath": "/home/name/Documents/cpp/vulkan_sdk/1.2.198.0/x86_64/bin/glslangValidator"

And it does have executable permissions:
-rwxr-xr-x 1 name name 3.0M Nov 18 12:33 glslangValidator

The error itself is:
Error: spawn glslangValidator ENOENT

@hsimpson
Copy link
Owner

hsimpson commented Feb 3, 2022

This is weird.
Could you try to executing it in a terminal with /home/name/Documents/cpp/vulkan_sdk/1.2.198.0/x86_64/bin/glslangValidator --help and also try to do the same from within a terminal in VSCode.
Also please double check the path, ENOENT mostly means, that the file does not exist.

@erlogerik
Copy link

This is weird. Could you try to executing it in a terminal with /home/name/Documents/cpp/vulkan_sdk/1.2.198.0/x86_64/bin/glslangValidator --help and also try to do the same from within a terminal in VSCode. Also please double check the path, ENOENT mostly means, that the file does not exist.

It works now, I don't really know what happened but it works now.

Thank you for your help

@pca-code
Copy link

@hsimpson

What error happen: Using VSCode, with the extension installed, it doesn't findes the validator

GLSL Lint: Failed to spawn 'glslangValidator' binary. Error: spawn C:\Program Files\glslang-master\glslang-
master\Test\glslangValidator ENOENT

Which glslangValidator version: dunno, but I downloaded from multiple GitHub repos. I guess the latest. Which OS: W11 Your configuration for the extension:

    "glsllint.glslangValidatorPath": "C:\\Program Files\\glslang-master\\glslang-master\\Test\\glslangValidator",
    "glsllint.additionalStageAssociations": {".jxs": "STAGEID"}

Example shader file which does not lint: (this is using Max 8 Jitter shader implementación)

<jittershader name="myFirstShader">
  <description>Mi primer shader en Max8</description>
  <param name="position" type="vec3" state="POSITION" />
  <param name="vertexColor" type="vec4" state="COLOR" />
  <param name="modelViewProjectionMatrix" type="mat4" state="MODELVIEW_PROJECTION_MATRIX" />

  <language name="glsl" version="1.5">

    <bind param="position" program="vp" />
    <bind param="vertexColor" program="vp" />
    <bind param="modelViewProjectionMatrix" program="vp" />

    <program name="vp" type="vertex">
      <![CDATA[
          #version 330 core
          // vertex shader
          in vec3 position;
          in vec4 vertexColor;
          uniform mat4 modelViewProjectionMatrix;
          out vec4 outVertexColor;
          void main()  {
            gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);
            outVertexColor = vertexColor;
          }
      ]]>
    </program>
    <program name="fp" type="fragment">
      <![CDATA[
          #version 330 core
          // Fragment shader
          in vec4 outVertexColor;
          out vec4 outColor;

          void main(){
            outColor = outVertexColor;
          }
      ]]>
    </program>
  </language>
</jittershader>

Man I've got the same problem working with VSC and Max (Jitter), u have found a solution?

@animanoir
Copy link

@pca-code Not yet my friend. I have worked with Max internal editor. But yeah I know we could implement this linter with Jitter, but haven't had the time. Gonna try it.

@pca-code
Copy link

@pca-code Not yet my friend. I have worked with Max internal editor. But yeah I know we could implement this linter with Jitter, but haven't had the time. Gonna try it.

Thank's mate, and with the Max internal editor everything is ok? Later I'm gonna try too.

@hsimpson
Copy link
Owner

@hsimpson
What error happen: Using VSCode, with the extension installed, it doesn't findes the validator

GLSL Lint: Failed to spawn 'glslangValidator' binary. Error: spawn C:\Program Files\glslang-master\glslang-
master\Test\glslangValidator ENOENT

Which glslangValidator version: dunno, but I downloaded from multiple GitHub repos. I guess the latest. Which OS: W11 Your configuration for the extension:

    "glsllint.glslangValidatorPath": "C:\\Program Files\\glslang-master\\glslang-master\\Test\\glslangValidator",
    "glsllint.additionalStageAssociations": {".jxs": "STAGEID"}

Example shader file which does not lint: (this is using Max 8 Jitter shader implementación)

<jittershader name="myFirstShader">
  <description>Mi primer shader en Max8</description>
  <param name="position" type="vec3" state="POSITION" />
  <param name="vertexColor" type="vec4" state="COLOR" />
  <param name="modelViewProjectionMatrix" type="mat4" state="MODELVIEW_PROJECTION_MATRIX" />

  <language name="glsl" version="1.5">

    <bind param="position" program="vp" />
    <bind param="vertexColor" program="vp" />
    <bind param="modelViewProjectionMatrix" program="vp" />

    <program name="vp" type="vertex">
      <![CDATA[
          #version 330 core
          // vertex shader
          in vec3 position;
          in vec4 vertexColor;
          uniform mat4 modelViewProjectionMatrix;
          out vec4 outVertexColor;
          void main()  {
            gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);
            outVertexColor = vertexColor;
          }
      ]]>
    </program>
    <program name="fp" type="fragment">
      <![CDATA[
          #version 330 core
          // Fragment shader
          in vec4 outVertexColor;
          out vec4 outColor;

          void main(){
            outColor = outVertexColor;
          }
      ]]>
    </program>
  </language>
</jittershader>

Man I've got the same problem working with VSC and Max (Jitter), u have found a solution?

Could you double check the "glsllint.glslangValidatorPath (it should be the complete path including the glslangValidator.exe on Windows) in your config and try to run this binary.

Unfortunately the Max Jitter shaders are not yet supported see #40 please do further discussions about Max Jitter Shaders there.

@meiry
Copy link

meiry commented Aug 12, 2023

i have the same in windows 10 :
image

In settings i set full path including with the exe and without the exe same error :
image

The simple js :

const vertexShaderSource = `#version 300 es
#pragma vscode_glsllint_stage: vert

void main()
{
    gl_Position = vec4(0.0,0.0,0.0,1.0);
}`;

const fregmentShderSource = `
#version 300 es
#pragma vscode_glsllint_stage: frag
main() ERROR HERE FOR TRIGER THE VALIDATOR 
{
    gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}`;

const c = document.querySelector('canvas');
const gl = c.getContext('webgl2');
const program = gl.createProgram();
gl.useProgram(program);

C:\dev\my\js\webgl2>C:\dev\my\opengl\glslang-master-windows-x64-Release\bin\glslangValidator.exe -version
Glslang Version: 11:11.13.0
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 11.13.0
GLSL Version: 4.60 glslang Khronos. 11.13.0
SPIR-V Version 0x00010600, Revision 1
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 11
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100

@hsimpson
Copy link
Owner

i have the same in windows 10 : image

In settings i set full path including with the exe and without the exe same error : image

The simple js :

const vertexShaderSource = `#version 300 es
#pragma vscode_glsllint_stage: vert

void main()
{
    gl_Position = vec4(0.0,0.0,0.0,1.0);
}`;

const fregmentShderSource = `
#version 300 es
#pragma vscode_glsllint_stage: frag
main() ERROR HERE FOR TRIGER THE VALIDATOR 
{
    gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}`;

const c = document.querySelector('canvas');
const gl = c.getContext('webgl2');
const program = gl.createProgram();
gl.useProgram(program);

C:\dev\my\js\webgl2>C:\dev\my\opengl\glslang-master-windows-x64-Release\bin\glslangValidator.exe -version Glslang Version: 11:11.13.0 ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 11.13.0 GLSL Version: 4.60 glslang Khronos. 11.13.0 SPIR-V Version 0x00010600, Revision 1 GLSL.std.450 Version 100, Revision 1 Khronos Tool ID 8 SPIR-V Generator Version 11 GL_KHR_vulkan_glsl version 100 ARB_GL_gl_spirv version 100

ENOENT means Error-No-Entry. Which means the EXE file could not be found to spawn. Could you please double check the entry of glsllint.glslangValidatorPath in your VSCode config? Probably there is a typo in the path to the EXE file. Also check in the raw configs (either the workspace config and the user config). The path on Windows must have double Backslashes.

At the moment I am on vacation and have no access to a Windows Computer, next week I will try to use a recent version of the validator from here: https://github.com/KhronosGroup/glslang/releases/tag/main-tot and look if it works.

@dharnil
Copy link

dharnil commented Sep 4, 2023

Has this issue found a solution yet?

@hsimpson
Copy link
Owner

hsimpson commented Sep 4, 2023

Has this issue found a solution yet?

I will check this right now...

@hsimpson
Copy link
Owner

hsimpson commented Sep 4, 2023

@meiry and @dharnil-dev I have tested it right now with the recent version and it works as intended.
I used the current glslang-master-windows-Release.zip of https://github.com/KhronosGroup/glslang/releases/tag/main-tot.
When I run it with cmd directly with glslangValidator.exe --version it produce the following output:

C:\other_software\glslang\master-tot\bin>glslangValidator.exe --version
Glslang Version: 11:13.0.0
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 13.0.0
GLSL Version: 4.60 glslang Khronos. 13.0.0
SPIR-V Version 0x00010600, Revision 1
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 11
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100

In the extension it self, I have only configured the glslangValidatorPath:

{
  //...
  "glsllint.glslangValidatorPath": "C:\\other_software\\glslang\\master-tot\\bin\\glslangValidator.exe",
  //...
}

Everything works as intended. No errors.

Neverless @meiry with your JS code I found a bug in my regex for the string literal shader detection, Only the first literal was detected with my current regex. (see: #68)

@dharnil
Copy link

dharnil commented Sep 4, 2023

@hsimpson Yes, that's Right. I got the same stats on this issue. I just added this line on settings.json.
"config.glslangValidatorPath": "/opt/homebrew/bin/glslangValidator",

@Beherith
Copy link

On windows, the vscode dev console log clearly shows that the extension does not correctly pick up the path:
[Extension Host] glslangValidator.exe -l --stdin -S frag -Ic:\Users\....
notificationsAlerts.ts:42 GLSL Lint: Failed to spawn 'glslangValidator' binary. Error: spawn glslangValidator.exe ENOENT

Despite the setting being set:
"glsllint.glslangValidatorPath": "N:/VariousBitsAndBobs/glslang-master-windows-Release/bin/",

@hsimpson
Copy link
Owner

glslangValidator.exe

You are missing the glslangValidator.exe part in your config, see posts above.

@Beherith
Copy link

glslangValidator.exe

You are missing the glslangValidator.exe part in your config, see posts above.
Ah thank you, even when I had the exe path there, it threw the same error.

Oddly enough, the solution was to restart VSCode, as it seems like the extensions settings are only loaded when restarted. I falsely assumed that simply saving the settings.json file would change the config.

Thank you for your help, and this great extension too!

@hsimpson
Copy link
Owner

Yes unfortunately this feature is not implemented yet, see #21

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

8 participants