From bin.chris.song at gmail.com Tue Mar 6 11:32:11 2018 From: bin.chris.song at gmail.com (Bin Song) Date: Tue, 6 Mar 2018 17:32:11 +0100 Subject: [C++-sig] Boost.Python: undefined symbols when loading a shared library Message-ID: Hello Everyone, I have been working on a code inside the MD simulation package ESPResSo++, which calls code from another package PLUMED to perform some calculations. ESPResSO++ is written using Boost.Python library, while PLUMED is mostly C++. My code works when PLUMED is statically linked. The "undefined symbols" error arises when I uses runtime linking. Basically some interface code are compiled with ESPResSO++, and thereby some symbols are inside the ESPResSO++ shared library. During the runtime, the PLUMED shared library is loaded by dlopen(), then the code complains the symbols are undefined. I have asked the question on stackoverflow ( https://stackoverflow.com/questions/48584427/undefined-symbols-when-loading-c-shared-lib-within-a-shared-c-lib-which-its ). Unfortunately no solution has been found yet. The point is that I know for sure the "missing" symbols are marked as "T" in the ESPResSO++ shared library. I tried options such as -rdynamic or -Wl,-export-dynamic flags when creating the ESPResSO++ shared library to make the symbols visible, based on the webpages I found. Still the issue persists. I use the ESPResSO++ through a Python script. First Python objects are created, and then C++ objects are created. I wonder if the issue has to do with the fact that the ESPResSO++ shared library is imported by Python. Maybe during the process, the symbols related to PLUMED are hidden somehow. If you know how to fix this, or how to diagnose the issue, please let me know. All help are appreciated. Best, Bin