Statically combining C++ libraries - c++

I created an iOS framework with a combined, universal static C++ library from the Poco sources by using lipo and libtool. Essentially, what I do is :
compile Poco for iPhoneOS and iPhoneSimulator
for each architecture:
libtool -static -o libPoco.a libPocoFoundation.a libPocoNet.a libPocoJSON.a
lipo armv6/libPoco.a armv7/libPoco.a i386/libPoco.a -create -output universal/libPoco.a
create a framework from the generated fat library and includes
Look at besport/PocoMobile for more information.
Now, I tried using this framework in an app and everything sounded fine. But when I try to use a class from Poco, the linker spits out undefined symbols from both Poco and libstdc++ :
Undefined symbols for architecture i386:
"Poco::format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Any const&)", referenced from:
Poco::Logger::warning(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Any const&) in MapStorage.o
"Poco::Message::Message(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Message::Priority)", referenced from:
Poco::Logger::log(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Message::Priority) in MapStorage.o
"std::string::c_str() const", referenced from:
Poco::ProcessImpl::launchByForkExecImpl(std::string const&, std::vector<std::string, std::allocator<std::string> > const&, std::string const&, Poco::Pipe*, Poco::Pipe*, Poco::Pipe*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&) in Poco(Process.o)
Poco::EnvironmentImpl::setImpl(std::string const&, std::string const&) in Poco(Environment.o)
Poco::EnvironmentImpl::hasImpl(std::string const&) in Poco(Environment.o)
Poco::EnvironmentImpl::getImpl(std::string const&) in Poco(Environment.o)
"std::string::empty() const", referenced from:
...
I verified with nm and libtool -info, and the library file seems to contain the right functions. The Objective-C++ files I have in the project compile fine as well if I don't do anything with Poco.
Does this have to do the libraries being C++ libraries? Any compiler flag I have to turn on?
Can libtool -static actually use .a libraries? Am I doing that right?

Related

xCode Point Cloud Library "Undefined Symbols for Architecture X86_64"

