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

Build failure: curl version is too low #320

Open
packtonik0 opened this issue Apr 16, 2023 · 17 comments
Open

Build failure: curl version is too low #320

packtonik0 opened this issue Apr 16, 2023 · 17 comments

Comments

@packtonik0
Copy link

Hy..
I when getting image from dockerfile clone source code github
The program encounters the following problem

Context

Please select one:

  • [ ✅ ] I use my own build of the docker image

Please select one:

  • [ ✅ ] I use the latest commit of the master branch

Environment

My operating system:

  • [ ✅ ] Linux

OS version: <Ubuntu 22.10>

Issue

#0 27.23 # github.com/Ullaakut/go-curl
#0 27.23 In file included from /go/pkg/mod/github.com/!ullaakut/[email protected]/const.go:5:
#0 27.23 ./compat.h:423:2: error: #error your version is TOOOOOOOO low
#0 27.23 423 | #error your version is TOOOOOOOO low
#0 27.23 | ^~~~~

What was expected

What happened

when clone project from github and builde dockerfile without changing the source code dockerfile

Logs

sudo docker build -t test:001 .

...
#0 15.33 go: downloading golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
#0 15.40 go: downloading golang.org/x/text v0.3.0
#0 15.40 go: downloading github.com/fatih/color v1.7.0
#0 17.12 go: downloading github.com/mattn/go-isatty v0.0.8
#0 17.12 go: downloading github.com/mattn/go-colorable v0.1.2
#0 27.23 # github.com/Ullaakut/go-curl
#0 27.23 In file included from /go/pkg/mod/github.com/!ullaakut/[email protected]/const.go:5
#0 27.23 ./compat.h:423:2: error: #error your version is TOOOOOOOO low
#0 27.23   423 | #error your version is TOOOOOOOO low
#0 27.23       |  ^~~~~
------
Dockerfile:17
--------------------
  15 |     ENV GO111MODULE=on
  16 |     RUN go version
  17 | >>> RUN go build -o cameradar
  18 |     
  19 |     # Final stage
--------------------
ERROR: failed to solve: process "/bin/sh -c go build -o cameradar" did not complete successfully: exit code: 1
@Ullaakut
Copy link
Owner

Thanks for opening this issue, this shows that Ullaakut/go-curl is outdated, and after looking into it it seems that the fix I did on go-curl in my fork has been done on the original repo as well, so we can use go-curl instead of my version of it, and that should fix it.

If someone wants to pick this up, feel free to update the dependency, otherwise I'll do it when I have some time 👍

@packtonik0
Copy link
Author

Thanks for opening this issue, this shows that Ullaakut/go-curl is outdated, and after looking into it it seems that the fix I did on go-curl in my fork has been done on the original repo as well, so we can use go-curl instead of my version of it, and that should fix it.

If someone wants to pick this up, feel free to update the dependency, otherwise I'll do it when I have some time +1

Thanks for opening this issue, this shows that Ullaakut/go-curl is outdated, and after looking into it it seems that the fix I did on go-curl in my fork has been done on the original repo as well, so we can use go-curl instead of my version of it, and that should fix it.

If someone wants to pick this up, feel free to update the dependency, otherwise I'll do it when I have some time +1

### Please help me to fix this issue @Ullaakut 🙏️🙏️🙏️

@Ullaakut
Copy link
Owner

If you want to fix it, all you need to do is replace the dependency from https://github.com/Ullaakut/go-curl to https://github.com/andelf/go-curl. That should be enough to allow you to build the docker image.

Have a good day!

@simsmith007
Copy link

simsmith007 commented Apr 18, 2023

I also encountered such a problem..
I feel that you are wrong, the last update of the library andelf/go-curl is 3 years ago.
It means that no changes have been made in the library to correct andelf/go-curl and the problem is somewhere else

However, we will try
Thank @Ullaakut

@packtonik0
Copy link
Author

If you want to fix it, all you need to do is replace the dependency from https://github.com/Ullaakut/go-curl to https://github.com/andelf/go-curl. That should be enough to allow you to build the docker image.

Have a good day!

Thanks for your reply
But the problem still remains
The only difference is that instead of showing the error of your library Ullaakut/go-curl, it shows the error of andelf/go-curl library

new Logs

sudo docker build -t test:001 .

