Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

app built without gcc will crash #443

Closed
kpvt001 opened this issue Jul 26, 2017 · 3 comments
Closed

app built without gcc will crash #443

kpvt001 opened this issue Jul 26, 2017 · 3 comments

Comments

@kpvt001
Copy link

kpvt001 commented Jul 26, 2017

source code:

func main() {

	db,dberr:=sql.Open("sqlite3","./test.db")
	if dberr!=nil {
		fmt.Println(dberr.Error())
	}

	stmt,err2:=db.Prepare("INSERT INTO shipping_line(vessel_prefix, captin_name) values(?,?)")
	if err2!=nil{
		fmt.Println(err2.Error())
	}
        stmt.Exec("prefix", "captin")
}

output:

F:\gopath\src\project>project.exe
Exception 0xc0000005 0x8 0xd872f8 0xd872f8
PC=0xd872f8
signal arrived during external code execution

github.com/mattn/go-sqlite3._Cfunc__sqlite3_step(0x3f5a1b8, 0xc0421417f8, 0xc042141800, 0x0)
        github.com/mattn/go-sqlite3/_obj/_cgo_gotypes.go:241 +0x54
github.com/mattn/go-sqlite3.(*SQLiteStmt).exec.func4(0x3f5a1b8, 0xc0421417f8, 0xc042141800, 0xc04203a2a0)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:966 +0x7b
github.com/mattn/go-sqlite3.(*SQLiteStmt).exec(0xc04215d620, 0x1488098, 0xc04203a2a0, 0xc042073400, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:966 +0x1a2
github.com/mattn/go-sqlite3.(*SQLiteStmt).ExecContext(0xc04215d620, 0xd8f120, 0xc04203a2a0, 0xc0420733b0, 0x2, 0x2, 0xc000000008, 0xc042056040, 0xc042083c98, 0x996b8c)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3_go18.go:68 +0x239
database/sql.ctxDriverStmtExec(0xd8f120, 0xc04203a2a0, 0xd8f360, 0xc04215d620, 0xc0420733b0, 0x2, 0x2, 0x0, 0x0, 0xc0421a09a0, ...)
        C:/Go/src/database/sql/ctxutil.go:66 +0x24b
database/sql.resultFromStatement(0xd8f120, 0xc04203a2a0, 0xc042151640, 0xc042083f58, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)
        C:/Go/src/database/sql/sql.go:1841 +0x19a
database/sql.(*Stmt).ExecContext(0xc042142800, 0xd8f120, 0xc04203a2a0, 0xc042083f58, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)
        C:/Go/src/database/sql/sql.go:1802 +0x259
database/sql.(*Stmt).Exec(0xc042142800, 0xc042083f58, 0x2, 0x2, 0x0, 0x0, 0x0, 0xc042083ed0)
        C:/Go/src/database/sql/sql.go:1814 +0x6c
main.main()
        F:/gopath/src/project/main.go:26 +0x1c0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 36 [chan receive]:
database/sql.(*DB).connectionOpener(0xc042137c20)
        C:/Go/src/database/sql/sql.go:837 +0x51
created by database/sql.Open
        C:/Go/src/database/sql/sql.go:582 +0x219

goroutine 37 [select]:
github.com/mattn/go-sqlite3.(*SQLiteStmt).exec.func3(0x1488098, 0xc04203a2a0, 0xc042039140, 0x1ea6648)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:958 +0x11c
created by github.com/mattn/go-sqlite3.(*SQLiteStmt).exec
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:963 +0x13f
rax     0x0
rbx     0x3
rcx     0x1c8
rdi     0x1
rsi     0x1ea7650
rbp     0x0
rsp     0x147f948
r8      0x1
r9      0x0
r10     0x0
r11     0x246
r12     0x1ea6648
r13     0x1
r14     0x40
r15     0x0
rip     0xd872f8
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b

build cmd go build -ldflags="-linkmode=internal -extld=none"

@kpvt001
Copy link
Author

kpvt001 commented Jul 26, 2017

windows 10 x64, no gcc

In another vm(windows7 x64, installed TDM-GCC), using go build to build, run successfully.

@kpvt001 kpvt001 changed the title app crashed when calling insert app crashed when inserting data Jul 26, 2017
@kpvt001
Copy link
Author

kpvt001 commented Jul 26, 2017

When I build with go build in vm has gcc, it will work fine. Yesterday in issue #442 , we solved the building problem with go build -ldflags="-linkmode=internal -extld=none" , but it causes this issue.

I think it still need gcc when building app even though installing go-sqlite3 with go install github.com/mattn/go-sqlite3

@kpvt001 kpvt001 changed the title app crashed when inserting data app built without gcc will crash Jul 27, 2017
@mattn
Copy link
Owner

mattn commented Jul 31, 2017

I'm not sure but gcc is not required after installing go-sqlite3 on linux.

gjrtimmer added a commit to gjrtimmer/go-sqlite3 that referenced this issue May 26, 2018
Compile Section Closes mattn#175
Compile Section Closes mattn#201
Compile Section Closes mattn#206
Compile Section Closes mattn#404
Compile Section Closes mattn#217
Compile Section Closes mattn#224
Compile Section Closes mattn#234
Compile Section Closes mattn#242
Feature table Closes mattn#255
Description Section Closes mattn#232
Golang:1.6 not supported Closes mattn#272
Golang:1.5 not supported + compilation section Closes mattn#283
usleep Implemented Closes mattn#285
FAQ Section Closes mattn#289
Compile Section closes mattn#295
FAQ Section Closes mattn#305
PR339 Closes mattn#318 mattn#321
Compilation Section Closes mattn#341
PR407 Closes mattn#364
Feature `sqlite_vtable` Closes mattn#393
Compile Section Closes mattn#416
sqlite_trace feature Closes mattn#433
Compilation Section Closes mattn#435
Compilation Section Closes mattn#443
Golang:1.6 Not Supported Closes mattn#445
Compilation Section Closes mattn#451
Compilation Section Closes mattn#467
Compilation Section Closes mattn#491
Compilation Section Closes mattn#495
Compilation Section Closes mattn#505
Compilation Section Closes mattn#557
Compilation Section Closes mattn#560
@mattn mattn closed this as completed in c9394b1 May 27, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants