Closed hans-m-song closed 11 months ago
I'm not much of an expert around this, but one thing I suspect is that libxml2 was not installed with /usr/include
?
What does pkg-config --libs libxml2
tell you?
Here is the output:
# pkg-config --libs libxml2
Package libxml2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml2' found
I take it you are expecting libxml2
instead of libxml-2.0
?
When building with -x
# go build -x
WORK=/tmp/go-build3518064176
mkdir -p $WORK/b003/
cd /root/go/pkg/mod/github.com/lestrrat/go-libxml2@v0.0.0-20180221004755-bb78334e2019/clib
pkg-config --cflags -- libxml-2.0
pkg-config --libs -- libxml-2.0
TERM='dumb' CGO_LDFLAGS='"-g" "-O2" "-lxml2"' /usr/local/go/pkg/tool/linux_amd64/cgo -objdir $WORK/b003/ -importpath github.com/lestrrat/go-libxml2/clib -- -I/usr/include/libxml2 -I $WORK/b003/ -g -O2 ./clib.go
# github.com/lestrrat/go-libxml2/clib
In file included from /usr/include/libxml2/libxml/parser.h:810,
from /usr/include/libxml2/libxml/HTMLparser.h:16,
from /root/go/pkg/mod/github.com/lestrrat/go-libxml2@v0.0.0-20180221004755-bb78334e2019/clib/clib.go:28:
/usr/include/libxml2/libxml/encoding.h:28:10: fatal error: iconv.h: No such file or directory
28 | #include <iconv.h>
| ^~~~~~~~~
compilation terminated.
It references /usr/include/libxml2
which I can verify does contain header files
Oh, now that I think about it, did you install libxml2-dev
or libxml2-devel
or whatever it is?
Yes I have, if you have a look at the Dockerfile
, I have installed
pkg-config
gcc-mingw-w64
for cross-compilationlibc6
, libc6-dev
which I believe contains libiconv
libxml2
, libxml2-dev
Oh, hmm... sorry now I'm stumped. :/
No worries, I figured it's not really an issue with your package (which I have found quite useful, thanks for that!). I will keep digging. Feel free to close this.
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity. This does not mean your issue is rejected, but rather it is done to hide it from the view of the maintains for the time being. Feel free to reopen if you have new comments
I seem to be having some issues cross-compiling from linux to windows.
Here is a reproducible example:
Dockerfile
go.mod
main.go
Attempting to build the image results in the following error:
Using
CGO_FLAGS=-I/usr/include
doesn't seem to help either.I can see the file
/usr/include/iconv.h
exists if built omitting the failing step in the dockerfile andpkg-config
recogniseslibxml2
.Sorry if this is the wrong place to put this, I figure this is more to do with
cgo
thanlibxml2
but I'm at a loss as to how to proceed. Probably similar to https://github.com/lestrrat-go/libxml2/issues/80 (I have encountered their issue as well).