Missing library when running a Unix Go binary from Java's ProcessBuilder but not when running it from a terminal

Greetings my fellow Golang fellows. I’m running into an issue whilst trying to use a Golang CLI application I’ve modified and built binaries for (on the same system I’m using them from). It does require the gl package, which I believe is causing this issue

I build the program like so (justfile syntax);

# runs the golang build
build label=(name + '-' + version) goos=os() archh=arch():
    #!/usr/bin/env bash
    set -euo pipefail
 
    env \
        `# set enviroment variables`
        GOOS={{ goos }} \
        GOARCH={{ archh }} \
    `# build the program`
    go build \
        -o {{ label }}-{{ goos }}-{{ archh }}

It works when called from the terminal (./kami-linux -h) and functions exactly like it’s supposed to, but if I call that exact command from Java’s ProcessBuilder, like so

val process = ProcessBuilder(
    "${File(".").canonicalPath}/kami-linux",
    "-h"
)
    .redirectInput(ProcessBuilder.Redirect.PIPE)
    .redirectOutput(ProcessBuilder.Redirect.PIPE)
    .redirectError(ProcessBuilder.Redirect.INHERIT)
    .start()

I get;

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

As a result of inheriting the process’s error stream

I looked around and saw a similar problem with a suggestion to run strings /usr/lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC (modified path). In my case, running this gives;

GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_2.22
GLIBC_2.23
GLIBC_2.24
GLIBC_2.25
GLIBC_2.26
GLIBC_2.27
GLIBC_2.28
GLIBC_2.29
GLIBC_2.30
GLIBC_2.32
GLIBC_PRIVATE
GNU C Library (Ubuntu GLIBC 2.32-0ubuntu3) release release version 2.32.

Showing that I do have the correct version. I’m clueless on this as both a Golang and Linux noob

This is the full project in question;

I expect that this is just me being silly but I would appreciate any suggestions to try and fix this

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.