go-systemd
go-systemd copied to clipboard
pkg-config fails to find libsystemd for some docker base-images
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
This should remain open, but now it only effects the sdjournal
package
@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 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.