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:
Johan Wikman
2016-01-22 13:24:49 +02:00
parent a61cedb1aa
commit 1f241a5ed1
19 changed files with 101 additions and 120 deletions

View File

@ -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})