Cant compile googletest on OSX Yosemite - c++

I have read a few related answers and some articles online as well as the official Google Test documentation, but since I lack experience in this area I am very insecure about a few things and seek guidance.
I am starting a brand new pet project in c++ and I want to write proper tests as I code along, ran into Google Test and decided to give it a try.
Currently this is my folder structure:
/
/bin
/main.cpp
/lib
/lib/db
/lib/external/googletest
My idea is to have the tests and class files in their own folders, for example:
/lib/db/db.h
/lib/db/db.cpp
/lib/db/db.test
Question #1
Is there a naming convention or expectation for the file containing the tests? (/lib/db/db.test in that example above)
Question #2
I ran the following commands
cd lib/external/googletest/googletest
cmake .
make
make install
cp lib*.a /usr/local/lib
cp -r include/gtest/ /usr/local/include/
And seeing how it ended up creating a series of .h files in /usr/local/include/gtest, I expected to be able to #include <gtest/gtest.h> and be able to run tests, I added this to my main.cpp:
TEST(Param1, Param2) {
EXPECT_EQ(1, 1);
}
and when building the following error showed up:
Undefined symbols for architecture x86_64:
"testing::AssertionSuccess()", referenced from:
testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&) in main-230b96.o
"testing::Test::SetUp()", referenced from:
vtable for Param1_Param2_Test in main-230b96.o
"testing::Test::TearDown()", referenced from:
vtable for Param1_Param2_Test in main-230b96.o
"testing::Test::Test()", referenced from:
Param1_Param2_Test::Param1_Param2_Test() in main-230b96.o
"testing::Test::~Test()", referenced from:
Param1_Param2_Test::~Param1_Param2_Test() in main-230b96.o
"testing::Message::Message()", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"testing::internal::AssertHelper::~AssertHelper()", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"testing::internal::GetTestTypeId()", referenced from:
___cxx_global_var_init in main-230b96.o
"testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)", referenced from:
___cxx_global_var_init in main-230b96.o
"testing::internal::IsTrue(bool)", referenced from:
testing::internal::scoped_ptr<std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::reset(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in main-230b96.o
testing::internal::scoped_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::reset(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in main-230b96.o
"testing::internal::EqFailure(char const*, char const*, 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&, bool)", referenced from:
testing::AssertionResult testing::internal::CmpHelperEQFailure<int, int>(char const*, char const*, int const&, int const&) in main-230b96.o
"testing::internal::AssertHelper::operator=(testing::Message const&) const", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"typeinfo for testing::Test", referenced from:
typeinfo for Param1_Param2_Test in main-230b96.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: *** [all] Error 1
Solution
Thanks to trojanfoe I fixed my makefile to look like this:
CC=g++
target_folder=bin
all:
$(CC) *.cpp -o $(target_folder)/prod
./bin/prod
test:
$(CC) *.cpp -o $(target_folder)/test lib/external/googletest/googletest/libgtest.a lib/external/googletest/googletest/libgtest_main.a
./bin/test
clean:
rm -f $(target_folder)/* *.o
And now it works just fine, please keep in mind that this is a skeleton project and I need to structure the test files and entry point, so at this point its just compiling a basic test.

You have forgotten to link-in the google test library with your executable.

Related

What is causing GoogleTest Link Error on macOS Mojave? [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 3 years ago.
I'm not sure if I have a problem w/ requiring additional arguments to cmake, or a problem with my own Makefiles. I am trying to build and install googletest for use in one of my projects. I am running on macOS mojave, with cmake installed via Homebrew. To install googletest, I have done the following:
git clone https://github.com/google/googletest
cd googletest
mkdir build
cd build
cmake ..
make
make install
I compile my source and test files. Here is an example command that gets generated by the Makefile for compiling a file named Point2d.cpp:
clang++ -arch x86_64 -c -std=c++11 -stdlib=libc++ -O2 -I /usr/local/include -c -o ../build/core/Point2d.o core/Point2d.cpp
I then try to link all my object files. Here is the command generated by the makefile (where main.o is the object file containing the main function for running the tests):
clang++ -arch x86_64 ../build/core/Point2d.o ../build/PointTest.o ../build/main.o -o ../bin/test -L /usr/local/lib
Resulting link error:
Undefined symbols for architecture x86_64:
"testing::InitGoogleTest(int*, char**)", referenced from:
_main in main.o
"testing::Test::SetUp()", referenced from:
vtable for Point2dTests_Constructors_Test in PointTest.o
"testing::Test::TearDown()", referenced from:
vtable for Point2dTests_Constructors_Test in PointTest.o
"testing::Test::Test()", referenced from:
testing::internal::TestFactoryImpl<Point2dTests_Constructors_Test>::CreateTest() in PointTest.o
"testing::Test::~Test()", referenced from:
Point2dTests_Constructors_Test::~Point2dTests_Constructors_Test() in PointTest.o
Point2dTests_Constructors_Test::~Point2dTests_Constructors_Test() in PointTest.o
"testing::Message::Message()", referenced from:
Point2dTests_Constructors_Test::TestBody() in PointTest.o
"testing::UnitTest::GetInstance()", referenced from:
_main in main.o
"testing::UnitTest::Run()", referenced from:
_main in main.o
"testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)", referenced from:
Point2dTests_Constructors_Test::TestBody() in PointTest.o
"testing::internal::AssertHelper::~AssertHelper()", referenced from:
Point2dTests_Constructors_Test::TestBody() in PointTest.o
"testing::internal::GetTestTypeId()", referenced from:
__GLOBAL__sub_I_PointTest.cpp in PointTest.o
"testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)", referenced from:
__GLOBAL__sub_I_PointTest.cpp in PointTest.o
"testing::internal::GetBoolAssertionFailureMessage(testing::AssertionResult const&, char const*, char const*, char const*)", referenced from:
Point2dTests_Constructors_Test::TestBody() in PointTest.o
"testing::internal::IsTrue(bool)", referenced from:
testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int) in PointTest.o
testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int) in PointTest.o
"testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)", referenced from:
testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int) in PointTest.o
testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int) in PointTest.o
"testing::internal::GTestLog::~GTestLog()", referenced from:
testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int) in PointTest.o
testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int) in PointTest.o
"testing::internal::AssertHelper::operator=(testing::Message const&) const", referenced from:
Point2dTests_Constructors_Test::TestBody() in PointTest.o
"typeinfo for testing::Test", referenced from:
typeinfo for Point2dTests_Constructors_Test in PointTest.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[1]: *** [../bin/test] Error 1
make: *** [test] Error 2
Solved. Please see the comments of the question, posted by #AlexDenisov

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).

Apple Mach-O linker error: Undefined symbols for architecture armv7 Google Protobuf

I've been working on a project that contains two parts:
A Cocoa Touch Static Library (.framework)
A Demo application that uses my (.framework) Static Library
I have learned that any .framework that is added to my .framework (i.e., opencv2.framework) must also be added to my Demo application. I've also learned that the Build Settings for Architectures must be the same and the Build Settings Search Paths must be set.
Happy as can be, I've been building and using my .framework in my Demo application for quite some time. Recently, I've added Google Protocol Buffers to my .framework.
My .framework is compiling and all seems well in the .framework.
Of course, my Demo application wasn't very happy.
So now I've added the libprotobuf-lite.a to my Demo application and added the path to the Header files in the Header Search Paths.
This should do the trick. But instead, I receive the following errors and thus far have not been able to find an answer. Here is the error log:
Undefined symbols for architecture armv7:
"vtable for google_public::protobuf::Message", referenced from:
google_public::protobuf::Message::Message() in Test-Remote-iOS-Aggregate(ftype.pb.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"typeinfo for google_public::protobuf::Message", referenced from:
typeinfo for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
message::FtypeMessage const* google_public::protobuf::internal::dynamic_cast_if_available<message::FtypeMessage const*, google_public::protobuf::Message const*>(google_public::protobuf::Message const*) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::GetTypeName() const", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::InitializationErrorString() const", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::SpaceUsed() const", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::ReflectionOps::Merge(google_public::protobuf::Message const&, google_public::protobuf::Message*)", referenced from:
message::FtypeMessage::MergeFrom(google_public::protobuf::Message const&) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::VerifyUTF8StringFallback(char const*, int, google_public::protobuf::internal::WireFormat::Operation)", referenced from:
google_public::protobuf::internal::WireFormat::VerifyUTF8String(char const*, int, google_public::protobuf::internal::WireFormat::Operation) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"_OBJC_CLASS_$_CVImageConverter", referenced from:
objc-class-ref in Test-Remote-iOS-Aggregate(IDMessageCommand.o)
"google_public::protobuf::UnknownFieldSet::ClearFallback()", referenced from:
google_public::protobuf::UnknownFieldSet::Clear() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::DiscardUnknownFields()", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(google_public::protobuf::UnknownFieldSet const&)", referenced from:
message::FtypeMessage::ByteSize() const in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::SerializeUnknownFields(google_public::protobuf::UnknownFieldSet const&, google_public::protobuf::io::CodedOutputStream*)", referenced from:
message::FtypeMessage::SerializeWithCachedSizes(google_public::protobuf::io::CodedOutputStream*) const in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))", referenced from:
message::protobuf_AddDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::SkipField(google_public::protobuf::io::CodedInputStream*, unsigned int, google_public::protobuf::UnknownFieldSet*)", referenced from:
message::FtypeMessage::MergePartialFromCodedStream(google_public::protobuf::io::CodedInputStream*) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::UnknownFieldSet::MergeFrom(google_public::protobuf::UnknownFieldSet const&)", referenced from:
message::FtypeMessage::MergeFrom(message::FtypeMessage const&) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::GeneratedMessageReflection::GeneratedMessageReflection(google_public::protobuf::Descriptor const*, google_public::protobuf::Message const*, int const*, int, int, int, google_public::protobuf::DescriptorPool const*, google_public::protobuf::MessageFactory*, int)", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::~Message()", referenced from:
message::FtypeMessage::FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
message::FtypeMessage::~FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::UnknownFieldSet::UnknownFieldSet()", referenced from:
message::FtypeMessage::FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::CheckTypeAndMergeFrom(google_public::protobuf::MessageLite const&)", referenced from:
vtable for message::FtypeMessage in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::DescriptorPool::generated_pool()", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int)", referenced from:
message::protobuf_AddDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::Message::SerializeToOstream(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const", referenced from:
message::TestMessaging::ftypeMessage(void const*, unsigned long) in Test-Remote-iOS-Aggregate(TestMessaging.o)
"google_public::protobuf::MessageFactory::InternalRegisterGeneratedMessage(google_public::protobuf::Descriptor const*, google_public::protobuf::Message const*)", referenced from:
message::(anonymous namespace)::protobuf_RegisterTypes(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(google_public::protobuf::UnknownFieldSet const&, unsigned char*)", referenced from:
message::FtypeMessage::SerializeWithCachedSizesToArray(unsigned char*) const in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::DescriptorPool::FindFileByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::MessageFactory::generated_factory()", referenced from:
message::protobuf_AssignDesc_ftype_2eproto() in Test-Remote-iOS-Aggregate(ftype.pb.o)
"google_public::protobuf::UnknownFieldSet::~UnknownFieldSet()", referenced from:
message::FtypeMessage::FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
message::FtypeMessage::~FtypeMessage() in Test-Remote-iOS-Aggregate(ftype.pb.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas on what could be the likely issue here?
Thank you.
It looks like the linker is not running on your .framework, and that the .proto files were built for a full libprotobuf instead of libprotobuf-lite.
Try adding a fat libprotobuf.a to your app's framework folder and see if it finds the symbols.
As a side note, you also have another error in there you didn't mention:
"_OBJC_CLASS_$_CVImageConverter", referenced from:
objc-class-ref in Test-Remote-iOS-Aggregate(IDMessageCommand.o)
Not sure how to fix that one without seeing your code.

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.

node-gyp linking issue for xcode solution

I am generating a solution with node-gyp for xcode under MacOS using:
node-gyp configure -- -f xcode
So for so good, the solution gets generated properly, but it doesn't seem to link properly when building it in xcode, it is complaining about v8 undefined symbols. I am using node 0.10.28.
Undefined symbols for architecture x86_64:
"v8::HandleScope::RawClose(v8::internal::Object**)", referenced from:
v8::Local<v8::String> v8::HandleScope::Close<v8::String>(v8::Handle<v8::String>) in binding.o
"v8::HandleScope::HandleScope()", referenced from:
Method(v8::Arguments const&) in binding.o
"v8::HandleScope::~HandleScope()", referenced from:
Method(v8::Arguments const&) in binding.o
"v8::FunctionTemplate::GetFunction()", referenced from:
void node::SetMethod<v8::Handle<v8::Object> >(v8::Handle<v8::Object>, char const*, v8::Handle<v8::Value> (*)(v8::Arguments const&)) in binding.o
"v8::FunctionTemplate::New(v8::Handle<v8::Value> (*)(v8::Arguments const&), v8::Handle<v8::Value>, v8::Handle<v8::Signature>)", referenced from:
void node::SetMethod<v8::Handle<v8::Object> >(v8::Handle<v8::Object>, char const*, v8::Handle<v8::Value> (*)(v8::Arguments const&)) in binding.o
"v8::Object::Set(v8::Handle<v8::Value>, v8::Handle<v8::Value>, v8::PropertyAttribute)", referenced from:
void node::SetMethod<v8::Handle<v8::Object> >(v8::Handle<v8::Object>, char const*, v8::Handle<v8::Value> (*)(v8::Arguments const&)) in binding.o
"v8::String::New(char const*, int)", referenced from:
Method(v8::Arguments const&) in binding.o
"v8::String::NewSymbol(char const*, int)", referenced from:
void node::SetMethod<v8::Handle<v8::Object> >(v8::Handle<v8::Object>, char const*, v8::Handle<v8::Value> (*)(v8::Arguments const&)) in binding.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 also tried to generate a CMake project that creates a nodejs extension and I am getting the same linking errors. What is the magic twist to link under MacOS with v8/node?
Thanks
Finally the magic trick was to use
-undefined dynamic_lookup
as a linker flag.