go-systemd icon indicating copy to clipboard operation
go-systemd copied to clipboard

pkg-config fails to find libsystemd for some docker base-images

Open jzelinskie opened this issue 9 years ago • 3 comments

When attempting to compile an application that depends on go-systemd, I get error messages from pkg-config failing to find lsystemd. I've produced this on images derived from golang:1.5 and ubuntu:14.04 with dockerfiles along these lines:

FROM golang:1.5
RUN apt-get update
RUN apt-get -y install build-essentials pkg-config libsystemd-journal-dev
# compile go application here

I've gotten a range of different errors by playing with the combination of the many transitional libsystemd packages that I install:

# pkg-config --cflags libsystemd
Package libsystemd was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsystemd.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsystemd' found
pkg-config: exit status 1
# pkg-config --cflags libsystemd-journal
Package libsystemd-journal was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsystemd-journal.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsystemd-journal' found
pkg-config: exit status 1
# github.com/coreos-inc/quay-builder
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lsystemd
collect2: error: ld returned 1 exit status

jzelinskie avatar Oct 14 '15 22:10 jzelinskie

This should remain open, but now it only effects the sdjournal package

jzelinskie avatar Oct 15 '15 20:10 jzelinskie

@jzelinskie can you reproduce with this Dockerfile?

FROM golang:1.5
RUN apt-get update
RUN apt-get -y install pkg-config libsystemd-journal-dev
RUN go get github.com/coreos/go-systemd/journal github.com/coreos/go-systemd/sdjournal
RUN wget -O main.go https://gist.githubusercontent.com/jonboulle/86132305a24793423ebd/raw/aaceea155212126a4a63f6747c3acb308e8753a4/main.go
RUN go build -a -o journaltester .

jonboulle avatar Oct 16 '15 01:10 jonboulle

@jonboulle that Dockerfile actually works fine now. I spent a little time trying to repro with another Dockerfile and failed, but I can still repro it with our application. I'll spend some more time on it when I can so that we can figure out this mystery.

jzelinskie avatar Oct 19 '15 15:10 jzelinskie