Error in compiling a sfml c++ code using protocol buffers - c++

I downloaded some example protobuff codes and sfml-networking but i cant compile the files and i dont what's wrong i definitly installed "libprotobuf-dev" and "protobuf-compiler" and also the code seem to run ok on other Pcs but when i use command make in terminal i get this error
this is the repository i cloned the example from :
https://github.com/An-Alone-Cow/schat
please help me i tried every thing
i also reinstalled all protobuff things several times and even installed manually from github repository provided by google
this is the error massege i get
g++ main.o messages.pb.o -L/usr/SFML-2.5.1/lib/ -lprotobuf -lsfml-network -lsfml-system -o run
main.o: In function `google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11]()':
main.cpp:(.text._ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev[_ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev]+0x7): undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
messages.pb.o: In function `Message* google::protobuf::Arena::CreateMaybeMessage<Message>(google::protobuf::Arena*)':
messages.pb.cc:(.text+0x177a): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAligned(unsigned long)'
messages.pb.cc:(.text+0x1799): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))'
messages.pb.o: In function `__static_initialization_and_destruction_0(int, int)':
messages.pb.cc:(.text+0x1855): undefined reference to `google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*)'
messages.pb.o: In function `google::protobuf::Arena::AllocHook(std::type_info const*, unsigned long) const':
messages.pb.cc:(.text._ZNK6google8protobuf5Arena9AllocHookEPKSt9type_infom[_ZNK6google8protobuf5Arena9AllocHookEPKSt9type_infom]+0x3d): undefined reference to `google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'
messages.pb.o: In function `google::protobuf::internal::ArenaStringPtr::CreateInstance(google::protobuf::Arena*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*)':
messages.pb.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x22f): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAligned(unsigned long)'
messages.pb.cc:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x24e): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))'
messages.pb.o: In function `google::protobuf::internal::InitSCC(google::protobuf::internal::SCCInfoBase*)':
messages.pb.cc:(.text._ZN6google8protobuf8internal7InitSCCEPNS1_11SCCInfoBaseE[_ZN6google8protobuf8internal7InitSCCEPNS1_11SCCInfoBaseE]+0x4d): undefined reference to `google::protobuf::internal::InitSCCImpl(google::protobuf::internal::SCCInfoBase*)'
messages.pb.o: In function `google::protobuf::internal::OnShutdownDestroyMessage(void const*)':
messages.pb.cc:(.text._ZN6google8protobuf8internal24OnShutdownDestroyMessageEPKv[_ZN6google8protobuf8internal24OnShutdownDestroyMessageEPKv]+0x16): undefined reference to `google::protobuf::internal::DestroyMessage(void const*)'
messages.pb.cc:(.text._ZN6google8protobuf8internal24OnShutdownDestroyMessageEPKv[_ZN6google8protobuf8internal24OnShutdownDestroyMessageEPKv]+0x1e): undefined reference to `google::protobuf::internal::OnShutdownRun(void (*)(void const*), void const*)'
messages.pb.o: In function `Message::GetMetadataStatic()':
messages.pb.cc:(.text._ZN7Message17GetMetadataStaticEv[_ZN7Message17GetMetadataStaticEv]+0xc): undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*)'
messages.pb.o: In function `google::protobuf::internal::InternalMetadataWithArenaBase<google::protobuf::UnknownFieldSet, google::protobuf::internal::InternalMetadataWithArena>::mutable_unknown_fields_slow()':
messages.pb.cc:(.text._ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv[_ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv]+0x15e): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAligned(unsigned long)'
messages.pb.cc:(.text._ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv[_ZN6google8protobuf8internal29InternalMetadataWithArenaBaseINS0_15UnknownFieldSetENS1_25InternalMetadataWithArenaEE27mutable_unknown_fields_slowEv]+0x17a): undefined reference to `google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))'
messages.pb.o:(.data.rel.ro._ZTV7Message[_ZTV7Message]+0xb8): undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'run' failed
make: *** [run] Error 1
[1]: https://github.com/An-Alone-Cow/schat

Related

Linkage errors when using SWIG, protobuf

I'm trying to use SWIG so that I can call C++ code from Go.
I want to use SWIG so that it can generate me wrapper code. The C++ code in question is generated by the protobuf compiler.
I have two hello.i files hello.i and protobuf.i:
protbuf.i
#define GOOGLE_PROTOBUF_VERSION 3021008
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3021000
hello.i
%module example
%include "protobuf.i"
%{
#include "hello.pb.h"
#include "hello.gen.h"
%}
#include "hello.pb.h"
#include "hello.gen.h"
namespace example {
void handle_Person(example::Person& m, unsigned char* friends);
}
I am able to compile this with the SWIG command swig -go -cgo -c++ hello.i and it generates Go and _wrap.cc file.
Then I create a shared library with the following sequence of commands:
g++ -fPIC -c hello_wrap.cxx hello.pb.cc hello.gen.cc -ldl -lprotobuf -lprotoc -L${MY_PROJECT}/protobuf -L${MY_PROJECT}/protobuf/third_party/abseil-cpp/absl -L${MY_PROJECT}/protobuf/third_party/utf8_range
g++ -shared -o libhellowrap.so hello_wrap.o hello.gen.o hello.pb.o -ldl -lprotobuf -lprotoc -L${MY_PROJECT}/protobuf -L${MY_PROJECT}/protobuf/third_party/abseil-cpp/absl -L${MY_PROJECT}/protobuf/third_party/utf8_range
Now I want to use this in Go so I create a main.go file:
package main
/*
#cgo CFLAGS: -I/my_project/example
#cgo LDFLAGS: -L/my_project/example -lhellowrap -ldl -lstdc++
#include <stdlib.h>
*/
import (
"C"
"fmt"
"my_project/example"
)
func main() {
var p example.SwigcptrExample_Person
p = example.SwigcptrExample_Person(uintptr(int32(2000)))
friends := make([]byte, 5)
example.Handle_Person(p, &friends[0])
fmt.Println("New Friends: ", friends)
}
Then I run this main.go file and the following linkage errors occur:
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/usr/local/include/google/protobuf/metadata_lite.h:183: undefined reference to `void google::protobuf::internal::InternalMetadata::DoMergeFrom<google::protobuf::UnknownFieldSet>(google::protobuf::UnknownFieldSet const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/usr/local/include/google/protobuf/io/coded_stream.h:674: undefined reference to `google::protobuf::io::EpsCopyOutputStream::EnsureSpaceFallback(unsigned char*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/parse_context.h:567: undefined reference to `google::protobuf::internal::VarintParseSlow32(char const*, unsigned int)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/usr/local/include/google/protobuf/parse_context.h:239: undefined reference to `google::protobuf::internal::EpsCopyInputStream::DoneFallback(int, int)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/my_project/example/hello.pb.cc:198: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/parse_context.h:658: undefined reference to `google::protobuf::internal::ReadTagFallback(char const*, unsigned int)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/metadata_lite.h:159: undefined reference to `google::protobuf::UnknownFieldSet* google::protobuf::internal::InternalMetadata::mutable_unknown_fields_slow<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/usr/local/include/google/protobuf/message.h:245: undefined reference to `vtable for google::protobuf::Message'
/usr/local/include/google/protobuf/message.h:245: undefined reference to `google::protobuf::MessageLite::~MessageLite()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/usr/local/include/google/protobuf/metadata_lite.h:113: undefined reference to `google::protobuf::Arena* google::protobuf::internal::InternalMetadata::DeleteOutOfLineHelper<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool)':
/usr/local/include/google/protobuf/message_lite.h:432: undefined reference to `vtable for google::protobuf::MessageLite'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool)':
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(example::Person const&)':
/usr/local/include/google/protobuf/metadata_lite.h:183: undefined reference to `void google::protobuf::internal::InternalMetadata::DoMergeFrom<google::protobuf::UnknownFieldSet>(google::protobuf::UnknownFieldSet const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person* google::protobuf::Arena::CreateMaybeMessage<example::Person>(google::protobuf::Arena*)':
/usr/local/include/google/protobuf/arena.h:309: undefined reference to `google::protobuf::Arena::Allocate(unsigned long)'
/tmp/go-link-96276495/000017.o: In function `example::Person::Clear()':
/usr/local/include/google/protobuf/metadata_lite.h:190: undefined reference to `void google::protobuf::internal::InternalMetadata::DoClear<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/my_project/example/hello.pb.cc:228: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::ByteSizeLong() const':
/my_project/example/hello.pb.cc:250: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
/tmp/go-link-96276495/000017.o: In function `example::Person::GetMetadata() const':
/my_project/example/hello.pb.cc:297: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20220623::once_flag*, google::protobuf::Metadata const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*) [clone .cold.25]':
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person() [clone .cold.26]':
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool) [clone .cold.27]':
/my_project/example/hello.pb.cc:143: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(example::Person const&) [clone .cold.28]':
/usr/local/include/google/protobuf/message.h:245: undefined reference to `vtable for google::protobuf::Message'
/usr/local/include/google/protobuf/message.h:245: undefined reference to `google::protobuf::MessageLite::~MessageLite()'
/tmp/go-link-96276495/000017.o: In function `_GLOBAL__sub_I.00102_hello.pb.cc':
/my_project/example/hello.pb.cc:105: undefined reference to `google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTIN7example6PersonE[_ZTIN7example6PersonE]+0x10): undefined reference to `typeinfo for google::protobuf::Message'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x20): undefined reference to `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x40): undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x48): undefined reference to `google::protobuf::Message::CheckTypeAndMergeFrom(google::protobuf::MessageLite const&)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x78): undefined reference to `google::protobuf::Message::MergeFrom(google::protobuf::Message const&)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x80): undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro+0x0): undefined reference to `google::protobuf::Message::CopyWithSourceCheck(google::protobuf::Message&, google::protobuf::Message const&)'
/tmp/go-link-96276495/000018.o: In function `example::handle_Person(example::Person&, unsigned char*)':
/my_project/example/hello.gen.cc:14: undefined reference to `dlopen'
/my_project/example/hello.gen.cc:25: undefined reference to `dlsym'
/my_project/example/hello.gen.cc:26: undefined reference to `dlerror'
/my_project/example/hello.gen.cc:29: undefined reference to `dlclose'
/my_project/example/hello.gen.cc:16: undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
I have various things when trying to solve this problem but it feels like I'm missing a crucial step.