...
#0 272.2 # github.com/andelf/go-curl
#0 272.2 In file included from /go/pkg/mod/github.com/andelf/[email protected]/const.go:5:
#0 272.2 ./compat.h:423:2: error: #error your version is TOOOOOOOO low
#0 272.2   423 | #error your version is TOOOOOOOO low
#0 272.2       |  ^~~~~
------
Dockerfile:17
--------------------
  15 |     ENV GO111MODULE=on
  16 |     RUN go version
  17 | >>> RUN go build -o cameradar
  18 |     
  19 |     # Final stage
--------------------
ERROR: failed to solve: process "/bin/sh -c go build -o cameradar" did not complete successfully: exit code: 1

I think @simsmith007 's comment is correct

@fransiouz
Copy link

Same issue here. Something to deal with libcurl version, but have no idea how to fix
image

@Ullaakut
Copy link
Owner

My version of go-curl is even older than that, the main branch of andelf indeed fixes the thing I tried to fix in my fork, on top of also making further changes, so either way we should replace the dependency. However indeed, it seems like there is a problem with the curl version.

Likely what would fix it then is to change the version of libcurl that is installed in the first step of the Dockerfile:

# Build stage
FROM golang:alpine AS build-env

COPY . /go/src/github.com/Ullaakut/cameradar
WORKDIR /go/src/github.com/Ullaakut/cameradar/cmd/cameradar

RUN apk update && \
    apk upgrade && \
    apk add nmap nmap-nselibs nmap-scripts \
    curl curl-dev \ # <------------------------------------------------------ Here.
    gcc \
    libc-dev \
    git \
    pkgconfig
ENV GO111MODULE=on
RUN go version
RUN go build -o cameradar

In the last stage, we specify the version of curl we want to get a very specific one, but it looks like the build stage now fails due to the curl version that matches the package manager in the golang:alpine image.

I can't look into it at the moment unfortunately.

@fransiouz
Copy link

OK @Ullaakut
It's an incompatible version requirement between go-curl and golang version.
I succeed to build with a previous version like this one :
FROM golang:1.16-alpine3.13 AS build-env

Maybe we need to find the latest version that compile correctly. But this one seems to do the job.
I tried really old ones that crash for some other reasons....

@Ullaakut
Copy link
Owner

Great that you were able to build this way 👍 At least this gives a temporary solution until we find a way to get the specific version we need of go curl while also having a recent golang image. Thank you!

@anoduck
Copy link

anoduck commented May 27, 2023

Don't know how anyone would discover any similarities in potential issues with the issue labeled as ambiguously as it is. It might be a good idea to change this... just saying.

I don't really have the time to troubleshoot a resolution to this issue at the moment, but the resolution to downgrade to golang:1.16-alpine3.13 does not sit well.

As for simply replacing Ullaakut with andelf, it does not work. The go version designation includes a 12 character hash at the end, and how to discover the appropriate hash I do not know.

I will have to look at this when I have more time.

@Ullaakut Ullaakut changed the title Error when create image docker in dockerfile Build failure: curl version is too low May 27, 2023
@Ullaakut
Copy link
Owner

@anoduck Thanks, indeed it wasn't very clear from the title. It should be better now.

I don't have much time for open source work these days so I won't take a look at this for now unfortunately.

May I ask, why you want to build your own image instead of using a docker image? I should start including compiled binaries in releases again, my bad on this. I thought it was automated but it looks like it's not/no longer the case.

@anoduck
Copy link

anoduck commented May 27, 2023

I don't have much time for open source work these days so I won't take a look at this for now unfortunately.

You might want to mention this in the README.md, it would save you and other users a lot of time.

May I ask, why you want to build your own image instead of using a docker image?

Because I thought by building a new image it would provide more up-to-date stream patterns to scan with. Sadly, this was not the case.

I should start including compiled binaries in releases again, my bad on this. I thought it was automated but it looks like it's not/no longer the case.

It is no worries, github has changed a lot recently.


@Ullaakut
Copy link
Owner

You might want to mention this in the README.md, it would save you and other users a lot of time.

