Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

Go 1.8, sqlite. build fail #244

Open
mattes opened this issue Jun 5, 2017 · 5 comments
Open

Go 1.8, sqlite. build fail #244

mattes opened this issue Jun 5, 2017 · 5 comments

Comments

@mattes
Copy link
Owner

mattes commented Jun 5, 2017

https://travis-ci.org/mattes/migrate/jobs/239723468#L1512

# github.com/mattn/go-sqlite3
/tmp/go-build858585034/github.com/mattn/go-sqlite3/_obj/sqlite3-binding.o: In function `unixDlError':
../../../mattn/go-sqlite3/sqlite3-binding.c:35914: undefined reference to `dlerror'
/tmp/go-build858585034/github.com/mattn/go-sqlite3/_obj/sqlite3-binding.o: In function `unixDlClose':
../../../mattn/go-sqlite3/sqlite3-binding.c:35945: undefined reference to `dlclose'
/tmp/go-build858585034/github.com/mattn/go-sqlite3/_obj/sqlite3-binding.o: In function `unixDlSym':
../../../mattn/go-sqlite3/sqlite3-binding.c:35941: undefined reference to `dlsym'
/tmp/go-build858585034/github.com/mattn/go-sqlite3/_obj/sqlite3-binding.o: In function `unixDlOpen':
../../../mattn/go-sqlite3/sqlite3-binding.c:35900: undefined reference to `dlopen'
collect2: error: ld returned 1 exit status
@mattes
Copy link
Owner Author

mattes commented Jun 5, 2017

ref: #241
ref: #243
ref: #238

@maxvw
Copy link
Contributor

maxvw commented Jun 6, 2017

@mattes I've been playing around a little bit. So, for me this has been the "easiest" way I got this working locally (macOS), using xgo. It does require Docker but that's already available in the current Travis setup. It also looks like xgo offers less control over the output filenames, so they deviate slightly from the current ones (migrate-linux-amd64 instead of migrate.linux-amd64)

go get github.com/karalabe/xgo

# Change the three Makefile cli targets to this single line
cd ./cli && xgo -out='build/migrate' -ldflags='-X main.Version=$(VERSION)' -tags='$(DATABASE) $(SOURCE)' -targets='linux/amd64,darwin/amd64,windows/amd64' .

For me the question kind of remains if all of this is a good thing, I really like using migrate with SQLite3 (and I'm sure some others do too) but this cgo dependency sounds like it will make cross-compiling more complicated for everyone trying to use this as a library in their own code too (if they also want to cross-compile). Do you have thoughts on that?

@mattes
Copy link
Owner Author

mattes commented Jun 7, 2017

need more time to research. will post here asap.

@mkozjak
Copy link

mkozjak commented Jun 19, 2017

Any news on this one?

@mattes
Copy link
Owner Author

mattes commented Jun 19, 2017

Still haven't found the time to investigate.

dhui added a commit to golang-migrate/migrate that referenced this issue Jan 21, 2018
    - Removed sqlite3 support from binaries
        - It was never working anyways: mattes/migrate#244
    - Don't use cgo as is requires a cross-compiler to build for other platforms
        - cgo was originally added for this reason: mattes/migrate#238 (comment)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants