missinglink / pbf

utilities for parsing OpenStreetMap PBF files and extracting geographic data
MIT License
21 stars 9 forks source link

Build errors on Ubuntu 20.4 w/ Go 1.13.8 #31

Open vicchi opened 3 years ago

vicchi commented 3 years ago

Clean install of Ubuntu 20.04 ...

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04
Codename:   focal

Latest Go release from the standard Ubuntu apt package repos, via sudo apt install -y golang

$ go version
go version go1.13.8 linux/amd64

And then 😢

$ go get github.com/missinglink/pbf
# github.com/missinglink/pbf/command
../../go/src/github.com/missinglink/pbf/command/bitmask_boundaries.go:40:37: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_boundaries.go:43:31: invalid operation: c.Args()[1] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_boundaries.go:57:41: invalid operation: c.Args()[1] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_custom.go:19:8: invalid argument argv (type cli.Args) for len
../../go/src/github.com/missinglink/pbf/command/bitmask_custom.go:25:37: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_custom.go:28:31: invalid operation: c.Args()[1] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_custom.go:60:41: invalid operation: c.Args()[1] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_stats.go:16:31: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_stats.go:23:25: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_super_relations.go:18:37: invalid operation: c.Args()[0] (type cli.Args does not support indexing)
../../go/src/github.com/missinglink/pbf/command/bitmask_super_relations.go:18:37: too many errors

Anything immediately apparent (apart from the fact that the version of Go is several releases ahead of the 1.10 release mentioned in the README)?

Also tried downgrading to Go 1.10 but that threw a completely different set of errors so I'll leave that for another day.

vicchi commented 3 years ago

Hmm ... after digging in xcompile.sh a manual build seems to complete successfully and build a binary ...

$ GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" pbf.go
$ echo $?
0
$ ls -lh pbf
-rwxrwxr-x 1 gary gary 8.0M Nov 13 09:14 pbf
$ file pbf
pbf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=0fe1b9307102d3f136fa03f694e7d9e5354677ca, for GNU/Linux 3.2.0, stripped
$ ./pbf --help
NAME:
   pbf - utilities for parsing OpenStreetMap PBF files and extracting geographic data

USAGE:
   pbf [global options] command [command options] [arguments...]

COMMANDS:
   stats                    pbf statistics
   json                     convert to overpass json format, optionally using bitmask to filter elements
   json-flat                convert to a json format, compulsorily using bitmask to filter elements and leveldb to denormalize where possible
   xml                      convert to osm xml format, optionally using bitmask to filter elements
   opl                      convert to opl, optionally using bitmask to filter elements
   nquad                    convert to nquad, optionally using bitmask to filter elements
   cypher                   convert to cypher format used by the neo4j graph database, optionally using bitmask to filter elements
   sqlite3                  import elements in to sqlite3 database, optionally using bitmask to filter elements
   leveldb                  import elements in to leveldb database, optionally using bitmask to filter elements
   genmask                  generate a bitmask file by specifying feature tags to match
   genmask-boundaries       generate a bitmask file containing only elements referenced by a boundary:administrative relation
   genmask-super-relations  generate a bitmask file containing only relations which have at least one another relation as a member
   bitmask-stats            output statistics for a bitmask file
   store-noderefs           store all node refs in leveldb for records matching bitmask
   boundaries               write geojson osm boundary files using a leveldb database as source
   xroads                   compute street intersections
   streets                  export street segments as merged linestrings, encoded in various formats
   noderefs                 count the number of times a nodeid is referenced in file
   index                    index a pbf file and write index to disk
   index-info               display a visual representation of the index file
   find                     random access to pbf
   help, h                  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help
gary@turing:~/Projects/pelias/pbf$
missinglink commented 3 years ago

I believe the codegangsta/cli package I use changed its API slightly between versions and one of the changes triggers the error you pasted.