semgrep / semgrep

Lightweight static analysis for many languages. Find bug variants with patterns that look like source code.
https://semgrep.dev
GNU Lesser General Public License v2.1
10.73k stars 628 forks source link

Error while trying to build the semgrep image #8095

Open iliasch7 opened 1 year ago

iliasch7 commented 1 year ago

I'm struggling with this error. Can anyone help me?

=> [semgrep-core-container 3/6] COPY . . 22.3s => CANCELED [semgrep-cli 6/11] RUN apk add --no-cache --virtual=.build-deps build-base make g++ && pip ins 30.8s => ERROR [semgrep-core-container 4/6] RUN make install-deps-ALPINE-for-semgrep-core && make install-deps-for- 8.4s

[semgrep-core-container 4/6] RUN make install-deps-ALPINE-for-semgrep-core && make install-deps-for-semgrep-core:

0 1.185 apk add --no-cache pcre-dev gmp-dev

0 1.503 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz

0 4.059 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz

0 7.126 fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz

0 8.024 WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz: UNTRUSTED signature

0 8.235 OK: 659 MiB in 127 packages

0 8.301 # Fetch, build and install the tree-sitter runtime library locally.

0 8.304 cd libs/ocaml-tree-sitter-core \

0 8.304 && ./configure \

0 8.304 && ./scripts/install-tree-sitter-lib

0 8.314 env: ‘bash\r’: No such file or directory

0 8.315 make: *** [Makefile:225: install-deps-for-semgrep-core] Error 127


Dockerfile:65

64 | # run internally in make 'install-deps-alpine-xxx' below are fast too 65 | >>> RUN make install-deps-ALPINE-for-semgrep-core &&\ 66 | >>> make install-deps-for-semgrep-core 67 |

ERROR: failed to solve: process "/bin/sh -c make install-deps-ALPINE-for-semgrep-core && make install-deps-for-semgrep-core" did not complete successfully: exit code: 2

r2c-demo commented 1 year ago

This issue is synced in Linear at https://linear.app/semgrep/issue/PA-2876/error-while-trying-to-build-the-semgrep-image. Note: this link is for r2c use only and is not accessible publicly.

mjambon commented 1 year ago

Hi,

This looks like a CR character got there by accident:

#0 8.314 env: ‘bash\r’: No such file or directory

My wild guess is that some shell script got converted to Windows line endings (CR-LF) and then executed in a Unix environment (as Docker uses). See the first line of ./scripts/install-tree-sitter-lib.

For more help, please fill out the standard bug report template:

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior, ideally a link to https://semgrep.dev:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

What is the priority of the bug to you?

Environment If not using semgrep.dev: are you running off docker, an official binary, a local build?

Use case What will fixing this bug enable for you?