Install without gcc (not possible)
Is it possible to use the library in Go without recompiling the binaries?https://github.com/lxc/lxd/issues/762#issuecomment-112463214
I mean is it possible to compile binary pieces of SQLite needed be go-sqlite3 and ship them in separate repository, so that only Go itself can be used to assemble the final product together? Maybe Go already provides some helpers/tools to do that?
go-sqlite3 is cgo package. so if you want to build app using go-sqlite3, you need gcc.
But if you install go-sqlite3 with go install github.com/mattn/go-sqlite, you don't need gcc.
@mattn the repository github.com/mattn/go-sqlite doesn't exists, and go install github.com/mattn/go-sqlite3 doesn't work too:
C:\ledis>go install github.com/mattn/go-sqlite3
can't load package: package github.com/mattn/go-sqlite3: cannot find package "github.com/mattn/go-sqlite3" in any of:
C:\Program Files\Dev\Go\src\github.com\mattn\go-sqlite3 (from $GOROOT)
C:\ledis\src\github.com\mattn\go-sqlite3 (from $GOPATH)
once go get github.com/mattn/go-sqlite3 and do go install github.com/mattn/go-sqlite3.
C:\ledis\src>go get github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
As I said in above:
go-sqlite3 is cgo package. so if you want to build app using go-sqlite3, you need gcc. But if you install go-sqlite3 with go install github.com/mattn/go-sqlite, you don't need gcc.
And I answered to you in https://github.com/mattn/go-sqlite3/issues/212#issuecomment-112969533 We are going circles.
@techtonik once go-sqlite3 is installed, you no longer need gcc. However, you need the compiled package in your $GOPATH/pkg to do this. To do so, you need gcc to build the C dependencies of this project. ie. $GOPATH/pkg/darwin_amd64/github.com/mattn/go-sqlite3.a.
You could probably compile the archive file elsewhere and put it in the $GOPATH to forego gcc. This isn't guaranteed to work, it's much easier to compile the final program and put the binary on the system with no gcc.
@drewwells: the problem is I am able to go get the package but not able to build/install it. Its complaining about "gcc"
github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
@arulrajalivi what OS are you using?
Windows 64
from cygwin if I try which gcc I get $ gcc --version gcc (GCC) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
followed this link to install gcc : http://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/
getting this from cygwin, so trying to see what to set in the %PATH% $which gcc /usr/bin/gcc
Inside a cygwin window, see what go env says
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
$ go env
set GOARCH=amd64
set GOBIN=$GOROOT\bin
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Projects\Cloud Solutions
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
after adding C:\MinGW\bin, I am getting # github.com/mattn/go-sqlite3 cc1.exe: sorry, unimplemented: 64-bit mode not compiled in. Trying to install the 64 bit version of MinGW but having trouble with that.
as the message, you need to install 64bit gcc.
Early on mattn suggested that you could just "go install ..." but said "go-sqlite" instead of "go-sqlite3". Was this significant?
Or is mattn's last comment, that you need gcc, the absolute truth? Is there a way to install this API without gcc under windows or not?
Ah, it's my fault. :s/go-sqlite/go-sqlite3/g
I have the exact same the problem in windows and I do not understand how Mattm last command solved the problem? what would be the compele command for go insrall?