However, it requires augmenting code that should be visible outside of the shared library to be explicitly exported
Here's a non-exhaustive listing of the compiler errors that happen when turning on -fvisibility=hidden and -fvisibility-inlines-hidden.
jonesmz@ymir ~/bsf/Build $ clear ; ninja
[1/3] Linking CXX executable ../bin/x64/Release/ExampleLowLevelRendering
FAILED: ../bin/x64/Release/ExampleLowLevelRendering
: && /usr/bin/c++ -Wall -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti -Wl,-rpath= -g0 -O2 -DNDEBUG -Wno-unused-variable -s -no-pie Source/Examples/ExampleLowLevelRendering/CMakeFiles/ExampleLowLevelRendering.dir/Main.cpp.o -o ../bin/x64/Release/ExampleLowLevelRendering -Wl,-rpath,/home/jonesmz/bsf/bin/x64/Release ../bin/x64/Release/libbsf.so /usr/lib/libSM.so /usr/lib/libICE.so /usr/lib/libX11.so /usr/lib/libXext.so /usr/lib/libXcursor.so /usr/lib/libXrandr.so /usr/lib/libXi.so && :
Source/Examples/ExampleLowLevelRendering/CMakeFiles/ExampleLowLevelRendering.dir/Main.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_create(unsigned long&, unsigned long) [clone .isra.100]':
Main.cpp:(.text+0x54): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleLowLevelRendering/CMakeFiles/ExampleLowLevelRendering.dir/Main.cpp.o: In function `bs::ct::render()':
Main.cpp:(.text+0x166c): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x16e3): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x17b5): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1885): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1fcd): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleLowLevelRendering/CMakeFiles/ExampleLowLevelRendering.dir/Main.cpp.o:Main.cpp:(.text+0x1ffc): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleLowLevelRendering/CMakeFiles/ExampleLowLevelRendering.dir/Main.cpp.o: In function `main':
Main.cpp:(.text.startup+0x4a8): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text.startup+0x641): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x673): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x6b7): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x6e7): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x723): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleLowLevelRendering/CMakeFiles/ExampleLowLevelRendering.dir/Main.cpp.o:Main.cpp:(.text.startup+0x750): more undefined references to `bs::MemoryCounter::Frees' follow
collect2: error: ld returned 1 exit status
[2/3] Linking CXX executable ../bin/x64/Release/ExamplePhysicallyBasedShading
FAILED: ../bin/x64/Release/ExamplePhysicallyBasedShading
: && /usr/bin/c++ -Wall -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti -Wl,-rpath= -g0 -O2 -DNDEBUG -Wno-unused-variable -s -no-pie Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/CameraFlyer.cpp.o Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/ObjectRotator.cpp.o Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o -o ../bin/x64/Release/ExamplePhysicallyBasedShading -Wl,-rpath,/home/jonesmz/bsf/bin/x64/Release ../bin/x64/Release/libbsf.so /usr/lib/libSM.so /usr/lib/libICE.so /usr/lib/libX11.so /usr/lib/libXext.so /usr/lib/libXcursor.so /usr/lib/libXrandr.so /usr/lib/libXi.so && :
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/CameraFlyer.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_create(unsigned long&, unsigned long) [clone .isra.30]':
CameraFlyer.cpp:(.text+0x54): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/CameraFlyer.cpp.o: In function `bs::CameraFlyer::update()':
CameraFlyer.cpp:(.text+0x308): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x7d7): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x99c): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x1002): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x1034): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/CameraFlyer.cpp.o:CameraFlyer.cpp:(.text+0x1062): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/ObjectRotator.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_create(unsigned long&, unsigned long) [clone .isra.27]':
ObjectRotator.cpp:(.text+0x54): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/ObjectRotator.cpp.o: In function `bs::ObjectRotator::ObjectRotator(bs::GameObjectHandle<bs::SceneObject> const&)':
ObjectRotator.cpp:(.text+0x25c): undefined reference to `bs::MemoryCounter::Frees'
ObjectRotator.cpp:(.text+0x2c1): undefined reference to `bs::MemoryCounter::Frees'
ObjectRotator.cpp:(.text+0x32b): undefined reference to `bs::MemoryCounter::Frees'
ObjectRotator.cpp:(.text+0x38c): undefined reference to `bs::MemoryCounter::Frees'
ObjectRotator.cpp:(.text+0x3ee): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/ObjectRotator.cpp.o:ObjectRotator.cpp:(.text+0x800): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_create(unsigned long&, unsigned long) [clone .isra.78]':
Main.cpp:(.text+0xe4): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `bs::createMaterial(bs::Assets&)':
Main.cpp:(.text+0x496): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x541): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x5ee): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x69f): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `bs::setUpInput()':
Main.cpp:(.text+0xacf): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o:Main.cpp:(.text+0xb2f): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `bs::setUp3DScene(bs::Assets const&)':
Main.cpp:(.text+0x178b): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x17cb): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x1943): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1a61): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1c77): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x1cba): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x1ec3): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1f67): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1f9e): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x1fe1): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x21f0): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x22b5): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x252d): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x2577): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x26c9): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x27e2): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x2a5b): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x2a9e): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x2be7): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x2cf5): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x2d8b): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x2ede): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x3126): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `bs::loadTexture(bs::Path const&, bool, bool, bool)':
Main.cpp:(.text+0x4cef): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x4d1d): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x4e6e): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x4e9b): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x4ec8): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o:Main.cpp:(.text+0x4f06): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `bs::GameObjectHandle<bs::CCamera>::GameObjectHandle()':
Main.cpp:(.text._ZN2bs16GameObjectHandleINS_7CCameraEEC2Ev[_ZN2bs16GameObjectHandleINS_7CCameraEEC5Ev]+0x3d): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZN2bs16GameObjectHandleINS_7CCameraEEC2Ev[_ZN2bs16GameObjectHandleINS_7CCameraEEC5Ev]+0x79): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `main':
Main.cpp:(.text.startup+0x5f0): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x638): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x680): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x6c8): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `bs::Module<bs::Importer>::instance()':
Main.cpp:(.text._ZN2bs6ModuleINS_8ImporterEE8instanceEv[_ZN2bs6ModuleINS_8ImporterEE8instanceEv]+0x2ec): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o:Main.cpp:(.text._ZN2bs6ModuleINS_8ImporterEE8instanceEv[_ZN2bs6ModuleINS_8ImporterEE8instanceEv]+0x316): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `void bs::Module<bs::CoreApplication>::startUp<bs::Application, bs::START_UP_DESC const&>(bs::START_UP_DESC const&)':
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x40): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x310): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x33a): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x364): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x391): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `bs::Module<bs::GameObjectManager>::instance()':
Main.cpp:(.text._ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv[_ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv]+0x2f4): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o:Main.cpp:(.text._ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv[_ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv]+0x31e): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `void std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >, bs::StdAlloc<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >, bs::GenAlloc> >::_M_emplace_back_aux<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > >(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >&&)':
Main.cpp:(.text._ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_[_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_]+0x83): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_[_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_]+0x1aa): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExamplePhysicallyBasedShading/CMakeFiles/ExamplePhysicallyBasedShading.dir/Main.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long)':
Main.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS3_8GenAllocEEEE9_M_mutateEmmPKcm[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS3_8GenAllocEEEE9_M_mutateEmmPKcm]+0x10f): undefined reference to `bs::MemoryCounter::Frees'
collect2: error: ld returned 1 exit status
[3/3] Linking CXX executable ../bin/x64/Release/ExampleGettingStarted
FAILED: ../bin/x64/Release/ExampleGettingStarted
: && /usr/bin/c++ -Wall -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -fno-exceptions -fno-strict-aliasing -fno-rtti -Wl,-rpath= -g0 -O2 -DNDEBUG -Wno-unused-variable -s -no-pie Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/CameraFlyer.cpp.o Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o -o ../bin/x64/Release/ExampleGettingStarted -Wl,-rpath,/home/jonesmz/bsf/bin/x64/Release ../bin/x64/Release/libbsf.so /usr/lib/libSM.so /usr/lib/libICE.so /usr/lib/libX11.so /usr/lib/libXext.so /usr/lib/libXcursor.so /usr/lib/libXrandr.so /usr/lib/libXi.so && :
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/CameraFlyer.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_create(unsigned long&, unsigned long) [clone .isra.34]':
CameraFlyer.cpp:(.text+0x54): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/CameraFlyer.cpp.o: In function `bs::CameraFlyer::update()':
CameraFlyer.cpp:(.text+0x308): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x7d7): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x9a4): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x1012): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x1044): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/CameraFlyer.cpp.o:CameraFlyer.cpp:(.text+0x1072): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/CameraFlyer.cpp.o: In function `bs::CameraFlyer::CameraFlyer(bs::GameObjectHandle<bs::SceneObject> const&)':
CameraFlyer.cpp:(.text+0x1ec3): undefined reference to `bs::MemoryCounter::Allocs'
CameraFlyer.cpp:(.text+0x1eff): undefined reference to `bs::MemoryCounter::Allocs'
CameraFlyer.cpp:(.text+0x2082): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x21e3): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x222d): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x22d5): undefined reference to `bs::MemoryCounter::Frees'
CameraFlyer.cpp:(.text+0x233a): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/CameraFlyer.cpp.o:CameraFlyer.cpp:(.text+0x23fb): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_create(unsigned long&, unsigned long) [clone .isra.123]':
Main.cpp:(.text+0x204): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::createMaterial(bs::TResourceHandle<bs::Texture, false> const&, bs::TResourceHandle<bs::Shader, false> const&)':
Main.cpp:(.text+0x844): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::setUpInput()':
Main.cpp:(.text+0x999): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x9f3): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0xa4d): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0xaab): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o:Main.cpp:(.text+0xb14): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::setUpInput()':
Main.cpp:(.text+0x133c): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::setUp3DScene(bs::TResourceHandle<bs::Mesh, false> const&, bs::TResourceHandle<bs::Material, false> const&)':
Main.cpp:(.text+0x155b): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1594): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x15d8): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x19b2): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1a2f): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1c9f): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x1f12): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x1f5c): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x212b): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x238f): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x23d2): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::setUpGUI()':
Main.cpp:(.text+0x30ce): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x312c): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x316a): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x3511): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x3554): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x3815): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x38a1): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x3995): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x3c51): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x3c99): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x3e5b): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x3ff6): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x4107): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x4159): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x41ae): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o:Main.cpp:(.text+0x446a): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::setUpGUI()':
Main.cpp:(.text+0x4b74): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text+0x4dbc): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::loadAssets(bs::TResourceHandle<bs::Mesh, false>&, bs::TResourceHandle<bs::Texture, false>&, bs::TResourceHandle<bs::Shader, false>&)':
Main.cpp:(.text+0x50e8): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x5115): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x5241): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x526e): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text+0x5398): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o:Main.cpp:(.text+0x53c5): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `__static_initialization_and_destruction_0(int, int) [clone .constprop.233]':
Main.cpp:(.text.startup+0x1e6): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text.startup+0x221): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text.startup+0x2b6): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text.startup+0x2f1): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `main':
Main.cpp:(.text.startup+0x6e0): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x728): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x770): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text.startup+0x7b8): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > >, bs::StdAlloc<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > >, bs::GenAlloc> >::_M_erase(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > > >*)':
Main.cpp:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEESt4pairIKS8_S8_ESt10_Select1stISB_ESt4lessIS8_ENS5_ISB_S6_EEE8_M_eraseEPSt13_Rb_tree_nodeISB_E[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEESt4pairIKS8_S8_ESt10_Select1stISB_ESt4lessIS8_ENS5_ISB_S6_EEE8_M_eraseEPSt13_Rb_tree_nodeISB_E]+0x61): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o:Main.cpp:(.text._ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEESt4pairIKS8_S8_ESt10_Select1stISB_ESt4lessIS8_ENS5_ISB_S6_EEE8_M_eraseEPSt13_Rb_tree_nodeISB_E[_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEESt4pairIKS8_S8_ESt10_Select1stISB_ESt4lessIS8_ENS5_ISB_S6_EEE8_M_eraseEPSt13_Rb_tree_nodeISB_E]+0x8a): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `void bs::Module<bs::CoreApplication>::startUp<bs::Application, bs::START_UP_DESC const&>(bs::START_UP_DESC const&)':
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x40): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x310): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x33a): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x364): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text._ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_[_ZN2bs6ModuleINS_15CoreApplicationEE7startUpINS_11ApplicationEJRKNS_13START_UP_DESCEEEEvDpOT0_]+0x391): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::Module<bs::GameObjectManager>::instance()':
Main.cpp:(.text._ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv[_ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv]+0x2f4): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o:Main.cpp:(.text._ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv[_ZN2bs6ModuleINS_17GameObjectManagerEE8instanceEv]+0x31e): more undefined references to `bs::MemoryCounter::Frees' follow
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::GameObjectHandle<bs::CLight> bs::SceneObject::addComponent<bs::CLight>()':
Main.cpp:(.text._ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_[_ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_]+0x4a): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_[_ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_]+0xc0): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_[_ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_]+0x1f3): undefined reference to `bs::MemoryCounter::Frees'
Main.cpp:(.text._ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_[_ZN2bs11SceneObject12addComponentINS_6CLightEJEEENS_16GameObjectHandleIT_EEDpOT0_]+0x2e7): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `bs::TEvent<void>::ConnectionData* bs::bs_new<bs::TEvent<void>::ConnectionData>()':
Main.cpp:(.text._ZN2bs6bs_newINS_6TEventIvJEE14ConnectionDataEJEEEPT_DpOT0_[_ZN2bs6bs_newINS_6TEventIvJEE14ConnectionDataEJEEEPT_DpOT0_]+0x27): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `void std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >, bs::StdAlloc<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >, bs::GenAlloc> >::_M_emplace_back_aux<std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > >(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >&&)':
Main.cpp:(.text._ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_[_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_]+0x83): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_[_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS4_8GenAllocEEEEENS5_IS8_S6_EEE19_M_emplace_back_auxIJS8_EEEvDpOT_]+0x1aa): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `void std::vector<bs::VideoMode const*, bs::StdAlloc<bs::VideoMode const*, bs::GenAlloc> >::_M_emplace_back_aux<bs::VideoMode const*>(bs::VideoMode const*&&)':
Main.cpp:(.text._ZNSt6vectorIPKN2bs9VideoModeENS0_8StdAllocIS3_NS0_8GenAllocEEEE19_M_emplace_back_auxIJS3_EEEvDpOT_[_ZNSt6vectorIPKN2bs9VideoModeENS0_8StdAllocIS3_NS0_8GenAllocEEEE19_M_emplace_back_auxIJS3_EEEvDpOT_]+0x84): undefined reference to `bs::MemoryCounter::Allocs'
Main.cpp:(.text._ZNSt6vectorIPKN2bs9VideoModeENS0_8StdAllocIS3_NS0_8GenAllocEEEE19_M_emplace_back_auxIJS3_EEEvDpOT_[_ZNSt6vectorIPKN2bs9VideoModeENS0_8StdAllocIS3_NS0_8GenAllocEEEE19_M_emplace_back_auxIJS3_EEEvDpOT_]+0x101): undefined reference to `bs::MemoryCounter::Frees'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `void std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, bs::StdAlloc<wchar_t, bs::GenAlloc> >::_M_construct<wchar_t const*>(wchar_t const*, wchar_t const*, std::forward_iterator_tag)':
Main.cpp:(.text._ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN2bs8StdAllocIwNS3_8GenAllocEEEE12_M_constructIPKwEEvT_SB_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN2bs8StdAllocIwNS3_8GenAllocEEEE12_M_constructIPKwEEvT_SB_St20forward_iterator_tag]+0xa8): undefined reference to `bs::MemoryCounter::Allocs'
Source/Examples/ExampleGettingStarted/CMakeFiles/ExampleGettingStarted.dir/Main.cpp.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long)':
Main.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS3_8GenAllocEEEE9_M_mutateEmmPKcm[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN2bs8StdAllocIcNS3_8GenAllocEEEE9_M_mutateEmmPKcm]+0x10f): undefined reference to `bs::MemoryCounter::Frees'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
jonesmz@ymir ~/bsf/Build $
Enabling the flags listed in the issue title for linux builds can greatly reduce shared library size, and enhance certain optimizations based on whether a symbol is internal to a shared library only, or externally visible.
However, it requires augmenting code that should be visible outside of the shared library to be explicitly exported
Here's a non-exhaustive listing of the compiler errors that happen when turning on -fvisibility=hidden and -fvisibility-inlines-hidden.