Rearrange libraries and build files.
This is the first change in an attempt to arrange the linking so that more errors are detected at link-time. - All files in server/core but for gateway.c are linked to one shared library called maxscale-common. - The files log_manager/log_manager.cc and utils/skygw_utils.cc are built into maxscale-common as well. - MaxScale itself consists now only of gateway.c and is linked with maxscale-common. - All plugins link with maxscale-common. - All executables link in addition with {EMBEDDED_LIB}. After this change, the change (MXS-517) where query_classifier is the only component that uses ${EMBEDDED_LIB} and the rest mysqlclient can be made much cleaner. After a few additional steps, all shared libraries can be linked with the linker flags "-Wl,-z,defs", which directs the linker to resolve all symbols. That will require that all shared libraries list all the libraries they need, but will at the same time ensure that any missing symbols are detected at link-time and not at run-time.
This commit is contained in:
@ -1,23 +1,23 @@
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
add_library(testroute SHARED testroute.c)
|
||||
target_link_libraries(testroute log_manager)
|
||||
target_link_libraries(testroute maxscale-common)
|
||||
set_target_properties(testroute PROPERTIES VERSION "1.0.0")
|
||||
install(TARGETS testroute DESTINATION ${MAXSCALE_LIBDIR})
|
||||
endif()
|
||||
|
||||
add_library(readconnroute SHARED readconnroute.c)
|
||||
target_link_libraries(readconnroute log_manager)
|
||||
target_link_libraries(readconnroute maxscale-common)
|
||||
set_target_properties(readconnroute PROPERTIES VERSION "1.1.0")
|
||||
install(TARGETS readconnroute DESTINATION ${MAXSCALE_LIBDIR})
|
||||
|
||||
add_library(debugcli SHARED debugcli.c debugcmd.c)
|
||||
target_link_libraries(debugcli log_manager)
|
||||
target_link_libraries(debugcli maxscale-common)
|
||||
set_target_properties(debugcli PROPERTIES VERSION "1.1.1")
|
||||
install(TARGETS debugcli DESTINATION ${MAXSCALE_LIBDIR})
|
||||
|
||||
add_library(cli SHARED cli.c debugcmd.c)
|
||||
target_link_libraries(cli log_manager)
|
||||
target_link_libraries(cli maxscale-common)
|
||||
set_target_properties(cli PROPERTIES VERSION "1.0.0")
|
||||
install(TARGETS cli DESTINATION ${MAXSCALE_LIBDIR})
|
||||
|
||||
|
@ -1,26 +1,10 @@
|
||||
add_library(binlogrouter SHARED blr.c blr_master.c blr_cache.c blr_slave.c blr_file.c)
|
||||
set_target_properties(binlogrouter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_LIBDIR} VERSION "2.0.0")
|
||||
target_link_libraries(binlogrouter ssl pthread log_manager)
|
||||
target_link_libraries(binlogrouter maxscale-common)
|
||||
install(TARGETS binlogrouter DESTINATION ${MAXSCALE_LIBDIR})
|
||||
|
||||
add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/service.c ${CMAKE_SOURCE_DIR}/server/core/spinlock.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/buffer.c ${CMAKE_SOURCE_DIR}/server/core/atomic.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/hint.c ${CMAKE_SOURCE_DIR}/server/core/gwdirs.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/server.c ${CMAKE_SOURCE_DIR}/server/core/dcb.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/users.c ${CMAKE_SOURCE_DIR}/server/core/dbusers.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/utils.c ${CMAKE_SOURCE_DIR}/server/core/hashtable.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/poll.c ${CMAKE_SOURCE_DIR}/server/core/gwbitmask.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/config.c ${CMAKE_SOURCE_DIR}/server/core/session.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/housekeeper.c ${CMAKE_SOURCE_DIR}/server/core/filter.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/resultset.c ${CMAKE_SOURCE_DIR}/server/core/load_utils.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/monitor.c ${CMAKE_SOURCE_DIR}/server/core/gw_utils.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/thread.c ${CMAKE_SOURCE_DIR}/server/core/secrets.c
|
||||
${CMAKE_SOURCE_DIR}/server/core/random_jkiss.c ${CMAKE_SOURCE_DIR}/server/core/maxscale_pcre2.c
|
||||
${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/server/core/externcmd.c)
|
||||
|
||||
|
||||
target_link_libraries(maxbinlogcheck utils ssl pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} aio rt crypt dl crypto inih z m stdc++ ${CURL_LIBRARIES} ${PCRE2_LIBRARIES})
|
||||
add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c)
|
||||
target_link_libraries(maxbinlogcheck maxscale-common)
|
||||
|
||||
install(TARGETS maxbinlogcheck DESTINATION bin)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
if(BUILD_TESTS)
|
||||
add_executable(testbinlogrouter testbinlog.c ../blr.c ../blr_slave.c ../blr_master.c ../blr_file.c ../blr_cache.c)
|
||||
target_link_libraries(testbinlogrouter fullcore ssl pthread log_manager)
|
||||
target_link_libraries(testbinlogrouter maxscale-common)
|
||||
add_test(TestBinlogRouter ${CMAKE_CURRENT_BINARY_DIR}/testbinlogrouter)
|
||||
endif()
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(maxinfo SHARED maxinfo.c maxinfo_parse.c maxinfo_error.c maxinfo_exec.c)
|
||||
set_target_properties(maxinfo PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_LIBDIR} VERSION "1.0.0")
|
||||
target_link_libraries(maxinfo pthread log_manager)
|
||||
target_link_libraries(maxinfo maxscale-common)
|
||||
install(TARGETS maxinfo DESTINATION ${MAXSCALE_LIBDIR})
|
||||
|
@ -1,5 +1,5 @@
|
||||
add_library(readwritesplit SHARED readwritesplit.c)
|
||||
target_link_libraries(readwritesplit ssl pthread log_manager query_classifier)
|
||||
target_link_libraries(readwritesplit maxscale-common query_classifier)
|
||||
set_target_properties(readwritesplit PROPERTIES VERSION "1.0.2")
|
||||
install(TARGETS readwritesplit DESTINATION ${MAXSCALE_LIBDIR})
|
||||
if(BUILD_TESTS)
|
||||
|
@ -1,11 +1,11 @@
|
||||
add_library(schemarouter SHARED schemarouter.c sharding_common.c)
|
||||
target_link_libraries(schemarouter log_manager query_classifier)
|
||||
target_link_libraries(schemarouter maxscale-common query_classifier)
|
||||
add_dependencies(schemarouter pcre2)
|
||||
set_target_properties(schemarouter PROPERTIES VERSION "1.0.0")
|
||||
install(TARGETS schemarouter DESTINATION ${MAXSCALE_LIBDIR})
|
||||
|
||||
add_library(shardrouter SHARED shardrouter.c svcconn.c sharding_common.c)
|
||||
target_link_libraries(shardrouter log_manager query_classifier)
|
||||
target_link_libraries(shardrouter maxscale-common query_classifier)
|
||||
add_dependencies(shardrouter pcre2)
|
||||
set_target_properties(shardrouter PROPERTIES VERSION "1.0.0")
|
||||
install(TARGETS shardrouter DESTINATION ${MAXSCALE_LIBDIR})
|
||||
|
Reference in New Issue
Block a user