1

I am using github.com/twpayne/go-geos package in my program to handle geometries. I developed on my a machine which runs Ubuntu 22.04 and everything works as expected. I built a binary using

go build -o someName

and it executes normally. But when I try run the binary on a machine that runs Ubuntu 20.04, I get these errors:

$ ./someName
./someName: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./someName)
./someName: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./someName)

While looking online I saw that ubuntu focal uses glibc 2.31 whereas jammy has glibc 2.35.

I built my binary on ubuntu 22.04 and copied it to ubuntu 20.04 and got the above mentioned issue. I also tried to build it directly on the machine with ubuntu 20.04 but I get this error:

go build github.com/twpayne/go-geos:
# pkg-config --cflags  -- geos
Package geos was not found in the pkg-config search path.
Perhaps you should add the directory containing `geos.pc'
to the PKG_CONFIG_PATH environment variable
No package 'geos' found
pkg-config: exit status 1

I could not find a geos.pc on this machine using mlocate

locate geos.pc returns nothing. echo $PKG_CONFIG_PATH returns nothing.

Both machines are running go version 1.20.

Running apt search libgeos on both machines I get this:

Ubuntu 20.04

libgeos++-dev/focal,now 3.8.0-1build1 amd64 [installed]
  Geometry engine for GIS - C++ development files

libgeos-3.8.0/focal,now 3.8.0-1build1 amd64 [installed]
  Geometry engine for Geographic Information Systems - C++ Library

libgeos-c1v5/focal,now 3.8.0-1build1 amd64 [installed]
  Geometry engine for Geographic Information Systems - C Library

libgeos-dev/focal,now 3.8.0-1build1 amd64 [installed]
  Geometry engine for GIS - Development files

libgeos-doc/focal,now 3.8.0-1build1 all [installed]
  Documentation for the GEOS GIS geometry engine library

Ubuntu 22.04

libgeos++-dev/jammy 3.10.2-1 amd64
  Geometry engine for GIS - C++ development files

libgeos-c1v5/jammy,now 3.10.2-1 amd64 [installed,automatic]
  Geometry engine for Geographic Information Systems - C Library

libgeos-dev/jammy,now 3.10.2-1 amd64 [installed]
  Geometry engine for GIS - Development files

libgeos-doc/jammy,jammy 3.10.2-1 all
  Documentation for the GEOS GIS geometry engine library

libgeos3.10.2/jammy,now 3.10.2-1 amd64 [installed,automatic]
  Geometry engine for Geographic Information Systems - C++ Library

These are the latest versions for each machine I have also tried using an older version of the github.com/twpayne/go-geos package as I though maybe an earlier version would run on Ubuntu 20.04. 'v0.10.0' is the earliest I can go which has the functions I need but that also produces the same error.

Is there something I am overlooking? I am new to go as well as working with geos so I am a bit stumped. All I can think of is to rewrite my code using a different library. Any help on resolving this will be greatly appreciated. Upgrading the OS to the 22.04 version is not an option. Using a docker image is also not an option for me.

ADDITIONAL INFO: Not sure if this is relevant but I noticed when running which go on both machines I get these outputs: Ubuntu 20.04

/snap/bin/go 

Ubuntu 22.04

/usr/local/go/bin/go 

I did not install go (was done by someone else) on the machine running Ubuntu 20.04.

NOTE: This is my first time asking on stackoverflow. Let me know if I need to add something more to my question.

pluton24
  • 11
  • 4
  • You compiled the package linked against a different version of glibc than on the target platform. The easiest way to build this is on the target platform, provided you can install the correct dependencies. The package may not support the older version of libgeos. – JimB May 25 '23 at 18:06
  • Looking at that package's GH repo, it supports _"the libgeos version using in the latest Ubuntu LTS release, which is currently GEOS 3.10.2_" – JimB May 25 '23 at 18:08
  • @JimB Thanks for your reply. So does this mean I won't be able to run it on Ubuntu 20? – pluton24 May 25 '23 at 18:29
  • It's definitely going to be harder, you may be able to run it if you update all the requirements manually. It's up to you if you want to go down that route. – JimB May 25 '23 at 18:31
  • please have a look https://stackoverflow.com/a/76612769/1802213 – serkan Jul 05 '23 at 05:15

0 Answers0