Cannot compile v8 sample code on ubuntu 16.04

I'm trying to run the hello world sample code from the official v8 repo. After reading the docs I could make it work on version 5.8 just as it is described in the wiki. However, I'm interested to explore this using the latest version of v8, but when I do:
g++ -I. -Iinclude samples/hello-world.cc -o hello-world -Wl,--start-group out.gn/x64.release/obj/{libv8_{base,libbase,external_snapshot,libplatform,libsampler},third_party/icu/libicu{uc,i18n},src/inspector/libinspector}.a -Wl,--end-group -lrt -ldl -pthread -std=c++0x
I get the following error:
out.gn/x64.release/obj/libv8_libbase.a(random-number-generator.o): In function `std::__1::__hash_table<unsigned long, std::__1::hash<unsigned long>, std::__1::equal_to<unsigned long>, std::__1::allocator<unsigned long> >::rehash(unsigned long)':
random-number-generator.cc:(.text._ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm[_ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm]+0x34): undefined reference to `std::__1::__next_prime(unsigned long)'
random-number-generator.cc:(.text._ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm[_ZNSt3__112__hash_tableImNS_4hashImEENS_8equal_toImEENS_9allocatorImEEE6rehashEm]+0x111): undefined reference to `std::__1::__next_prime(unsigned long)'
out.gn/x64.release/obj/libv8_libbase.a(platform-linux.o): In function `v8::base::OS::GetSharedLibraryAddresses()':
platform-linux.cc:(.text._ZN2v84base2OS25GetSharedLibraryAddressesEv+0x20f): undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
platform-linux.cc:(.text._ZN2v84base2OS25GetSharedLibraryAddressesEv+0x322): undefined reference to `std::__1::__basic_string_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_libbase.a(platform-linux.o): In function `void std::__1::vector<v8::base::OS::SharedLibraryAddress, std::__1::allocator<v8::base::OS::SharedLibraryAddress> >::__push_back_slow_path<v8::base::OS::SharedLibraryAddress>(v8::base::OS::SharedLibraryAddress&&)':
platform-linux.cc:(.text._ZNSt3__16vectorIN2v84base2OS20SharedLibraryAddressENS_9allocatorIS4_EEE21__push_back_slow_pathIS4_EEvOT_[_ZNSt3__16vectorIN2v84base2OS20SharedLibraryAddressENS_9allocatorIS4_EEE21__push_back_slow_pathIS4_EEvOT_]+0x197): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_external_snapshot.a(setup-isolate-deserialize.o): In function `v8::internal::SetupIsolateDelegate::SetupInterpreter(v8::internal::interpreter::Interpreter*)': setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x69): undefined reference to `std::__1::ios_base::getloc() const'
setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x70): undefined reference to `std::__1::ctype<char>::id' setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x78): undefined reference to `std::__1::locale::use_facet(std::__1::locale::id&) const'
setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x91): undefined reference to `std::__1::locale::~locale()' setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0x9d): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)'
setup-isolate-deserialize.cc:(.text._ZN2v88internal20SetupIsolateDelegate16SetupInterpreterEPNS0_11interpreter11InterpreterE+0xa5): undefined reference to `std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()'
out.gn/x64.release/obj/libv8_external_snapshot.a(natives-external.o): In function `void std::__1::vector<v8::internal::Vector<char const>, std::__1::allocator<v8::internal::Vector<char const> > >::__emplace_back_slow_path<char const*, int&>(char const*&&, int&)':
natives-external.cc:(.text._ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE24__emplace_back_slow_pathIJPS4_RiEEEvDpOT_[_ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE24__emplace_back_slow_pathIJPS4_RiEEEvDpOT_]+0x12c): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_external_snapshot.a(natives-external.o): In function `void std::__1::vector<v8::internal::Vector<char const>, std::__1::allocator<v8::internal::Vector<char const> > >::__push_back_slow_path<v8::internal::Vector<char const> >(v8::internal::Vector<char const>&&)':
natives-external.cc:(.text._ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE21__push_back_slow_pathIS5_EEvOT_[_ZNSt3__16vectorIN2v88internal6VectorIKcEENS_9allocatorIS5_EEE21__push_back_slow_pathIS5_EEvOT_]+0x11a): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
out.gn/x64.release/obj/libv8_libsampler.a(sampler.o): In function `v8::sampler::SamplerManager::AddSampler(v8::sampler::Sampler*)': sampler.cc:(.text._ZN2v87sampler14SamplerManager10AddSamplerEPNS0_7SamplerE[_ZN2v87sampler14SamplerManager10AddSamplerEPNS0_7SamplerE]+0x25b): undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
collect2: error: ld returned 1 exit status
Running the same on the 5.8 branch works just fine. How could I make this work with the latest version?

undefined reference errors when I add boost log dependecies

I am trying to add boost logging functionality.
But I've got a lot of errors with undefined reference.
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(core.o): In function `boost::thread_specific_ptr<boost::log::v2s_mt_nt5::core::implementation::thread_data>::~thread_specific_ptr()':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:79: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(core.o): In function `boost::thread_specific_ptr<boost::log::v2s_mt_nt5::core::implementation::thread_data>::get() const':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:84: undefined reference to `boost::detail::get_tss_data(void const*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(core.o): In function `boost::thread_specific_ptr<boost::log::v2s_mt_nt5::core::implementation::thread_data>::reset(boost::log::v2s_mt_nt5::core::implementation::thread_data*)':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:105: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `get':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:84: undefined reference to `boost::detail::get_tss_data(void const*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `reset':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:105: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `get':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:84: undefined reference to `boost::detail::get_tss_data(void const*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `reset':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:105: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(record_ostream.o): In function `~thread_specific_ptr':
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:79: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0/./boost/thread/tss.hpp:79: undefined reference to `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(severity_level.o): In function `void boost::this_thread::at_thread_exit<boost::_bi::bind_t<boost::_bi::unspecified, boost::checked_deleter<unsigned long long>, boost::_bi::list1<boost::_bi::value<unsigned long long*> > > >(boost::_bi::bind_t<boost::_bi::unspecified, boost::checked_deleter<unsigned long long>, boost::_bi::list1<boost::_bi::value<unsigned long long*> > >)':
D:\c++\boost_1_58_0/./boost/thread/detail/thread.hpp:861: undefined reference to `boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(once_block.o): In function `boost::detail::basic_cv_list_entry::wait(boost::detail::timeout)':
D:\c++\boost_1_58_0/./boost/thread/win32/condition_variable.hpp:94: undefined reference to `boost::this_thread::interruptible_wait(void*, boost::detail::timeout)'
D:\c++\boost_1_58_0\bin.v2\libs\log\build\gcc-mingw-5.1.0\debug\link-static\threading-multi/libboost_log-mgw51-mt-d-1_58.a(thread_id.o): In function `at_thread_exit<boost::log::v2s_mt_nt5::aux::this_thread::(anonymous namespace)::id_storage::deleter>':
D:\c++\boost_1_58_0/./boost/thread/detail/thread.hpp:861: undefined reference to `boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*)'
collect2.exe: error: ld returned 1 exit status
My linked libraries looks like this.
My include declarations looks like this
Also my boost include folder is located in main x86_64-w64-mingw32 include folder
Had the same error under Windows 10, Cygwin GCC setup. I had to link boost_thread separately in addition to boost_log and boost_log_setup.
-lboost_log_setup -lboost_log -lboost_thread
I was using BOOST 1.66.

TBB link with C++

I am trying to do some tests with TBB at HPCG benchmark. However I didn't compiled the program successfully so far. I am getting errors like these:
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::~start_for()':
ComputeSPMV_ref.cpp:(.text+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::~start_for()':
ComputeSPMV_ref.cpp:(.text+0x23): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::execute()':
ComputeSPMV_ref.cpp:(.text+0x182): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x1ad): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x26b): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x296): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x43b): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x470): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x52c): undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
src/ComputeSPMV_ref.o: In function `ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)':
ComputeSPMV_ref.cpp:(.text+0x9d0): undefined reference to `tbb::task_group_context::init()'
ComputeSPMV_ref.cpp:(.text+0x9e9): undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0xa29): undefined reference to `tbb::internal::get_initial_auto_partitioner_divisor()'
ComputeSPMV_ref.cpp:(.text+0xa52): undefined reference to `tbb::task_group_context::~task_group_context()'
ComputeSPMV_ref.cpp:(.text+0xad4): undefined reference to `tbb::task_group_context::~task_group_context()'
ComputeSPMV_ref.cpp:(.text+0xae0): undefined reference to `vtable for tbb::task'
ComputeSPMV_ref.cpp:(.text+0xaee): undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::flag_task::~flag_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal9flag_taskD2Ev[_ZN3tbb10interface68internal9flag_taskD5Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::signal_task::~signal_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal11signal_taskD2Ev[_ZN3tbb10interface68internal11signal_taskD5Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::flag_task::~flag_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal9flag_taskD0Ev[_ZN3tbb10interface68internal9flag_taskD0Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::signal_task::~signal_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal11signal_taskD0Ev[_ZN3tbb10interface68internal11signal_taskD0Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o:(.rodata+0x110): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTIN3tbb10interface68internal11signal_taskE[_ZTIN3tbb10interface68internal11signal_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTIN3tbb10interface68internal9flag_taskE[_ZTIN3tbb10interface68internal9flag_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTVN3tbb10interface68internal9flag_taskE[_ZTVN3tbb10interface68internal9flag_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
src/ComputeSPMV_ref.o:(.rodata._ZTVN3tbb10interface68internal11signal_taskE[_ZTVN3tbb10interface68internal11signal_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
collect2: error: ld returned 1 exit status
make: *** [bin/xhpcg] Error 1
Compile instruction look like this:
make
/usr/bin/g++ -DHPCG_NOMPI -DHPCG_NOOPENMP -I./src -I./src/GCC_TBB -O3 -ltbb -std=c++11 -ffast-math -ftree-vectorize -ftree-vectorizer-verbose=0 -fopenmp testing/main.o src/CG.o src/CG_ref.o ....
I downloaded and install latest source code from Intel.Also I already use -ltbb and -std=c++11 at compile time and I include tbb files inside my code. I can't figure out the problem so far. Does anyone face anything like this before with Intel TBB? I am assuming that is something with the linking of library but I can't figure it out
Try to insert "-ltbb -std=c++11" just before -o and it should work!
Patroklos Patroklou's answer didn't help, so I put -ltbb at the end of my command and it worked.
Ubuntu 20.04
g++-9, libstdc++-9-dev

How to solve compilation error when building Dlib code.?

I was tried to run sample Dlib code Using MinGW and Netbeans. But I got compilation error.
Steps Followed:
1.Downloaded Dlib package from Dlib website.
2.Include root folder(Dlib) in c++ Compiler setting and also set -std=c++11 in compiler additional flag.
3.Copy the sample from example of Dlib folder.
4.Compiled.
I got Bellow error when compiling code.Give me simple steps for executing Dlib sample code(for example face_detection_ex code in example in Dlib)
build/Debug/MinGW-Windows/main.o: In function `Z12loadIbugDataN5boost10filesystem4pathE':
D:\NetBeansProjects\SDM/main.cpp:124: undefined reference to `boost::filesystem::path::extension() const'
D:\NetBeansProjects\SDM/main.cpp:133: undefined reference to `boost::filesystem::path::replace_extension(boost::filesystem::path const&)'
build/Debug/MinGW-Windows/main.o: In function `main':
D:\NetBeansProjects\SDM/main.cpp:355: undefined reference to `boost::program_options::options_description::m_default_line_length'
D:\NetBeansProjects\SDM/main.cpp:355: undefined reference to `boost::program_options::options_description::m_default_line_length'
D:\NetBeansProjects\SDM/main.cpp:355: undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
D:\NetBeansProjects\SDM/main.cpp:358: undefined reference to `boost::program_options::options_description::add_options()'
D:\NetBeansProjects\SDM/main.cpp:358: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, char const*)'
D:\NetBeansProjects\SDM/main.cpp:360: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)'
D:\NetBeansProjects\SDM/main.cpp:362: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)'
D:\NetBeansProjects\SDM/main.cpp:365: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)'
D:\NetBeansProjects\SDM/main.cpp:366: undefined reference to `boost::program_options::variables_map::variables_map()'
D:\NetBeansProjects\SDM/main.cpp:367: undefined reference to `boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)'
D:\NetBeansProjects\SDM/main.cpp:370: undefined reference to `boost::program_options::operator<<(std::ostream&, boost::program_options::options_description const&)'
D:\NetBeansProjects\SDM/main.cpp:373: undefined reference to `boost::program_options::notify(boost::program_options::variables_map&)'
If you are in Linux You need to add libvl.so to your Linker setting.
In a 64-bit system you may find this file in /vlfeat/bin/glnxa64/.