Closed mixedCase closed 7 years ago
Trying to run the example here after the failed go get
also returns the same error.
What version of Go?
$ go version
go version go1.6.3 linux/amd64
how did you install the gcc tools ?
what linux are you on ?
The binaries might not be built with PIC. I'll need to see how to get cmake to do it, if I didn't already...
@joeblew99 Through my distro's package manager. I'm using Arch Linux, GCC is version 6.1.1.
Ok. I am on Ubuntu and used the package manager on Ubuntu.
I am wondering if I can help and land with the cross built. Maybe the xgo github project would help ? I am only guessing about this though.
If others like me would compile everything I could also maybe help with the matching of the c code to the golang code.
xgo works for macOS, but not Windows (see https://github.com/karalabe/xgo/issues/55).
You need the latest mingw-w64 (5.0rc2) which hasn't yet been released.
https://packages.debian.org/search?keywords=mingw-w64
Debian experimental looks to have the mingw-w64 (5.0rc2). Maybe worth trying in a VM ?
Ok thanks Emerson. Looks like I have to wait
@andlabs How did you build these .a
files and from what?
Simply with
cmake -DBUILD_SHARED_LIBS=OFF ..
make
on Ubuntu 16.04.
I forget how or if I specified PIC.
@andlabs I can confirm that it works if I add -fPIC to libui's compiler instructions in CMakeLists.txt. Could you recompile and upload?
Pinging @andlabs in case you missed the last comment.
I'll look into it soon.
Should I install mingw-w64 (5.0rc2) and set CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ before go get github.com/andlabs/ui
?
Yes.
On Archlinux. installed gtk3.
Go
$ go version
go version go1.7.3 linux/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tx/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build663071203=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
install mingw-w64-crt-git-5.0.rc2.r114.g563731c-1
$ yaourt -S mingw-w64-crt-git
get ui
$ CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go get -v -u github.com/andlabs/ui
github.com/andlabs/ui (download)
github.com/andlabs/ui
# github.com/andlabs/ui
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -ldl
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgtk-3
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgdk-3
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lpangocairo-1.0
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lpango-1.0
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -latk-1.0
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lcairo-gobject
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lcairo
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgdk_pixbuf-2.0
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgio-2.0
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lgobject-2.0
/usr/lib/gcc/x86_64-w64-mingw32/6.2.1/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lglib-2.0
collect2: error: ld returned 1 exit status
You must also set $GOOS
.
@andlabs Thanks, it works with mingw-w64-crt-git. #155
The same issue for me on Ubuntu GNOME 16.10. Not fixed yet.
What version of MinGW-w64 does Ubuntu 16.10 come with?
I was just building for Linux, maybe MinGW is not required?
Do you want to build Linux-native programs or Windows-native programs?
Linux-native (Sorry for responding so late. I was traveling these days.)
Then your $GOOS
is not set properly. What does go env
print?
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/nickcao/Projects/Go" GORACE="" GOROOT="/usr/lib/go-1.6" GOTOOLDIR="/usr/lib/go-1.6/pkg/tool/linux_amd64" GO15VENDOREXPERIMENT="1" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0" CXX="g++" CGO_ENABLED="1"
Your environment is correct for a Linux build. I'm not sure why it's trying to build the Windows one...
Maybe building it manually instead of using go get can fix that?
Closing this because I no longer have the original issue.
Get the following when trying to go get:
LANG=C
merely used to have the errors in English.