I need to set static linking for my project.
Current state is :
target_link_libraries(armd
${SQLITE3_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
rt)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-O0 -Wall -fmessage-length=0")
doesn't work on device, I need to link statically (add -static for device) but when I do
set(CMAKE_CXX_FLAGS "-O0 -Wall -fmessage-length=0 -static")
I'm getting:
/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libsqlite3.a(sqlite3.o): In function `unixDlOpen':
sqlite3.c:(.text+0x3e5d4): undefined reference to `dlopen'
How do I set static linking for sqlite without getting this error? Or maybe my root system is missing something?
When statically linking some archives, you need to specify its dependencies (in this case libdl) yourself. Be aware of that the order in which you specify the archive files on the linker command line is more important than for linking shared objects.