I've been trying to get the Point Cloud Library working for a few days now. I've tried installing it several ways including cMake, MacPort and Home-brew. I've looked through many forums, blog posts and even Stack Overflow posts and I'm still stuck!
The issue is that while there's nothing wrong with the program itself, upon compile I get an Undefined Symbols for Architecture X86_64 error. See below for direct quote:
Undefined symbols for architecture x86_64:
"pcl::console::print(pcl::console::VERBOSITY_LEVEL, char const*, ...)", referenced from:
int pcl::PCDWriter::writeBinary<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&) in main.o
int pcl::PCDWriter::writeASCII<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&, int) in main.o
"pcl::PCDWriter::writeASCII(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, int)", referenced from:
pcl::PCDWriter::write(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, bool) in main.o
"pcl::PCDWriter::writeBinary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&)", referenced from:
pcl::PCDWriter::write(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PCLPointCloud2 const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, Eigen::Quaternion<float, 0> const&, bool) in main.o
"pcl::PCDWriter::setLockingPermissions(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::interprocess::file_lock&)", referenced from:
int pcl::PCDWriter::writeBinary<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&) in main.o
int pcl::PCDWriter::writeASCII<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&, int) in main.o
"pcl::PCDWriter::resetLockingPermissions(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::interprocess::file_lock&)", referenced from:
int pcl::PCDWriter::writeBinary<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&) in main.o
int pcl::PCDWriter::writeASCII<pcl::PointXYZ>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, pcl::PointCloud<pcl::PointXYZ> const&, int) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It looks like all the issues spring from the same type definition: PCDWriter.
I checked the file it was in and the code looks fine to my unfamiliar eye. One post I saw suggested that the error means that the library was 32 bit trying to run on a 64 bit system. So I upgraded from PCL 1.6.0 to 1.8.1 (latest) in hopes of seeing a difference, but no change.
Another suggested that it meant PCDwriter didn't hold the right information for the various bits of code that reference it. But again, the code looks fine as far as I can tell.
I decided to try deliberately entering the path into the linker (don't ask why, desperation and unfamiliarity drive me to strange things) and while removing the 6 errors it replaced them with 1 saying "cannot specify -o when generating multiple output files".
Which I found odd, having just my Main function at this point. According to another person this was due to problems encountered when header files are in the list of files to be compiled. The solution being to simply remove the headers from the list.
So I removed them and returned to the error from before.
I also tried, though unfamiliar with how xCode would interact with it, to use the "Use PCL in your own project" instructions on the Dev website. cMake refused to make.
I'm not very experienced with importing these types of libraries, mostly I've worked with Arduino before, though the OpenCV library was beautifully simple to install and get running (thanks Devs).
Thank you for any help, I really appreciate it,
Sincerely, Noob

Installing gRPC : ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'

OS -> OSX El Captain Version 10.11.6
Tried to install gRPC using the below commands:
git clone-b $(curl -L http://grpc.io/release) https://github.com/grpc/grpc
cd grpc
git submodule update --init
make
I got the below error:
[HOSTCXX] Compiling src/compiler/cpp_plugin.cc
[HOSTLD] Linking /<path>/grpc/bins/opt/grpc_cpp_plugin
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
Undefined symbols for architecture x86_64:
"google::protobuf::io::StringOutputStream::StringOutputStream(std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*)", referenced from:
ProtoBufFile::CreatePrinter(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >*) const in cpp_plugin.o
"google::protobuf::io::Printer::Print(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&, char const*)", referenced from:
ProtoBufPrinter::Print(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&, char const*) in cpp_plugin.o
"google::protobuf::FileDescriptor::GetSourceLocation(std::__1::vector<int, std::__1::allocator<int> > const&, google::protobuf::SourceLocation*) const", referenced from:
void grpc_generator::GetComment<google::protobuf::FileDescriptor>(google::protobuf::FileDescriptor const*, grpc_generator::CommentType, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*) in cpp_plugin.o
"google::protobuf::compiler::CodeGenerator::GenerateAll(std::__1::vector<google::protobuf::FileDescriptor const*, std::__1::allocator<google::protobuf::FileDescriptor const*> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::compiler::GeneratorContext*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) const", referenced from:
vtable for CppGrpcGenerator in cpp_plugin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/<path>/grpc/bins/opt/grpc_cpp_plugin] Error 1
This is what I have in
/<path>/grpc/libs/opt/ directory :
- libares.a
- libgpr.a
- libgrpc_cronet.a
- libgrpc_unsecure.a
- libboringssl.a
- libgrpc.a
- libgrpc_plugin_support.a
- pkgconfig
[EDIT]
After uninstalling protobuf and running make again I get the below warnings :
[LD] Linking /<path>/grpc/libs/opt/libgpr.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc_cronet.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc_unsecure.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc++.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc++_cronet.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc++_error_details.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc++_reflection.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
[LD] Linking /<path>/grpc/libs/opt/libgrpc++_unsecure.dylib
ld: warning: directory not found for option '-L/<path>/grpc/libs/opt/c-ares'
If I proceed with the installation by executing 'sudo make install', protobuf doesn't get installed and grpc_cpp_plugin doesn't work (gives the below error).
grpc_cpp_plugin: program not found or is not executable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
[EDIT]
For the c-ares problem, i installed it using homebrew brew install c-ares. Then installed grpc grpc-1.3.0.tar.gz and protobuf libprotoc 3.2.0 without errors. But when i run make in the helloworld example, i'm getting the below error :
protoc -I ../../protos --cpp_out=. ../../protos/helloworld.proto
g++ -std=c++11 -I/usr/local/include -pthread -c -o helloworld.pb.o helloworld.pb.cc
protoc -I ../../protos --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ../../protos/helloworld.proto
g++ -std=c++11 -I/usr/local/include -pthread -c -o helloworld.grpc.pb.o helloworld.grpc.pb.cc
g++ -std=c++11 -I/usr/local/include -pthread -c -o greeter_client.o greeter_client.cc
g++ helloworld.pb.o helloworld.grpc.pb.o greeter_client.o -L/usr/local/lib `pkg-config --libs grpc++ grpc` -lgrpc++_reflection -lprotobuf -lpthread -ldl -o greeter_client
Undefined symbols for architecture x86_64:
"grpc::CreateChannel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<grpc::ChannelCredentials> const&)", referenced from:
_main in greeter_client.o
"google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))", referenced from:
helloworld::protobuf_helloworld_2eproto::AddDescriptorsImpl() in helloworld.pb.o
"google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*)", referenced from:
google::protobuf::internal::WireFormatLite::WriteStringToArray(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*) in helloworld.pb.o
"google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)", referenced from:
helloworld::HelloRequest::HelloRequest(helloworld::HelloRequest const&) in helloworld.pb.o
helloworld::HelloRequest::HelloRequest(helloworld::HelloRequest const&) in helloworld.pb.o
helloworld::HelloRequest::MergeFrom(helloworld::HelloRequest const&) in helloworld.pb.o
helloworld::HelloReply::HelloReply(helloworld::HelloReply const&) in helloworld.pb.o
helloworld::HelloReply::HelloReply(helloworld::HelloReply const&) in helloworld.pb.o
helloworld::HelloReply::MergeFrom(helloworld::HelloReply const&) in helloworld.pb.o
"google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)", referenced from:
helloworld::HelloRequest::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in helloworld.pb.o
helloworld::HelloReply::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const in helloworld.pb.o
"google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)", referenced from:
google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) in helloworld.pb.o
"google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)", referenced from:
helloworld::protobuf_helloworld_2eproto::(anonymous namespace)::protobuf_AssignDescriptors() in helloworld.pb.o
"google::protobuf::internal::fixed_address_empty_string[abi:cxx11]", referenced from:
google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11]() in helloworld.pb.o
google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11]() in greeter_client.o
"google::protobuf::Message::GetTypeName[abi:cxx11]() const", referenced from:
vtable for helloworld::HelloReply in helloworld.pb.o
vtable for helloworld::HelloRequest in helloworld.pb.o
"google::protobuf::Message::InitializationErrorString[abi:cxx11]() const", referenced from:
vtable for helloworld::HelloReply in helloworld.pb.o
vtable for helloworld::HelloRequest in helloworld.pb.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [greeter_client] Error 1
Thanks
It could be related with wrong or corrupted version of installed ProtoBuf, because if protobuf is installed and has version more than 3.0, than gRPC building system uses system's protobuf, instread thrird-party-protobuf from subrepo. Try to remove or fix protobuf in your system.
UPDATE:
For new issues try to run "readelf -s lib???.so" for each grpc and protobuf library, and try to find this symbols in libraries. If in some library is specified "UND", than it is wrong library.
Second things that you should do, run "file lib???.so" for each grpc and protobuf library for check binary type: x86_64 or not.

