Go-sqlite3: installed mingw for 64bit windows, still cannot build

Created on 8 Jul 2017  路  9Comments  路  Source: mattn/go-sqlite3

I tried searching this issue,

# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

and it looks like most of the resolved issues had obvious problems. In my scenario, I installed mingw and added the bin folder to my path. I can do gcc -v and which gcc, and that yields...

$ which gcc
/c/Program Files/mingw-w64/x86_64-7.1.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc

I am able to run go get and go install for "github.com/mattn/go-sqlite3" but I still get that error when I try to build. I think go install is working because I have go-sqlite3.a in my gopath pkg directory... is there some special way I need to use it if we can't figure out the gcc issue?

Most helpful comment

FWIW, I played with getting a build to work in the Win10 Unix tools but gave up after time wasted. Instead, I recorded these steps in my project README. They've worked several times.

  • Download and install tdm64-gcc-5.1.0-2.exe from http://tdm-gcc.tdragon.net/download.
  • Go to Program Files and click on "MinGW Command Prompt". This will open a console with the correct environment for using MinGW with GCC.
  • Within this console, navigate to your GOPATH.
  • Enter the following commands:
go get -u github.com/mattn/go-sqlite3
go install github.com/mattn/go-sqlite3

All 9 comments

May be space contained in Program Files. I can't help you because this is not depend on go-sqlite3.

So windows can find it but go cannot because of the space? Thanks for the suggestion, will give that a try.

Why you use gcc command from UNIX like shell? Try to do with command prompt.

FWIW, I played with getting a build to work in the Win10 Unix tools but gave up after time wasted. Instead, I recorded these steps in my project README. They've worked several times.

  • Download and install tdm64-gcc-5.1.0-2.exe from http://tdm-gcc.tdragon.net/download.
  • Go to Program Files and click on "MinGW Command Prompt". This will open a console with the correct environment for using MinGW with GCC.
  • Within this console, navigate to your GOPATH.
  • Enter the following commands:
go get -u github.com/mattn/go-sqlite3
go install github.com/mattn/go-sqlite3

Yes, That's my expected.

I have 4 things to try now the next moment I am at my work station, thank you both!

I thought the issue could be that gcc is in my user path but not my system path... but I will try all of these things.

Hey @Jason-Abbott , after I do go install, is there anything special I need to do to use the "installed" file? I thought I did go get & go install before, but it still told me it could not find gcc. Or is this perhaps a bug with liteide?

@student020341 I didn't have to do anything additional. It's in the path after installation so everything works as expected after that. I switch between Win10 and OSX once or twice a day (laptop/desktop) and the steps above have kept it seamless.

Hello, @student020341
It is better to install mingw using msys2
It supports msys2 is installed in D:\Tools\msys64\

  • perform pacman -S mingw-w64-x86_64-gcc in msys2_shell after installing msys2
  • perform pacman -S mingw-w64-x86_64-sqlite3 to install sqlite3 native library
  • add D:\Tools\msys64\mingw64\bin to PATH environment

Realized I never updated this, my apologies everyone!

After putting the path in the system variables, go under the hood was able to build this properly with gcc! :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apertureless picture apertureless  路  4Comments

mhat picture mhat  路  7Comments

aletheia7 picture aletheia7  路  8Comments

korovkin picture korovkin  路  12Comments

jacentsao picture jacentsao  路  6Comments