tomojitakasu / RTKLIB

2.58k stars 1.63k forks source link

ConvBin Depends on GUI extern functions #621

Open geoeo opened 3 years ago

geoeo commented 3 years ago

I am trying to build the convbin app from source my cmake is as follows:

cmake_minimum_required(VERSION 3.20)
project(rtklib C)

file(GLOB_RECURSE SOURCES "src/*.*")
file(GLOB_RECURSE SOURCES_2 "src/rcv/*.*")

include_directories(src)

add_library(rtklib
        SHARED
        ${SOURCES}
        ${SOURCES_2})

target_include_directories(rtklib PUBLIC src)
target_include_directories(rtklib PUBLIC src/rcv)

target_link_libraries(rtklib PUBLIC pthread m)

install(TARGETS rtklib LIBRARY
        DESTINATION lib COMPONENT library
        CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})

add_executable(rnx2rtkp app/rnx2rtkp/rnx2rtkp.c)
target_link_libraries(rnx2rtkp rtklib)

add_executable(convbin app/convbin/convbin.c )
target_link_libraries(convbin rtklib)

But I am getting the link errors for convbin: (rnx2rtkp works)

/usr/bin/ld: librtklib.so: undefined reference to `settspan'
/usr/bin/ld: librtklib.so: undefined reference to `settime'

I checked and these are defined in postmain.cpp which is a different app and has gui dependencies which I want to avoid. How can I build convbin from sources as a purely CLI tool?

geoeo commented 3 years ago

I fixed this my adding empty method stubs to convbin.c. Not sure why its searching for these though

yangtseJin commented 11 months ago

you should use the static library instead of dynamic library, such as

add_library(rtklib
        STATIC
        ${SOURCES}
        ${SOURCES_2})