-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use this in a makefile for CI/CD (sqlcli1.h: No such file or directory) #238
Comments
@ZacZelner |
@ZacZelner Any update? Thanks. |
Thanks. @bimalkjha @vmathur12 . It seems there is no $IBM_DB_HOME env in the container when the makefile build. Part of our makefile: Development environments-----------------------------------------------------------------------------install-runtime: local_setup: sh ./deployment/local/setup.sh
.PHONY: unit-test .PHONY: lint I print all the env: It works well in our dockerfile before. But not work well in Makefile. Our CI/CD developer said: |
@bimalkjha @vmathur12 any update for this? |
Or how can we skip downloading go install github.com/ibmdb/go_ibm_db/installer, but packed all related folder (like github.com/ibmdb/go_ibm_db/installer/clidriver) directly into image and make your tool work well? @bimalkjha @vmathur12 |
@ZacZelner Please check install instructions for go_ibm_db in this doc: https://github.com/ibmdb/go_ibm_db?tab=readme-ov-file#how-to-install-in-linuxmac If you already have a db2client like dsdriver or dsclient or db2server installed in the system, you can set IBM_DB_HOME env var pointing to the install directory of db2client and then install go driver. Otherwise, you need to run setup.go command so that setup.go can pull clidriver and install in the system for use by go. sqlcli1.h file comes with db2clients under include directory. The clidriver that get pulled by setup.go also as include directory with sqlcli1.h file. Then you need to set the CGO flags like in the install doc. I would suggest to update your CI/CD pipeline script to pull https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64_odbc_cli.tar.gz , untar it and get full path of clidriver directory. Then set IBM_DB_HOME=full path of untared clidriver. Then set below env vars: Replace DB2HOME with IBM_DB_HOME in your CI/CD pipeline script.
Thanks. |
Thanks! We tried some solution like you said. However, due to our user access, we just can put all these clidriver into vendor folder, and set: Our application source code folder is /workspace/cloned-git-repository. When we build the go application, it still has this error: Building go application using version: github.com/ibmdb/go_ibm_db/apivendor/github.com/ibmdb/go_ibm_db/api/api_unix.go:12:11: fatal error: sqlcli1.h: No such file or directory the $PATH is:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/app-root/src/.go/bin Our question is: can the support clidriver folder be put in vendor folder and work well? |
Hi, we are using this for years, and recently got a issue when we build a auto CI/CD pipeline.
We are using a makefile to do the auto CI/CD, and code are:
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
CGO_CFLAGS=-I$DB2HOME/include
CGO_LDFLAGS=-L$DB2HOME/lib
LD_LIBRARY_PATH=$DB2HOME/lib
install-runtime:
GO111MODULE=on go install github.com/tools/godep@latest
GO111MODULE=on go install github.com/ibmdb/go_ibm_db/[email protected]
local_setup:
sh ./deployment/local/setup.sh
#CIO CI CD
.PHONY: unit-test
unit-test:
go test tests/wc_test.go
.PHONY: lint
lint:
@echo '==> Linting...'
go fmt
go vet
However, when it runs to go vet, it pop up the error:
vendor/github.com/ibmdb/go_ibm_db/api/api_unix.go:12:11: fatal error: sqlcli1.h: No such file or directory
// #include <sqlcli1.h>
From our experience, it means the env setting is not correct.
We have already claim the env in the beginning, however it does not work.
Anyone know how to build this go_ibm_db in a makefile?
Thanks!
The text was updated successfully, but these errors were encountered: