I am building a shared lib by linking a bunch of code with a static lib (.a) on Linux in C++. I have a method defined in a static library. When I use nm -C to print the symbol in that static library is appears as:
Alembic::AbcCoreFactory::v9::IFactory::getArchive(std::string const&, Alembic::AbcCoreFactory::v9::IFactory::CoreType&)
The symbol is not defined in the output .so file (the library I am building), but when I list the undefined symbols using nm -uC it prints:
Alembic::AbcCoreFactory::v9::IFactory::getArchive(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Alembic::AbcCoreFactory::v9::IFactory::CoreType&)
The difference being one the first use std::string const& and the second uses std::__1::basic_string, std::__1::allocator > const&
I'm trying to understand why it is not finding the symbol. Shouldn't the two match up since they are essentially the same?
For context, I am attempting to compile an Alembic Importer which come with Unreal Editor 4 for linux. The library I am attempting to link in is the alembic library.
You are trying to link code compiled against libc++
(the clang's standard C++ library) and code compiled against libstdc++
(the gcc's standard C++ library). This isn't going to work too well.
Check it against your libraries.
On my system:
> nm -DC /usr/lib64/libc++_shared.so | grep 'std::__1'
=== lots of output ===
> nm -DC /usr/lib64/libc++_shared.so | grep 'std::basic'
=== nothing ===
> nm -DC /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.0/libstdc++.so.6 | grep 'std::__1'
=== nothing ===
> nm -DC /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.0/libstdc++.so.6 | grep 'std::basic'
=== lots of output ===
On your system the files may be at different locations but the result shou;d be the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With