Skip to content

Instantly share code, notes, and snippets.

@jmptrader
Forked from mnadel/go-oci8 on win64.md
Created March 27, 2022 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmptrader/04469466c82039156fcd24a372210dd0 to your computer and use it in GitHub Desktop.
Save jmptrader/04469466c82039156fcd24a372210dd0 to your computer and use it in GitHub Desktop.
go-oci8 on windows64

Prerequisites

Create a file called oci8.pc

ora=<instaclient-install-dir>
gcc=<tdm-gcc-install-dir>

oralib=${ora}\\sdk\\lib\\msvc
orainclude=${ora}\\sdk\\include

gcclib=${gcc}\\lib
gccinclude=${gcc}\\include

Name: OCI
Description: Oracle database engine
Version: 12.1
Libs: -L${oralib} -L${gcclib} -loci
Libs.private: 
Cflags: -I${orainclude} -I${gccinclude}

Make sure to use \\ as the path separator

Setup environment

  • set PATH=<tdm-gcc-install-dir>\bin;%PATH%
  • set PKG_CONFIG_PATH=<path-to->\oci8.pc

Build your app

  • go get github.com/mattn/go-oci8
  • go build -x your-prog.go

Note: -x will show you the underlying gcc/ld commands, which is incredibly useful for debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment