Author Topic: C - SQLite - Linux - 14 error messages - library problems - updated 2023/01/27  (Read 3037 times)

Offline DeutscherMichel

  • Single posting newcomer
  • *
  • Posts: 3
Hi,

I am using Debian 11.
I want to setup CodeBlocks for use of SQLite, having following simple program:

Code
#include<stdio.h>
#include <sqlite3.h>

int main(int argc, char* argv[]) {
   sqlite3 *db;
   char *zErrMsg = 0;
   int rc;
   rc = sqlite3_open("test.db", &db);
   if( rc ) {
      printf("Can't open database: %s\n", sqlite3_errmsg(db));
      return(0);
   } else {
      printf("Database successfully opened\n");
   }
   sqlite3_close(db);
}
At command line
# gcc testsq01.c -l sqlite3 -o testsq01    works without problems.

In Settings / Compiler - Linker settings I added
/usr/lib/x86_64-linux-gnu/libsqlite3
/usr/lib/x86_64-linux-gnu/libpthread.a
/usr/lib/x86_64-linux-gnu/libdl.a

Build leads to
...
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libsqlite3.a(sqlite3.o)||in function `unixDlOpen':|
||warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking|
||warning: relocation against `_dl_init_static_tls' in read-only section `.text'
...


I'd like to use the existing libraries an not copy anything into the code directory.
What is wrong with my CodeBlocks setup?
Thanks
Michel

Because of posting problems see my following reply
« Last Edit: January 27, 2023, 11:48:17 pm by DeutscherMichel »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
This are warnings. The program should work?
Are the warnings what annoys you?

For this kind of errors a full build log would be helpful:
https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Offline DeutscherMichel

  • Single posting newcomer
  • *
  • Posts: 3
CodeBlocks Version 20.03
Debian version 11.5
gcc (Debian 10.2.1-6) 10.2.1 20210110

Sorry, the forum system refused to accept my full post (and it still does) and so I cut a part of my post including the error messages.

Subset of build messages:
Build leads to 14 errors
||=== Build: Debug in Journal (compiler: GNU GCC Compiler) ===|
..
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libsqlite3.a(sqlite3.o)||in function `fts5Bm25Function':|
(.text+0x718e7)||undefined reference to `log'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpthread.a(pthread_create.o)||in function `allocate_stack':|
./nptl/allocatestack.c|525|undefined reference to `_dl_stack_flags'|
/usr/bin/ld: ./nptl/allocatestack.c|647|undefined reference to `_dl_stack_flags'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpthread.a(elision-lock.o)||in function `do_set_elision_enable':|
./nptl/../sysdeps/unix/sysv/linux/x86/elision-conf.c|66|undefined reference to `_dl_x86_cpu_features'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||in function `__pthread_initialize_minimal_internal':|
./nptl/nptl-init.c|335|undefined reference to `_dl_pagesize'|
/usr/bin/ld: ./nptl/nptl-init.c|344|undefined reference to `_dl_pagesize'|
/usr/bin/ld: ./nptl/nptl-init.c|360|undefined reference to `_dl_init_static_tls'|
/usr/bin/ld: ./nptl/nptl-init.c|362|undefined reference to `_dl_wait_lookup_done'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||in function `__pthread_get_minstack':|
./nptl/nptl-init.c|393|undefined reference to `_dl_pagesize'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdl.a(dlopen.o)||in function `dlopen':|
(.text+0x5)||undefined reference to `__dlopen'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdl.a(dlclose.o)||in function `dlclose':|
(.text+0x1)||undefined reference to `__dlclose'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdl.a(dlsym.o)||in function `dlsym':|
(.text+0x5)||undefined reference to `__dlsym'|
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libdl.a(dlerror.o)||in function `dlerror':|
(.text+0x1)||undefined reference to `__dlerror'|
||warning: creating DT_TEXTREL in a PIE|
||error: ld returned 1 exit status|
||=== Build failed: 14 error(s), 4 warning(s) (0 minute(s), 1 second(s)) ===|
« Last Edit: January 27, 2023, 11:41:44 pm by DeutscherMichel »