go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.29k stars 196 forks source link

Docker build fails with an "unsatisfiable constraints" error #728

Closed dkastl closed 3 years ago

dkastl commented 3 years ago

Trying a local Docker build fails with the following "unsatisfiable constraints" error.

$ docker build -t tegola .
Sending build context to Docker daemon  107.2MB
Step 1/12 : FROM golang:1.14.1-alpine3.11 AS build
1.14.1-alpine3.11: Pulling from library/golang
aad63a933944: Pull complete 
c732a2540651: Pull complete 
7b2225181d6b: Pull complete 
c8dae7ec6990: Pull complete 
08684ee472f3: Pull complete 
Digest: sha256:244a736db4a1d2611d257e7403c729663ce2eb08d4628868f9d9ef2735496659
Status: Downloaded newer image for golang:1.14.1-alpine3.11
 ---> 760fdda71c8f
Step 2/12 : ARG VERSION="Version Not Set"
 ---> Running in 50d8913ec5c4
Removing intermediate container 50d8913ec5c4
 ---> 3c55c7a00653
Step 3/12 : ENV VERSION="${VERSION}"
 ---> Running in e03c49a9f32a
Removing intermediate container e03c49a9f32a
 ---> 6667c5acdb26
Step 4/12 : RUN apk update  && apk add musl-dev=1.1.24-r2   && apk add gcc=9.3.0-r0
 ---> Running in a608d063395b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
v3.11.6-215-g0999d9b171 [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.6-212-g3a84324cad [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
OK: 11276 distinct packages available
ERROR: unsatisfiable constraints:
  musl-dev-1.1.24-r3:
    breaks: world[musl-dev=1.1.24-r2]
The command '/bin/sh -c apk update  && apk add musl-dev=1.1.24-r2   && apk add gcc=9.3.0-r0' returned a non-zero code: 1

Run using master branch on Ubuntu 20.04 with Docker version 19.03.14

ARolek commented 3 years ago

@dkastl thanks for the report, and apologies for the slow response here. It looks like there's an issue fetching musl-dev, though a quick search shows that the version is still current. It might be worth making some version bumps in the Dockerfile to see if we could get this working. Maybe we bump to Go 1.15.6 and alpine 3.12 and then bump musl-dev to musl-dev-1.1.24-r10.

Would you want to attempt doing the version bump?

dkastl commented 3 years ago

Thank you for looking at this. My Go knowledge is rather low and so is my confidence for a pull request. I wouldn't mind if someone else does this. But I'm happy to test a merge request before merging.

ARolek commented 3 years ago

I spun up a new branch, issue-728-Docker-failing which addresses the version bumps, though now the tegola build command is failing:

usage: link [options] main.o
  -B note
        add an ELF NT_GNU_BUILD_ID note when using ELF
  -E entry
        set entry symbol name
  -H type
        set header type
  -I linker
        use linker as ELF dynamic linker
  -L directory
        add specified directory to library path
  -R quantum
        set address rounding quantum (default -1)
  -T address
        set text segment address (default -1)
  -V    print version and exit
  -X definition
        add string value definition of the form importpath.name=value
  -a    no-op (deprecated)
  -benchmark string
        set to 'mem' or 'cpu' to enable phase benchmarking
  -benchmarkprofile base
        emit phase profiles to base_phase.{cpu,mem}prof
  -buildid id
        record id as Go toolchain build id
  -buildmode mode
        set build mode
  -c    dump call graph
  -compressdwarf
        compress DWARF if possible (default true)
  -cpuprofile file
        write cpu profile to file
  -d    disable dynamic executable
  -debugtramp int
        debug trampolines
  -dumpdep
        dump symbol dependency graph
  -extar string
        archive program for buildmode=c-archive
  -extld linker
        use linker when linking in external mode
  -extldflags flags
        pass flags to external linker
  1 Version bumps in Dockerfile
  -f    ignore version mismatch
  -g    disable go package data checks
  -go115newobj
        use new object file format (default true)
  -h    halt on error
  -importcfg file
        read import configuration from file
  -installsuffix suffix
        set package directory suffix
  -k symbol
        set field tracking symbol
  -libgcc string
        compiler support lib for internal linking; use "none" to disable
  -linkmode mode
        set link mode
  -linkshared
        link against installed Go shared libraries
  -memprofile file
        write memory profile to file
  -memprofilerate rate
        set runtime.MemProfileRate to rate
  -msan
        enable MSan interface
  -n    dump symbol table
  -o file
        write output to file
  -pluginpath string
        full path name for plugin
  -r path
        set the ELF dynamic linker search path to dir1:dir2:...
  -race
        enable race detector
  -s    disable symbol table
  -strictdups int
        sanity check duplicate symbol contents during object file reading (1=warn 2=err).
  -tmpdir directory
        use directory for temporary files
  -u    reject unsafe packages
  -v    print link trace
  -w    disable DWARF generation
The command '/bin/sh -c cd /go/src/github.com/go-spatial/tegola/cmd/tegola  && go build -v -ldflags "-w -X github.com/go-spatial/tegola/cmd/tegola/cmd.Version=${VERSION}" -gcflags "-N -l" -o /opt/tegola && chmod a+x /opt/tegola' returned a non-zero code: 2

@gdey do you have know off hand what would cause that error? I figured I would ask before I dig too deep into the research.

gdey commented 3 years ago

Looks like a linker issue:

I would look at this bit: -ldflags "-w -X github.com/go-spatial/tegola/cmd/tegola/cmd.Version=${VERSION}"

and any cgo code that has the linker flags.

ARolek commented 3 years ago

@dkastl I just sent in a PR to fix this issue. Give it a run if you have a chance: https://github.com/go-spatial/tegola/pull/729

dkastl commented 3 years ago

Thank you! I made test build and run the help command and it seems to work now!

ARolek commented 3 years ago

@dkastl great! We will get this into the v0.13.0 branch soon. I'm just waiting on a quick review from @gdey

ARolek commented 3 years ago

closed via 154b7ccd821c57e14fcbf673529c4a8546131c8e