azadkuh / sqlite-amalgamation

The SQLite amalgamation mirror with cmake
http://www.sqlite.org/amalgamation.html
BSD 3-Clause "New" or "Revised" License
92 stars 63 forks source link

shell_app build error in ubuntu20 #13

Open chengxuewen opened 6 months ago

chengxuewen commented 6 months ago

[cmake] -- sqlite-amalgamation-3.38.2 configure success [cmake] [1/5] Building C object CMakeFiles/shell_app.dir/shell.c.o [cmake] [2/5] Building C object CMakeFiles/SQLite3.dir/sqlite3.c.o [cmake] [3/5] Linking C static library libsqlite3.a [cmake] [4/5] Linking C executable sqlite3 [cmake] FAILED: sqlite3 [cmake] : && /usr/bin/cc -O3 -DNDEBUG CMakeFiles/shell_app.dir/shell.c.o -o sqlite3 libsqlite3.a -lpthread -ldl && cd /home/ubuntu/Documents/sqlite-amalgamation-3.38.2/build && /usr/bin/strip sqlite3 [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o): in function logFunc': [cmake] sqlite3.c:(.text+0x196ed): undefined reference tolog' [cmake] /usr/bin/ld: sqlite3.c:(.text+0x1971d): undefined reference to log' [cmake] /usr/bin/ld: sqlite3.c:(.text+0x19781): undefined reference tolog' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1370): undefined reference to trunc' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1520): undefined reference toexp' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1568): undefined reference to pow' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x15b0): undefined reference topow' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x15f8): undefined reference to fmod' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1640): undefined reference toacos' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1688): undefined reference to asin' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x16d0): undefined reference toatan' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1718): undefined reference to atan2' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1760): undefined reference tocos' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x17a8): undefined reference to sin' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x17f0): undefined reference totan' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1838): undefined reference to cosh' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1880): undefined reference tosinh' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x18c8): undefined reference to tanh' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1910): undefined reference toacosh' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x1958): undefined reference to asinh' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x19a0): undefined reference toatanh' [cmake] /usr/bin/ld: libsqlite3.a(sqlite3.c.o):(.data.rel+0x19e8): undefined reference to `sqrt' [cmake] collect2: error: ld returned 1 exit status [cmake] ninja: build stopped: subcommand failed. [cmake] -- Configuring incomplete, errors occurred!

fd4f85218e7c46289d38d6fc154fe0d6

need add -lm in target_link_libraries function. if(UNIX) target_link_libraries(shell_app PRIVATE -lm) endif()