How so? I still maintain my repositories and can help guide people through investigating and fixing issues, I just don't have time to work on them many hours per week like I used to. That doesn't mean the repositories are abandonned (besides https://github.com/Ullaakut/RTSPAllTheThings which I archived, deprecated and suggested an alternative.)

more up-to-date stream patterns to scan with

If you have suggestions for routes or credentials to be added, feel free to contribute to the dictionaries. They were mostly compiled back in 2016 and have not been modified much, since I no longer work in the videosurveillance business and therefore no longer have access to new hardware to tinker with :)

@anoduck
Copy link

anoduck commented May 31, 2023

Regarding message in readme:

It would provide users a clearer understanding of what their expectations should be about the project. There is no shame in informing users up front that the project is still maintained, but not currently under development due to time constraints. By being up front about it, you may even find a group of go programmers willing to assist in development of the project. As a matter of fact, if not one of a kind, any other alternatives to this project are quite few.

Regarding patterns:

I came across a goldmine of pattern listings a few days ago attempting to discover how to access my own cheap security camera stream. When I come across it again, I will share the link.

@dordyan
Copy link

dordyan commented Oct 21, 2023

Here is a Dockerfile that allow you to get a successful build.


# Build stage
FROM golang:alpine AS build-env

COPY . /go/src/github.com/Ullaakut/cameradar
WORKDIR /go/src/github.com/Ullaakut/cameradar/cmd/cameradar

RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> `/etc/apk/repositories`

RUN apk update && \
    apk add nmap nmap-nselibs nmap-scripts \
    gcc \
    libc-dev \
    git \
    pkgconfig \
    curl==7.79.1-r3 \
    curl-dev==7.79.1-r3
ENV GO111MODULE=on
RUN go version
RUN go build -o cameradar

# Final stage
FROM alpine

# Necessary to install curl v7.64.0-r3.
# Fix for https://github.com/Ullaakut/cameradar/issues/247
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositories

RUN apk --update add --no-cache nmap \
    nmap-nselibs \
    nmap-scripts \
    curl-dev==7.64.0-r5 \
    curl==7.64.0-r5

WORKDIR /app/cameradar
COPY --from=build-env /go/src/github.com/Ullaakut/cameradar/dictionaries/ /app/dictionaries/
COPY --from=build-env /go/src/github.com/Ullaakut/cameradar/cmd/cameradar/ /app/cameradar/

ENV CAMERADAR_CUSTOM_ROUTES="/app/dictionaries/routes"
ENV CAMERADAR_CUSTOM_CREDENTIALS="/app/dictionaries/credentials.json"

ENTRYPOINT ["/app/cameradar/cameradar"]

@anoduck
Copy link

anoduck commented Oct 22, 2023

@dordyan What you have just posted, will be of great help to me and my personal life. I will be sure to run this later on tonight, and see if I can tap the output of my cameras.

Sincerely, Thank You.

@anoduck
Copy link

anoduck commented Oct 23, 2023

@dordyan I had to modify your Dockerfile source code in order to get it working for me. It will be found to be more simplistic, but running it this way allowed the achievement of a successful build, where otherwise it proved unsuccessful.

FROM golang:alpine3.13
RUN mkdir -p /go
RUN mkdir -p /app
COPY . /go/src/github.com/Ullaakut/cameradar
COPY ./dictionaries /app/dictionaries

WORKDIR /go/src/github.com/Ullaakut/cameradar/cmd/cameradar

RUN apk upgrade && \
    apk add nmap \
    nmap-nselibs \
    nmap-scripts \
    gcc \
    libc-dev \
    git \
    curl==7.79.1-r3 \
    curl-dev==7.79.1-r3

ENV GO111MODULE=on
RUN go version
RUN go build -o cameradar

# Necessary to install curl v7.64.0-r3.
# Fix for https://github.com/Ullaakut/cameradar/issues/247
RUN sed -i 's/v3.13/v3.9/g' /etc/apk/repositories

RUN apk add --no-cache nmap \
    nmap-nselibs \
    nmap-scripts \
    curl-dev==7.64.0-r5 \
    curl==7.64.0-r5

WORKDIR /app
RUN cp /go/src/github.com/Ullaakut/cameradar/cmd/cameradar /app/cameradar

ENV CAMERADAR_CUSTOM_ROUTES="/app/dictionaries/routes"
ENV CAMERADAR_CUSTOM_CREDENTIALS="/app/dictionaries/credentials.json"

ENTRYPOINT ["/app/cameradar"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants