1

I need to create a shared object (.so) that is linked against another shared object (my code uses functions / symbols exported by that shared object). No matter what I try, CMake / G++ / LD refuse to include the shared object in the linking operation.

Specifically, I'm implementing an OEM table type for the MariaDB CONNECT engine. I've attempted to use these CMake directives and their accompanying directives with ZERO success:

link_directories()
add_library()
find_library()
target_link_libraries()

I'm at a total loss. My code does compile, and depending on the settings is appears to link, but is always missing the ha_connect.so dependency when I check and therefore throws undefined symbol errors when loaded.

I've already attempted the enlist the help of Olivier Bertrand (the CONNECT maintainer). The code in question apparently compiles, links, and runs with no issues under Windows, which puts him at a bit of a loss as to what the issue is that's preventing it from linking under Linux.

My current CMakeLists.txt that compiles and links without throwing errors during linking looks like this:

cmake_minimum_required(VERSION 3.10)

project(data_flex VERSION 0.9 DESCRIPTION "DataFlex lib for Maria Connect")
include(GNUInstallDirs)

file(GLOB_RECURSE sources      src/*.cpp include/*.h)

add_library(data_flex SHARED ${sources})
target_include_directories(data_flex PRIVATE include)

set_target_properties(data_flex PROPERTIES
    VERSION ${PROJECT_VERSION}
    SOVERSION 0.9
    PUBLIC_HEADER include/DataFlex.h)

target_compile_options(data_flex PUBLIC -std=c++1y -Wall -Wfloat-conversion)

When the .so is actually loaded, it still throws undefined symbol errors though. Chasing down where those symbols are supposed to be, they're all located in ha_connect.so. I know the above CMakeLists.txt doesn't contain a reference to ha_connect.so, but I'm in an airport at the moment and can't get to the other versions I've tried at the moment. (edited in response to -kanstar (apologies for my omission earlier))

  • 1
    How do you expect us to help you if don't include anything what you have tried so far, like show us the `CMakeLists.txt` files you have written. – serkan.tuerker Jul 09 '19 at 03:38
  • My apologies for the omission, I'm really just at a total loss and traveling through several airports at the moment. – Mark Schlachter Jul 09 '19 at 08:35

0 Answers0