Issue with statically linking id3lib in Xcode

I'm trying to link id3lib statically to my XCode project.
I've found some answers in other threads suggesting to add as linker flags the full path to the .a file. This works but produces a huge number of errors:
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::copy(char*, unsigned long, unsigned long) const", referenced from:
dami::io::StringReader::readChars(unsigned char*, unsigned int) in libid3.a(tag_impl.o)
dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
dami::io::StringReader::readChars(unsigned char*, unsigned int) in libid3.a(tag_parse_lyrics3.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(char const*) const", referenced from:
ID3_TagImpl::IsV2Tag(ID3_Reader&) in libid3.a(tag_impl.o)
dami::mm::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_musicmatch.o)
dami::id3::v1::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_v1.o)
dami::lyr3::v1::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_lyrics3.o)
dami::lyr3::v2::parse(ID3_TagImpl&, ID3_Reader&) in libid3.a(tag_parse_lyrics3.o)
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
void std::__1::vector<ID3_Field*, std::__1::allocator<ID3_Field*> >::__push_back_slow_path<ID3_Field* const>(ID3_Field* const&) in libid3.a(frame_impl.o)
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >::reserve(unsigned long) in libid3.a(tag.o)
std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>, std::__1::allocator<unsigned char> >::__grow_by_and_replace(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned char const*) in libid3.a(tag.o)
std::__1::basic_string<unsigned char, std::__1::char_traits<unsigned char>,
And so on. Again, googling suggests that the issue might be the fact the choice for standard library. Hence I tried to switch the C++ Standard Library field from "Compiler Default" to "libstdc++" (and I'm still getting the huge amount errors) or to "libc++" - and I'm getting way less errors, namely:
Undefined symbols for architecture x86_64:
"_compress", referenced from:
dami::io::CompressedWriter::flush() in libid3.a(io_decorators.o)
"_iconv", referenced from:
dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
"_iconv_close", referenced from:
dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
"_iconv_open", referenced from:
dami::convert(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, ID3_TextEnc, ID3_TextEnc) in libid3.a(utils.o)
"_uncompress", referenced from:
dami::io::CompressedReader::CompressedReader(ID3_Reader&, unsigned int) in libid3.a(io_decorators.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have no idea of how to solve this. If I remove the library full path as linker flag, everything seems to work, but the library is linked dynamically (which doesn't work for me). I'm on Mac OS X 10.10; id3lib was installed via homebrew (manual installation tests led to similar results).
Does anybody have a clue?
Thanks,
Daniele
Go to Link Binary With Libraries in project settings and link your project with system libraries libz (_compress, _uncompress) and libiconv ( _iconv, _iconv_close, _iconv_open).

Assimp linking error

I just downloaded assimp 3.0 library and build the required make files with cmake, then compiled and build the library itself the process was successfull (with little modification to StepFile.h),
my assimp header folder is located in:
/usr/local/include
and my libassimp.a is located in:
/usr/local/lib
however when i specify library and header files in my command line project and try to test my project i get the following error:
Undefined symbols for architecture x86_64:
"Assimp::Importer::Importer()", referenced from:
_main in main.o
"Assimp::Importer::~Importer()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
and when i add -lassimp to Other Linker Flags i get the following errors:
Undefined symbols for architecture x86_64:
"_crc32", referenced from:
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_get_crc_table", referenced from:
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"_inflate", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_inflateEnd", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzCloseCurrentFile in libassimp.a(unzip.c.o)
"_inflateInit2_", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"_inflateReset", referenced from:
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
"_inflateSetDictionary", referenced from:
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I had the same issue recently. The actual solution for me was to ensure that the project where I was using the compiled libassimp.a also linked to libz.dylib rather than turn assimp into a .dylib.
i rebuild assimp so that the makefile yields three library files namely libassimp.3.0.255.dylib libassimp.3.dylib libassimp.dylib, i included them in my project and it worked.

Possible reasons a library can't link for a specific architecture?

I've been pulling my hair out trying to link my iOS app with an arm64 library.
The library in question is Crypto++. I've tried both the precompiled fat library that's in the wiki : http://www.cryptopp.com/wiki/IOS_(Command_Line). I've tried compiling the library myself, but I keep getting link errors of the following kind:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libcryptopp.a(randpool.o)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libcryptopp.a(modes.o)
The libcryptopp.a seems to be fine for armv7, but not for arm64 for some reason. If I exclude libcryptopp.a's 64 bit version from the linking process, it gives even more errors.
They both were compiled using -stdlib=libstdc++
What is going on?
(I need arm64 support because of tweak development reasons)
update sorry all - it turns out it was using the old libcryptopp.a, and not finding the libcryptopp.a properly. The .a was sourced from somewhere else, which has been fixed.
"std::__1::basic_string, std::__1::allocator >::__init(char const*, unsigned long, unsigned long)", referenced from: ... libcryptopp.a(randpool.o)
This library has been built, and depends on LLVM's C++ runtime libc++, and not GNU's C++ runtime libstdc++.
They both were compiled using -stdlib=libstdc++
You need to either rebuild libcryptopp.a against libstdc++, or link with -stdlib=libc++ (and build the rest of your code against libc++ as well).
If interested, the __1 is an inline namespace used for versioning. See What are inline namespaces for? and Where does the __1 symbol come from when using LLVM's libc++?.