-
Notifications
You must be signed in to change notification settings - Fork 39
dyld: Library not loaded: libdb2.dylib when running GO ibm_DB sdk in MAC #24
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
Comments
Figured out the problem. My path was pointing to wrong DYLD library. |
@akhilravuri1 I still cannot get this to work. I installed the driver with This is my environemnt: $ for env in $DB2HOME $CGO_CFLAGS $CGO_LDFLAGS $DYLD_LIBRARY_PATH; do echo $env; done
/Users/simon/tmp/db2test/clidriver
-I/Users/simon/tmp/db2test/clidriver/include
-L/Users/simon/tmp/db2test/clidriver/lib
/Users/simon/tmp/db2test/clidriver/lib When trying to use the driver, I get the error form this issue: $ go run main.go
dyld: Library not loaded: libdb2.dylib
Referenced from: /var/folders/q3/bf76j42160j2nt4s2tz1_fd40000gn/T/go-build982956092/b001/exe/main
Reason: image not found
signal: abort trap However, the file mentioned seems to be present according to me: $ stat -f "%N (%z)" $DYLD_LIBRARY_PATH/libdb2.dylib
/Users/simon/tmp/db2test/clidriver/lib/libdb2.dylib (32902420) What am I missing here? Why does it seem like I'm missing the library when trying to use the driver? |
Ok this was new to me. Don't know what this is or why but it seems like this only occurs with $ go run main.go; echo $?
dyld: Library not loaded: libdb2.dylib
Referenced from: /var/folders/q3/bf76j42160j2nt4s2tz1_fd40000gn/T/go-build556855419/b001/exe/main
Reason: image not found
signal: abort trap
1 $ go build main.go && ./main; echo $?
0 Is this because the driver requires a relative path? It sounds odd because |
Try this one instead of: I used: then to your command line |
Hi @bombsimon please provide your mac version and go version. Thanks, |
@kierquebs Thanks! Like I wrote in my last post in March it's working if I first build the binary and then run it so the question is why that is. @akhilravuri1 I'm running macOS Catalina 10.15.4 with go version go1.14 darwin/amd64. This is no major issue but I was just curious why it's possible to build and execute but not perform |
Hey I know this issue is kinda old but @bombsimon to answer your question or anyone else who finds this, the reason is here: golang/go#36572 As for the workaround, you can just use
|
Beside the workaround with |
when running the code snippet I get this error:
I installed the driver as per the instruction in the readme. the lib folder has the file libdb2.dylib but it complains about it:
package main
import (
_ "github.com/ibmdb/go_ibm_db"
"database/sql"
"fmt"
)
func main(){
con:="HOSTNAME=host;DATABASE=db;PORT=50000;UID=u;PWD=pwd"
db, err:=sql.Open("go_ibm_db", con)
if err != nil{
}
The text was updated successfully, but these errors were encountered: