Arman92 / go-tdlib

Golang Telegram TdLib JSON bindings
GNU General Public License v3.0
436 stars 100 forks source link

Build in docker #88

Open PullDakar opened 3 years ago

PullDakar commented 3 years ago

Hello! I'm trying to build docker image from README.md. When i execute the command "docker build -fDockerfile -ttelegram-client ." on step: Step 12/15 : RUN go build --ldflags "-extldflags '-static -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl -lm -lssl -lcrypto -lstdc++ -lz'" -o /tmp/demo-exe main.go

i get error: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lc++ collect2: error: ld returned 1 exit status The command '/bin/sh -c go build --ldflags "-extldflags '-static -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl -lm -lssl -lcrypto -lstdc++ -lz'" -o /tmp/demo-exe main.go' returned a non-zero code: 2

How can I assemble the image correctly?

iIIusi0n commented 3 years ago

I have the same error. I did the test without -lstd++ flag but still experience the same thing... Is there any update?

Arman92 commented 3 years ago

Please use v2 branch while I investigate this issue. I believe this issue would be fixed in v2.

iIIusi0n commented 3 years ago

There is another issue in v2 branch but i fixed this error with wsl. Maybe there is problem in pre build docker container.

dimau commented 1 year ago

Please use v2 branch while I investigate this issue. I believe this issue would be fixed in v2.

Sorry, I tried to use v2 branch (like this "go get github.com/Arman92/go-tdlib@v2" using Go 1.20), but got an error, can you please advise, how to do it correctly? go: github.com/Arman92/go-tdlib@v2: no matching versions for query "v2"

dimau commented 1 year ago

Please use v2 branch while I investigate this issue. I believe this issue would be fixed in v2.

Sorry, I tried to use v2 branch (like this "go get github.com/Arman92/go-tdlib@v2" using Go 1.20), but got an error, can you please advise, how to do it correctly? go: github.com/Arman92/go-tdlib@v2: no matching versions for query "v2"

Answer: go get github.com/Arman92/go-tdlib/v2@3b65411 works fine

dimau commented 1 year ago

The same problem with v2 branch

=> ERROR [golang 12/12] RUN go build --ldflags "-extldflags '-static -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl  6.5s
------
 > [golang 12/12] RUN go build --ldflags "-extldflags '-static -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl -lm -lssl -lcrypto -lstdc++ -lz'" -o /tmp/demo-exe main.go:
#20 6.450 # github.com/Arman92/go-tdlib/v2/client
#20 6.450 /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lc++
#20 6.450 collect2: error: ld returned 1 exit status
Pichas commented 6 months ago
RUN sed -i 's|-lc++|-lstdc++|p' /go/pkg/mod/github.com/\!arman92/go-tdlib@v1.0.0/tdlib.go

RUN go build --ldflags "-extldflags '-static -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl -lm -lssl -lcrypto -lstdc++ -lz'" -o /tmp/binary main.go