- 
                Notifications
    
You must be signed in to change notification settings  - Fork 58
 
Description
Describe your environment.
Trying to build this library for linux x86_64 using the build.sh to generate a static library on WSL linux environment 24.04 and our code which is relatively small fails to link with the following error:
/home/lucianopa/project/src/cpp/wrapper.cpp:42:(.text._ZN21ExternalTelemetryHook13InspectRecordERN10CsProtocol6RecordE[_ZN21ExternalTelemetryHook13InspectRecordERN10CsProtocol6RecordE]+0x53): undefined reference to `Microsoft::Applications::Events::exporters::DecodeRecord(CsProtocol::Record const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
          collect2: error: ld returned 1 exit status
Steps to reproduce.
Build the library with the following command
./build.sh clean x86_64 noroot release -l static -D BUILD_STATIC_SQLITE=ON -D BUILD_FUNC_TESTS=OFF -D BUILD_UNIT_TESTS=OFF
Take the libMat.a artifact in out dir and try to reference  Microsoft::Applications::Events::exporters::DecodeRecord(record, serializedEvent); on your code.
What is the expected behavior?
Compile and link successfully
What is the actual behavior?
Linker failed find symbol in the .a library with error:
/home/lucianopa/project/src/cpp/wrapper.cpp:42:(.text._ZN21ExternalTelemetryHook13InspectRecordERN10CsProtocol6RecordE[_ZN21ExternalTelemetryHook13InspectRecordERN10CsProtocol6RecordE]+0x53): undefined reference to `Microsoft::Applications::Events::exporters::DecodeRecord(CsProtocol::Record const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
          collect2: error: ld returned 1 exit status
Additional context.
We do the same for Windows (same codebase) which we compile as well and get the ClientTelemetry.lib and it works file.
Windows compilation command that we use: .\build-win.ps1 -archs x64 -configs Release -enableTests false -enableMini false -enableWin10 false -binTypes lib so artifacts should be the same.
Also I was able to generate a libmat.a that compiles and links successfully by adding PayloadDecoder.cpp to CMakeLists.txt source entry 
cpp_client_telemetry/lib/CMakeLists.txt
Line 54 in 9db2568
| pal/WorkerThread.cpp | 
Which for windows this seems to be automatically added by the vsxitems file.
So my question is if is that expected not to be compiled for linux because the PayloadDecoder.hpp is on the public include file so people are expected to use that symbol, so it didn't made much sense to me that I didn't see any reference to this file other than test folders in CMakeLists.txt files.
Am I using the correct build command? Should I use some other flags for it? Or this api shouldn't be public?