GMLC-TDC / HELICS

Hierarchical Engine for Large-scale Infrastructure Co-Simulation (HELICS)
https://docs.helics.org/en/latest/
BSD 3-Clause "New" or "Revised" License
127 stars 40 forks source link

helics::systemInfo() is not exported to the shared library #2572

Closed pdbj closed 9 months ago

pdbj commented 1 year ago

Describe the bug The function referenced is not marked for export, so it's present in the shared library only as a local symbol, and can't be linked.

What is the expected behavior? Function should be marked for export.

To Reproduce

#include "helics/helics.hpp"

#include <iostream>

int main(int argc, char **argv)
{
  auto info = helics::systemInfo();
  std::cout << info << '\n';
}

This will compile because the function is present in helics/core/helicsVersion.hpp but linking fails:

g++ -std=c++17 -IHELICS/build/include/helics_cxx -LHELICS/build/lib -lhelicscpp-apps -lhelicscpp -lhelics    system-info.cc   -o system-info
/usr/packages/gcc/gcc-12.1.1/bin/ld: /var/tmp/cc0vnirF.o: in function `main':
system-info.cc:(.text+0x18): undefined reference to `helics::systemInfo[abi:cxx11]()'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: system-info] Error 1

The symbol is present in as a local t in libhelics.so:

$ nm -C build/lib/libhelics.so | grep systemInfo
00000000000b4590 T helicsGetSystemInfo
000000000005fbf1 t helicsGetSystemInfo.cold
000000000059f3a8 b guard variable for helicsGetSystemInfo::systemInfo
0000000000336350 t helics::systemInfo[abi:cxx11]()
0000000000096641 t helics::systemInfo[abi:cxx11]() [clone .cold]
000000000059f3c0 b helicsGetSystemInfo::systemInfo

Environment (please complete the following information):

Additional context and information

nightlark commented 9 months ago

@phlptp can this issue be closed?

phlptp commented 9 months ago

Yes


Sent from Workspace ONE Boxerhttps://whatisworkspaceone.com/boxer On January 31, 2024 at 9:48:09 AM PST, Ryan Mast @.***> wrote:

@phlptphttps://urldefense.us/v3/__https://github.com/phlptp__;!!G2kpM7uM-TzIFchu!33MQwa-VfZHLueJ4l7AhfGJrCnv9P9eQ1Rt-sugU_lDNkADYamD9OG6XlxsnA2YTsM3ngM9M1EgDtK-bS09kdzw$ can this issue be closed?

— Reply to this email directly, view it on GitHubhttps://urldefense.us/v3/__https://github.com/GMLC-TDC/HELICS/issues/2572*issuecomment-1919607592__;Iw!!G2kpM7uM-TzIFchu!33MQwa-VfZHLueJ4l7AhfGJrCnv9P9eQ1Rt-sugU_lDNkADYamD9OG6XlxsnA2YTsM3ngM9M1EgDtK-bpBnt_r0$, or unsubscribehttps://urldefense.us/v3/__https://github.com/notifications/unsubscribe-auth/AE5VWEOBPBQTZLLXMIEHNXDYRJ7VHAVCNFSM6AAAAAA645PAJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJZGYYDONJZGI__;!!G2kpM7uM-TzIFchu!33MQwa-VfZHLueJ4l7AhfGJrCnv9P9eQ1Rt-sugU_lDNkADYamD9OG6XlxsnA2YTsM3ngM9M1EgDtK-bxhFY-jw$. You are receiving this because you were mentioned.Message ID: @.***>