Skip to content
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

Trying to run my app gives a C file dump #115

Closed
sethgrid opened this issue Mar 19, 2014 · 4 comments
Closed

Trying to run my app gives a C file dump #115

sethgrid opened this issue Mar 19, 2014 · 4 comments

Comments

@sethgrid
Copy link

I just installed go1.2.1.darwin-amd64-osx10.6. When I run go get or try to run my sample app, I see the following:

$ go get github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
gcc did not produce error at completed:1
on input:
#line 3 "/Users/sethammons/playground/go/trap/src/github.com/mattn/go-sqlite3/sqlite3.go"

#include 
#include 
#include 

#ifdef __CYGWIN__
# include 
#endif

#ifndef SQLITE_OPEN_READWRITE
# define SQLITE_OPEN_READWRITE 0
#endif

#ifndef SQLITE_OPEN_FULLMUTEX
# define SQLITE_OPEN_FULLMUTEX 0
#endif

static int
_sqlite3_open_v2(const char *filename, sqlite3 **ppDb, int flags, const char *zVfs) {
#ifdef SQLITE_OPEN_URI
  return sqlite3_open_v2(filename, ppDb, flags | SQLITE_OPEN_URI, zVfs);
#else
  return sqlite3_open_v2(filename, ppDb, flags, zVfs);
#endif
}

static int
_sqlite3_bind_text(sqlite3_stmt *stmt, int n, char *p, int np) {
  return sqlite3_bind_text(stmt, n, p, np, SQLITE_TRANSIENT);
}

static int
_sqlite3_bind_blob(sqlite3_stmt *stmt, int n, void *p, int np) {
  return sqlite3_bind_blob(stmt, n, p, np, SQLITE_TRANSIENT);
}
@sethgrid
Copy link
Author

Possible relevant information: I had compiled Go to be able to cross compile on different OS's and architectures. This may have been the issue that kicked off the above error. I ripped out Go completely and reinstalled. No dice.

Other info that may be of help:

$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/sethammons/playground/go/trap"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread -fno-common"
CXX="g++"
CGO_ENABLED="1"

@sethgrid sethgrid changed the title File dump? Trying to run my app gives a C file dump Mar 20, 2014
@mattn
Copy link
Owner

mattn commented Mar 20, 2014

Do you install C compiler?

@sethgrid
Copy link
Author

Here are my gcc, clang, and CC versions.

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
$ clang --version
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
$ CC --version
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

I read elsewhere that if I export CC=clang, that it may fix things. I got

$ go run trapm.go
# command-line-arguments
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol close
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol access
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol getcwd
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol stat$INODE64
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol fstat$INODE64
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol ftruncate
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol fcntl
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol read
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol pread
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol write
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol pwrite
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol fchmod
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol unlink
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol mkdir
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol rmdir
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol mmap
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol munmap
github.com/mattn/go-sqlite3(__DATA/__data): unhandled relocation for close (type 32 rtype 120)
github.com/mattn/go-sqlite3(__DATA/__data): unhandled relocation for access (type 32 rtype 120)
github.com/mattn/go-sqlite3(__DATA/__data): unhandled relocation for getcwd (type 32 rtype 120)
github.com/mattn/go-sqlite3(__DATA/__data): unhandled relocation for stat$INODE64 (type 32 rtype 120)
too many errors

@sethgrid
Copy link
Author

Apparently, there is a possible bug in the linker. Go-Nuts helped out. I had to remove Go and re-install it using brew. After that, things are working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants