Ensure symbols are resolved at link-time.

With the linker flags "-Wl,-z,defs", all symbols used by a library
are resolved at link-time. Otherwise they will be resolved at runtime.
The use of these flags ensures that missing symbols are found as
early as possible.

Case in point, the binlog router test-cases failed, because the loading
of the binlog router failed due to missing symbols my_uuid_init and
my_uuid. The reason was that when maxscale no longer was linked with
the embedded library, those symbols were not available.

Now we know that the loading of the binlog router will not fail due
to missing symbols.
This commit is contained in:
Johan Wikman 2016-03-01 21:29:13 +02:00
parent 9b5550c053
commit 1d4779215d

View File

@ -1,5 +1,6 @@
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")
set_target_properties(binlogrouter PROPERTIES LINK_FLAGS -Wl,-z,defs)
# libbinlogrouter refers to my_uuid_init and my_uuid. They are non-public functions and
# should not be used. They are found only from the embedded lib.
target_link_libraries(binlogrouter maxscale-common ${MYSQL_EMBEDDED_LIBRARIES})