fbergmann / libSEDML

SED-ML library based on libSBML
BSD 2-Clause "Simplified" License
9 stars 12 forks source link

Undefined symbol libsedml::g_kisaomap? #161

Closed agarny closed 2 years ago

agarny commented 2 years ago

Hi, I have been trying to build a static version (only) of version 2.0.27 of libSEDML. It's all going well, I end up with my libsedml-static.a file, but then the build system tries to build the tests (incidentally, this should be an option, no?) and I am getting the following on macOS:

FAILED: tests/test_sedml
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=10.13 -Wl,-search_paths_first -Wl,-headerpad_max_install_names  tests/CMakeFiles/test_sedml.dir/TestIssues.cpp.o tests/CMakeFiles/test_sedml.dir/TestRunner.cpp.o -o tests/test_sedml  src/sedml/libsedml-static.a  /Users/Alan/libOpenCOR/prebuilt/libxml2/lib/libxml2.a  /Users/Alan/libOpenCOR/prebuilt/libSBML/lib/libsbml-static.a  /Users/Alan/libOpenCOR/prebuilt/libNuML/lib/libnuml-static.a  /Users/Alan/libOpenCOR/prebuilt/libSBML/lib/libsbml-static.a  /Users/Alan/libOpenCOR/prebuilt/libxml2/lib/libxml2.a && :
Undefined symbols for architecture x86_64:
  "libsedml::g_kisaomap", referenced from:
      libsedml::SedAlgorithm::setKisaoID(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libsedml-static.a(SedAlgorithm.cpp.o)
      libsedml::SedAlgorithm::setKisaoID(int) in libsedml-static.a(SedAlgorithm.cpp.o)
      libsedml::SedAlgorithmParameter::setKisaoID(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libsedml-static.a(SedAlgorithmParameter.cpp.o)
      libsedml::SedAlgorithmParameter::setKisaoID(int) in libsedml-static.a(SedAlgorithmParameter.cpp.o)
ld: symbol(s) not found for architecture x86_64

Any idea of what is going on here? Here is the way I configured libSEDML (as an external project in CMake).

fbergmann commented 2 years ago

I agree in both points! the tests should be an option. And the map needs to be fixed. In the contributed KISAO code, the libsedml namespaces are not used, and so the map is declared globally as ::g_kisaomap, and then later referenced via the sedml namespace.

fbergmann commented 2 years ago

I've created a new release 2.0.28 that fixes both points.

agarny commented 2 years ago

Thanks @fbergmann, I can confirm that version 2.0.28 fixes my issues.