Hello I have been evaluating nim, I was playing around when i encountering few
things that i would like to resolve. Thanks in advance for the help.
I have a problem trying to run the following simple code:
import db_sqlite
let conn = open("mydb.sql", nil, nil, nil)
conn.close();
Run
I compile it using the following command:
nim -d:release c src/service.nim
Run
compiles OK when i execute the binary the following appears:
could not load: libsqlite3.so(|.0)
compile with -d:nimDebugDlOpen for more information
Run
So i guess is doing dlopen to find the libsqlite3.so, what about if i want to
link sqlite3 statically? can I pass sqlite3.c (amalgamated) in some way? , cant
find an option to do so or anything related.
things i have tried:
$ nim -d:nimDebugDlOpen --passL:sqlite.a c src/service.nim
Hint: used config file
'/nix/store/q39xgpzqqdx8bc76bxsl6vxrl6sagi49-nim-0.18.0/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: service [Processing]
Hint: db_sqlite [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: algorithm [Processing]
Hint: sqlite3 [Processing]
Hint: db_common [Processing]
Hint: [Link]
sqlite.a: In function `pthreadMutexAlloc':
sqlite3.c:(.text+0x1d683): undefined reference to `pthread_mutexattr_init'
sqlite3.c:(.text+0x1d690): undefined reference to
`pthread_mutexattr_settype'
sqlite3.c:(.text+0x1d6a3): undefined reference to
`pthread_mutexattr_destroy'
sqlite.a: In function `pthreadMutexTry':
sqlite3.c:(.text+0x1d7a2): undefined reference to `pthread_mutex_trylock'
sqlite.a: In function `vdbeSorterJoinThread':
sqlite3.c:(.text+0x347c7): undefined reference to `pthread_join'
sqlite.a: In function `vdbeSorterFlushPMA':
sqlite3.c:(.text+0x507e1): undefined reference to `pthread_create'
sqlite.a: In function `vdbePmaReaderIncrInit':
sqlite3.c:(.text+0x55979): undefined reference to `pthread_create'
sqlite.a: In function `vdbePmaReaderNext':
sqlite3.c:(.text+0x5657e): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc -o
/home/pvd/Devel/nim/src/service
/home/pvd/Devel/nim/src/nimcache/service_service.o
/home/pvd/Devel/nim/src/nimcache/stdlib_system.o
/home/pvd/Devel/nim/src/nimcache/stdlib_db_sqlite.o
/home/pvd/Devel/nim/src/nimcache/stdlib_strutils.o
/home/pvd/Devel/nim/src/nimcache/stdlib_parseutils.o
/home/pvd/Devel/nim/src/nimcache/stdlib_math.o
/home/pvd/Devel/nim/src/nimcache/stdlib_algorithm.o
/home/pvd/Devel/nim/src/nimcache/stdlib_sqlite3.o
/home/pvd/Devel/nim/src/nimcache/stdlib_db_common.o -lm sqlite.a -ldl'
~/D/nim gcc
gcc: fatal error: no input files
compilation terminated.
Run
Some kind related to my problem:
how do I compile in release/debug/releaseWithSymbols.... with nimble? the only
option i have is 'nimble build'