Wednesday, April 27, 2016

Error on mgo dependency when deploying go app to Heroku

Leave a Comment

I'm trying to deploy a Go App to Heroku, I'm using godeps for dependency management as their docs suggested. But when I git push heroku master I get the following error telling that the file sasl.go doesn't exists.

remote: # github.com/grsouza/feeng-api/vendor/gopkg.in/mgo.v2/internal/sasl remote: vendor/gopkg.in/mgo.v2/internal/sasl/sasl.go:15:24: fatal error: sasl/sasl.h: No such file or directory remote:  // #include <sasl/sasl.h> remote:                         ^ remote: compilation terminated. remote: github.com/grsouza/feeng-api/vendor/github.com/onsi/gomega remote:  remote:  !     Push rejected, failed to compile Go app remote:  remote: Verifying deploy.... remote:  remote: !   Push rejected to limitless-ridge-36512. remote:  To https://git.heroku.com/limitless-ridge-36512.git  ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/limitless-ridge-36512.git' 

Can anyone help me with this issue?

Thanks.

2 Answers

Answers 1

Error tells sasl/sasl.h missing but not sasl.go. sasl.h header file is part of libsasl2-dev package which not installed on heroku and I don't know simple way to install it. To my mind you can try to find sasl headers on your local machine(most likely /usr/include/sasl)and copy to vendor/include/sasl in your local go app source. Then make them visible for CGO using heroku config vars doing

heroku config:set CGO_CFLAGS= -I/app/code/vendor/include/sasl 

in heroku console, and than git push. Also you can look for libsasl2-dev buildpack for heroku and try to use two buildpacks for your app with something like

heroku buildpacks:add heroku/some_libsasl2-dev 

Answers 2

Do you use godep save ./... in your project?

If yes, delete the Godep and vendor directories and try to use godep save, without ./....

I do this and work for me.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment