Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

provide additional header files #209

Open
nrobert13 opened this issue Aug 19, 2021 · 1 comment
Open

provide additional header files #209

nrobert13 opened this issue Aug 19, 2021 · 1 comment

Comments

@nrobert13
Copy link

I'm trying to compile a program which requires systemd's headers. like this:

GOPATH=/home/src xgo -x -v -image xgo-latest-sd ./

The Dockerfile of xgo-latest-sd looks like this, to add the required headers.

FROM karalabe/xgo-latest

RUN apt-get update && \
    apt-get install -y libsystemd-dev

the header is installed under:

# docker run --rm -it --entrypoint /usr/bin/find xgo-latest-sd -- /usr/ -name sd-journal.h
/usr/include/systemd/sd-journal.h

but as far as I can tell cgo doesn't find it due to -I $WORK/b206/

CGO_LDFLAGS='"-fPIE"' /usr/local/go/pkg/tool/linux_amd64/cgo -objdir $WORK/b206/ -importpath github.com/coreos/go-systemd/sdjournal -- -I $WORK/b206/ -fPIE ./journal.go
# github.com/coreos/go-systemd/sdjournal
/go/pkg/mod/github.com/coreos/[email protected]/sdjournal/journal.go:27:33: fatal error: systemd/sd-journal.h: No such file or directory
 // #include <systemd/sd-journal.h>
                                 ^
compilation terminated.

is there a way to get this compiled with xgo?

thanks in advance.

@nrobert13
Copy link
Author

got it working for specific target like

GOPATH=/home/src xgo  -image xgo-latest-sd  -targets linux/arm-7 ./

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant