-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting undefined reference to `opentelemetry::v0::sdk::resource::Resource::Create while all libraries are there #618
Comments
Works for me - this is link error, so please ensure you are passing this library as link option to compiler/linker: $ ls /usr/local/lib/libopentelemetry_resources.so
/usr/local/lib/libopentelemetry_resources.so
$ g++ ./resource_test.cpp
/usr/bin/ld: /tmp/ccVGz9Id.o: in function `main':
resource_test.cpp:(.text+0x160): undefined reference to `opentelemetry::v0::sdk::resource::Resource::Create(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, opentelemetry::v0::nostd::variant<bool, int, unsigned int, long, unsigned long, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<bool, std::allocator<bool> >, std::vector<int, std::allocator<int> >, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<long, std::allocator<long> >, std::vector<unsigned long, std::allocator<unsigned long> >, std::vector<double, std::allocator<double> >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, opentelemetry::v0::nostd::variant<bool, int, unsigned int, long, unsigned long, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<bool, std::allocator<bool> >, std::vector<int, std::allocator<int> >, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<long, std::allocator<long> >, std::vector<unsigned long, std::allocator<unsigned long> >, std::vector<double, std::allocator<double> >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > > const&)'
collect2: error: ld returned 1 exit status
$ g++ ./resource_test.cpp -lopentelemetry_resources
$ ldd ./a.out
linux-vdso.so.1 (0x00007ffe971c5000)
libopentelemetry_resources.so => /usr/local/lib/libopentelemetry_resources.so (0x00007f6aa8bd8000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6aa89e7000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6aa89cc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6aa87da000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6aa868b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6aa8ccc000)
$
|
Thank you very much for the reply. I compared the actual symbol missing and the actual symbol in the library it seems to be related to My library is looking for The library is in the path alright. Thanks again! |
Good catch. As you are trying Resource API, just to let you know - the necessary sdk changes to inject resources to exporters are not yet complete, and under review (#580) for some design discussions. You may want to revisit it in couple of weeks if you want to try out that. |
Right now I am getting a POC ready for distributed tracing with OpenTelemetry and the ELK Stack. If that works I am OK for now. I understand the libraries are under development. Awesome stuff here. I am sure it will help us a lot understand the performance. |
I turned off WITH_STL and it did compile in the end just fine; but in order to compile it with STL I had to add the following definitions in my CMakeLists.txt:
because the headers under /usr/local/include/opentelemetry are depending on them. Since the types to be used are configured with CMake and the binaries include the correct types, this tells me a library using the opentelemetry headers should not require these definitions (-DHAVE_CPP_STDLIB -DHAVE_GSL) but instead the types included in the installed opentelemetry headers should match the types compiled inside the installed opentelemetry binaries. |
@lalitb thanks for the help really! I am closing this |
Hi,
I have compiled the opentelemetry-cpp libraries as shared and installed them on Ubuntu 18.04.
Unfortunately I did not find yet why I get the following error when I am trying to compile my library against them:
The symbol seems to be in place:
The text was updated successfully, but these errors were encountered: