openGL superbible source code compilation error - c++

I've just started to learn openGL programming with the openGL Superbible. Unfortunately I'm not able compile any example. I'm on Ubuntu 18.10 and I prepared the development environment with these packages from the official repository:
mesa-common-dev (with these package you get header files in /usr/include/GL/)
libglfw3-dev (header files in /usr/include/GLFW/)
The book uses a small framework with an entry point in the sb7.h header (in the book source code), sb7.h then points to glfw3 and gl3w (the latter given with the book's source code, so you don't need to download it).
This is the first example from the book:
#ifndef _LINUX
#define _LINUX
#endif
// Include the "sb7.h" header file
#include "sb7.h"
// Derive my_application from sb7::application
class my_application : public sb7::application
{
public:
// Our rendering function
void render(double currentTime)
{
// Simply clear the window with red
static const GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, red);
}
};
// Our one and only instance of DECLARE_MAIN
DECLARE_MAIN(my_application);
If I try to compile it (the file is called 'main.cpp') with g++ main.cpp -lglfw I get this error:
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::run(sb7::application*)':
main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x27e): undefined reference to `gl3wInit'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x29f): undefined reference to `gl3wIsSupported'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2af): undefined reference to `gl3wDebugMessageCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2bd): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2c9): undefined reference to `gl3wEnable'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2de): undefined reference to `sb6IsExtensionSupported(char const*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2ee): undefined reference to `gl3wDebugMessageCallbackARB'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2fc): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x308): undefined reference to `gl3wEnable'
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::glfw_onResize(GLFWwindow*, int, int)':
main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x15): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::glfw_onKey(GLFWwindow*, int, int, int, int)':
main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x23): undefined reference to `sb7::application::app'
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `sb7::application::glfw_onMouseButton(GLFWwindow*, int, int, int)':
main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x18): undefined reference to `sb7::application::app'
/usr/bin/ld: /tmp/ccDOdloQ.o:main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x1f): more undefined references to `sb7::application::app' follow
/usr/bin/ld: /tmp/ccDOdloQ.o: in function `my_application::render(double)':
main.cpp:(.text._ZN14my_application6renderEd[_ZN14my_application6renderEd]+0x14): undefined reference to `gl3wClearBufferfv'
collect2: error: ld returned 1 exit status
Reading the messages I thought that something was wrong with the gl3w library, so I downloaded it from the github repository and I put it and glcorearb.h in /usr/include/GL/, pointing the #include in sb7.h to that folder. Eventually I compiled gl3w.c and linked it to main.cpp with g++ as written here:
g++ -c gl3w.c
g++ -c main.cpp
g++ gl3w.o main.o
but when I execute 3) I get other errors:
/usr/bin/ld: gl3w.o: in function `open_libgl()':
gl3w.c:(.text+0x16): undefined reference to `dlopen'
/usr/bin/ld: gl3w.c:(.text+0x4d): undefined reference to `dlsym'
/usr/bin/ld: gl3w.o: in function `close_libgl()':
gl3w.c:(.text+0x6f): undefined reference to `dlclose'
/usr/bin/ld: gl3w.o: in function `get_proc(char const*)':
gl3w.c:(.text+0xc5): undefined reference to `dlsym'
/usr/bin/ld: main.o: in function `sb7::application::run(sb7::application*)':
main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x21): undefined reference to `glfwInit'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x7c): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x92): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xb3): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xd4): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xe3): undefined reference to `glfwWindowHint'
/usr/bin/ld: main.o:main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0xf2): more undefined references to `glfwWindowHint' follow
/usr/bin/ld: main.o: in function `sb7::application::run(sb7::application*)':
main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x13f): undefined reference to `glfwGetPrimaryMonitor'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x172): undefined reference to `glfwCreateWindow'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1c8): undefined reference to `glfwMakeContextCurrent'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1e2): undefined reference to `glfwSetWindowSizeCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x1fc): undefined reference to `glfwSetKeyCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x216): undefined reference to `glfwSetMouseButtonCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x230): undefined reference to `glfwSetCursorPosCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x24a): undefined reference to `glfwSetScrollCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x279): undefined reference to `glfwSetInputMode'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2af): undefined reference to `gl3wDebugMessageCallback'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2bd): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2c9): undefined reference to `gl3wEnable'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2de): undefined reference to `sb6IsExtensionSupported(char const*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2ee): undefined reference to `gl3wDebugMessageCallbackARB'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x2fc): undefined reference to `sb7::application::debug_callback(unsigned int, unsigned int, unsigned int, unsigned int, int, char const*, void*)'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x308): undefined reference to `gl3wEnable'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x339): undefined reference to `glfwGetTime'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x355): undefined reference to `glfwSwapBuffers'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x35a): undefined reference to `glfwPollEvents'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x372): undefined reference to `glfwGetKey'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x39b): undefined reference to `glfwWindowShouldClose'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x3e7): undefined reference to `glfwDestroyWindow'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application3runEPS0_[_ZN3sb711application3runEPS0_]+0x3ec): undefined reference to `glfwTerminate'
/usr/bin/ld: main.o: in function `sb7::application::glfw_onResize(GLFWwindow*, int, int)':
main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x15): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application13glfw_onResizeEP10GLFWwindowii[_ZN3sb711application13glfw_onResizeEP10GLFWwindowii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.o: in function `sb7::application::glfw_onKey(GLFWwindow*, int, int, int, int)':
main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x1c): undefined reference to `sb7::application::app'
/usr/bin/ld: main.cpp:(.text._ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii[_ZN3sb711application10glfw_onKeyEP10GLFWwindowiiii]+0x23): undefined reference to `sb7::application::app'
/usr/bin/ld: main.o: in function `sb7::application::glfw_onMouseButton(GLFWwindow*, int, int, int)':
main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x18): undefined reference to `sb7::application::app'
/usr/bin/ld: main.o:main.cpp:(.text._ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii[_ZN3sb711application18glfw_onMouseButtonEP10GLFWwindowiii]+0x1f): more undefined references to `sb7::application::app' follow
/usr/bin/ld: main.o: in function `my_application::render(double)':
main.cpp:(.text._ZN14my_application6renderEd[_ZN14my_application6renderEd]+0x14): undefined reference to `gl3wClearBufferfv'
collect2: error: ld returned 1 exit status
At this point I tried with the single file version of gl3w.h which already includes gl3w.c. I put the two headers in /usr/include/GL/ and then I pointed sb7.h to that version of the library, but other errors appeared with g++ main.cpp -lglfw:
In file included from main.cpp:6:
sb7.h: In member function ‘virtual void sb7::application::run(sb7::application*)’:
sb7.h:137:9: error: ‘gl3wInit’ was not declared in this scope
gl3wInit();
^~~~~~~~
sb7.h:137:9: note: suggested alternative: ‘glfwInit’
gl3wInit();
^~~~~~~~
glfwInit
sb7.h:147:17: error: ‘gl3wIsSupported’ was not declared in this scope
if (gl3wIsSupported(4, 3))
^~~~~~~~~~~~~~~
sb7.h:147:17: note: suggested alternative: ‘gl3w_is_supported’
if (gl3wIsSupported(4, 3))
^~~~~~~~~~~~~~~
gl3w_is_supported
I also added #define GL3W_IMPLEMENTATION before #include "GL/gl3w.h" as suggested in the documentation of the single file version of gl3w but with no luck.
I get the same errors with the other book's source codes.
Hope that someone can help me.
Thank you.

Related

grpc core undefined references for c++ grpc v1.50?

I built gRPC from source with cmake.
I then build my client which is gRPC based with cmake.
As far as I understand the linking error I get is not related to my source code but perhaps a configuration issue. The weirder thing is that the libraries the linker complains about should be a part of the libgrpc++.a(based on gRPC cmake.)
the failed command
/usr/bin/c++ -Werror -g xxxx/my/client/CMakeFiles/my_client.dir/my_client.cc.o \
-o /tmp/my_client -W xxxx/my/proto/libmy_core.a /usr/local/lib/libgrpc++_reflection.a \
/usr/local/lib/libgrpc++.a /usr/local/lib/libprotobuf.a
error log
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_call(grpc_call*, std::shared_ptr<grpc::Channel> const&)':
client_context.cc:(.text+0x213): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: client_context.cc:(.text+0x2e0): undefined reference to `grpc_call_cancel'
/usr/bin/ld: client_context.cc:(.text+0x2e8): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: client_context.cc:(.text+0x31a): undefined reference to `grpc_call_cancel_with_status'
/usr/bin/ld: client_context.cc:(.text+0x382): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::TryCancel()':
client_context.cc:(.text+0x3f3): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: client_context.cc:(.text+0x40d): undefined reference to `grpc_call_cancel'
/usr/bin/ld: client_context.cc:(.text+0x415): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: client_context.cc:(.text+0x428): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::peer[abi:cxx11]() const':
client_context.cc:(.text+0x468): undefined reference to `grpc_call_get_peer'
/usr/bin/ld: client_context.cc:(.text+0x490): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::SetGlobalCallbacks(grpc::ClientContext::GlobalCallbacks*)':
client_context.cc:(.text+0x502): undefined reference to `gpr_log'
/usr/bin/ld: client_context.cc:(.text+0x532): undefined reference to `gpr_log'
/usr/bin/ld: client_context.cc:(.text+0x562): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::ClientContext()':
client_context.cc:(.text+0x5b0): undefined reference to `gpr_inf_future'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::~ClientContext()':
client_context.cc:(.text+0x8ab): undefined reference to `grpc_call_unref'
/usr/bin/ld: client_context.cc:(.text+0xaa7): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_compression_algorithm(grpc_compression_algorithm)':
client_context.cc:(.text+0xf1b): undefined reference to `grpc_compression_algorithm_name'
/usr/bin/ld: client_context.cc:(.text+0x10c2): undefined reference to `gpr_log'
/usr/bin/ld: client_context.cc:(.text+0x10ec): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_credentials(std::shared_ptr<grpc::CallCredentials> const&)':
client_context.cc:(.text+0x165): undefined reference to `grpc_call_cancel_with_status'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::internal::GrpcLibrary::shutdown()':
client_context.cc:(.text._ZN4grpc8internal11GrpcLibrary8shutdownEv[_ZN4grpc8internal11GrpcLibrary8shutdownEv]+0x5): undefined reference to `grpc_shutdown'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::internal::GrpcLibrary::init()':
client_context.cc:(.text._ZN4grpc8internal11GrpcLibrary4initEv[_ZN4grpc8internal11GrpcLibrary4initEv]+0x5): undefined reference to `grpc_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::set_call(grpc_call*, std::shared_ptr<grpc::Channel> const&) [clone .cold]':
client_context.cc:(.text.unlikely+0x9): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::TryCancel() [clone .cold]':
client_context.cc:(.text.unlikely+0x1a): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_context.cc.o): in function `grpc::ClientContext::ClientContext() [clone .cold]':
client_context.cc:(.text.unlikely+0xcf): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(create_channel.cc.o): in function `grpc::CreateCustomChannel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<grpc::ChannelCredentials> const&, grpc::ChannelArguments const&)':
create_channel.cc:(.text+0xa9): undefined reference to `grpc_lame_client_channel_create'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(create_channel.cc.o): in function `grpc::experimental::CreateCustomChannelWithInterceptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<grpc::ChannelCredentials> const&, grpc::ChannelArguments const&, std::vector<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> >, std::allocator<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> > > >)':
create_channel.cc:(.text+0x330): undefined reference to `grpc_lame_client_channel_create'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(insecure_credentials.cc.o): in function `grpc::(anonymous namespace)::InsecureChannelCredentialsImpl::CreateChannelWithInterceptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, grpc::ChannelArguments const&, std::vector<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> >, std::allocator<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface, std::default_delete<grpc::experimental::ClientInterceptorFactoryInterface> > > >)':
insecure_credentials.cc:(.text+0x1b8): undefined reference to `grpc_insecure_credentials_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x1ec): undefined reference to `grpc_channel_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x26e): undefined reference to `grpc_channel_credentials_release'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(insecure_credentials.cc.o): in function `grpc::(anonymous namespace)::InsecureChannelCredentialsImpl::CreateChannelImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, grpc::ChannelArguments const&)':
insecure_credentials.cc:(.text+0x327): undefined reference to `grpc_insecure_credentials_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x35f): undefined reference to `grpc_channel_create'
/usr/bin/ld: insecure_credentials.cc:(.text+0x3ea): undefined reference to `grpc_channel_credentials_release'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::~ChannelArguments()':
channel_arguments.cc:(.text+0xc4): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0xe6): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x109): undefined reference to `vtable for grpc_core::ScopedTimeCache'
/usr/bin/ld: channel_arguments.cc:(.text+0x124): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x13b): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x158): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x191): undefined reference to `grpc_core::ExecCtx::Flush()'
/usr/bin/ld: channel_arguments.cc:(.text+0x1a8): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x1e0): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x28b): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x29b): undefined reference to `grpc_core::Fork::DoDecExecCtxCount()'
/usr/bin/ld: channel_arguments.cc:(.text+0x2a9): undefined reference to `grpc_core::Fork::DoIncExecCtxCount()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetSocketMutator(grpc_socket_mutator*)':
channel_arguments.cc:(.text+0x384): undefined reference to `grpc_socket_mutator_to_arg(grpc_socket_mutator*)'
/usr/bin/ld: channel_arguments.cc:(.text+0x408): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x432): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x454): undefined reference to `vtable for grpc_core::ScopedTimeCache'
/usr/bin/ld: channel_arguments.cc:(.text+0x477): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x491): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x4b3): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x666): undefined reference to `grpc_core::ExecCtx::Flush()'
/usr/bin/ld: channel_arguments.cc:(.text+0x685): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text+0x6c8): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text+0x842): undefined reference to `gpr_log'
/usr/bin/ld: channel_arguments.cc:(.text+0x983): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text+0x993): undefined reference to `grpc_core::Fork::DoDecExecCtxCount()'
/usr/bin/ld: channel_arguments.cc:(.text+0x9a1): undefined reference to `grpc_core::Fork::DoIncExecCtxCount()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::ChannelArguments(grpc::ChannelArguments const&)':
channel_arguments.cc:(.text+0xd62): undefined reference to `gpr_log'
/usr/bin/ld: channel_arguments.cc:(.text+0xe02): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetUserAgentPrefix(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
channel_arguments.cc:(.text+0x1c17): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetResourceQuota(grpc::ResourceQuota const&)':
channel_arguments.cc:(.text+0x1ffc): undefined reference to `grpc_resource_quota_arg_vtable'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc_core::ExecCtx::~ExecCtx()':
channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x21): undefined reference to `grpc_core::ExecCtx::Flush()'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x3c): undefined reference to `grpc_core::ExecCtx::exec_ctx_'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x73): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x93): undefined reference to `grpc_core::Fork::support_enabled_'
/usr/bin/ld: channel_arguments.cc:(.text._ZN9grpc_core7ExecCtxD2Ev[_ZN9grpc_core7ExecCtxD5Ev]+0x9f): undefined reference to `grpc_core::Fork::DoDecExecCtxCount()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::~ChannelArguments() [clone .cold]':
channel_arguments.cc:(.text.unlikely+0x1e): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_arguments.cc.o): in function `grpc::ChannelArguments::SetSocketMutator(grpc_socket_mutator*) [clone .cold]':
channel_arguments.cc:(.text.unlikely+0x9b): undefined reference to `grpc_core::Timestamp::thread_local_time_source_'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::~Channel()':
channel_cc.cc:(.text+0x18a): undefined reference to `grpc_channel_destroy'
/usr/bin/ld: channel_cc.cc:(.text+0x1de): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: channel_cc.cc:(.text+0x271): undefined reference to `grpc_iomgr_run_in_background()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::CallbackCQ()':
channel_cc.cc:(.text+0x393): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: channel_cc.cc:(.text+0x3a5): undefined reference to `grpc_iomgr_run_in_background()'
/usr/bin/ld: channel_cc.cc:(.text+0x497): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: channel_cc.cc:(.text+0x4b0): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::WaitForStateChangeImpl(grpc_connectivity_state, gpr_timespec)':
channel_cc.cc:(.text+0x69b): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: channel_cc.cc:(.text+0x6f2): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::GetLoadBalancingPolicyName[abi:cxx11]() const':
channel_cc.cc:(.text+0x906): undefined reference to `grpc_channel_get_info'
/usr/bin/ld: channel_cc.cc:(.text+0x963): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::GetServiceConfigJSON[abi:cxx11]() const':
channel_cc.cc:(.text+0xaa6): undefined reference to `grpc_channel_get_info'
/usr/bin/ld: channel_cc.cc:(.text+0xb03): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::CreateCallInternal(grpc::internal::RpcMethod const&, grpc::ClientContext*, grpc::CompletionQueue*, unsigned long)':
channel_cc.cc:(.text+0xcf5): undefined reference to `grpc_channel_create_registered_call'
/usr/bin/ld: channel_cc.cc:(.text+0xdc7): undefined reference to `grpc_channel_create_call'
/usr/bin/ld: channel_cc.cc:(.text+0xde3): undefined reference to `grpc_slice_unref'
/usr/bin/ld: channel_cc.cc:(.text+0xdfc): undefined reference to `grpc_slice_unref'
/usr/bin/ld: channel_cc.cc:(.text+0xe16): undefined reference to `grpc_census_call_set_context'
/usr/bin/ld: channel_cc.cc:(.text+0x10e6): undefined reference to `grpc_channel_create_call'
/usr/bin/ld: channel_cc.cc:(.text+0x1102): undefined reference to `grpc_slice_unref'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::RegisterMethod(char const*)':
channel_cc.cc:(.text+0xa8): undefined reference to `grpc_channel_register_call'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::GetState(bool)':
channel_cc.cc:(.text+0xbd): undefined reference to `grpc_channel_check_connectivity_state'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::NotifyOnStateChangeImpl(grpc_connectivity_state, gpr_timespec, grpc::CompletionQueue*, void*)':
channel_cc.cc:(.text+0x12d): undefined reference to `grpc_channel_watch_connectivity_state'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::experimental::ChannelResetConnectionBackoff(grpc::Channel*)':
channel_cc.cc:(.text+0xc09): undefined reference to `grpc_channel_reset_connect_backoff'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::CallbackCQ() [clone .cold]':
channel_cc.cc:(.text.unlikely+0x12): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: channel_cc.cc:(.text.unlikely+0x2f): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(channel_cc.cc.o): in function `grpc::Channel::WaitForStateChangeImpl(grpc_connectivity_state, gpr_timespec) [clone .cold]':
channel_cc.cc:(.text.unlikely+0x75): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::(anonymous namespace)::CallbackAlternativeCQ::Ref()::{lambda(void*)#1}::_FUN(void*)':
completion_queue_cc.cc:(.text+0x4b): undefined reference to `gpr_time_from_millis'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x5b): undefined reference to `gpr_now'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x6c): undefined reference to `gpr_time_add'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x79): undefined reference to `grpc_completion_queue_next'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xab): undefined reference to `gpr_time_from_millis'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xbb): undefined reference to `gpr_now'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xcc): undefined reference to `gpr_time_add'
/usr/bin/ld: completion_queue_cc.cc:(.text+0xd7): undefined reference to `gpr_sleep_until'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec)':
completion_queue_cc.cc:(.text+0x198): undefined reference to `grpc_completion_queue_next'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CompletionQueueTLSCache::~CompletionQueueTLSCache()':
completion_queue_cc.cc:(.text+0x256): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CompletionQueueTLSCache::Flush(void**, bool*)':
completion_queue_cc.cc:(.text+0x29f): undefined reference to `grpc_completion_queue_thread_local_cache_flush'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CallbackAlternativeCQ()':
completion_queue_cc.cc:(.text+0x321): undefined reference to `gpr_once_init'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x330): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x353): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x426): undefined reference to `gpr_cpu_num_cores'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x4b2): undefined reference to `grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x570): undefined reference to `grpc_core::Thread::Thread(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x684): undefined reference to `gpr_log'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x712): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::ReleaseCallbackAlternativeCQ(grpc::CompletionQueue*)':
completion_queue_cc.cc:(.text+0x7a9): undefined reference to `absl::lts_20220623::Mutex::Lock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x80b): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: completion_queue_cc.cc:(.text+0x87c): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CompletionQueueTLSCache::CompletionQueueTLSCache(grpc::CompletionQueue*)':
completion_queue_cc.cc:(.text+0x210): undefined reference to `grpc_completion_queue_thread_local_cache_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc_core::Thread::~Thread()':
completion_queue_cc.cc:(.text._ZN9grpc_core6ThreadD2Ev[_ZN9grpc_core6ThreadD5Ev]+0x3d): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::CallbackAlternativeCQ() [clone .cold]':
completion_queue_cc.cc:(.text.unlikely+0x11): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: completion_queue_cc.cc:(.text.unlikely+0x2b): undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(completion_queue_cc.cc.o): in function `grpc::CompletionQueue::ReleaseCallbackAlternativeCQ(grpc::CompletionQueue*) [clone .cold]':
completion_queue_cc.cc:(.text.unlikely+0x83): undefined reference to `absl::lts_20220623::Mutex::Unlock()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(client_interceptor.cc.o): in function `grpc::experimental::RegisterGlobalClientInterceptorFactory(grpc::experimental::ClientInterceptorFactoryInterface*)':
client_interceptor.cc:(.text+0x38): undefined reference to `gpr_log'
/usr/bin/ld: xxxx/my/proto/libmy_core.a(my.grpc.pb.cc.o): in function `grpc::CompletionQueue::~CompletionQueue()':
/usr/local/include/grpcpp/impl/codegen/completion_queue.h:119: undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: xxxx/my/proto/libmy_core.a(my.grpc.pb.cc.o): in function `grpc::CompletionQueue::CompletionQueue(grpc_completion_queue_attributes const&)':
/usr/local/include/grpcpp/impl/codegen/completion_queue.h:253: undefined reference to `absl::lts_20220623::Mutex::~Mutex()'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_new_with_user_data(void*, unsigned long, void (*)(void*), void*)':
core_codegen.cc:(.text+0x2ca): undefined reference to `grpc_slice_new_with_user_data'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_new_with_len(void*, unsigned long, void (*)(void*, unsigned long))':
core_codegen.cc:(.text+0x317): undefined reference to `grpc_slice_new_with_len'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_empty_slice()':
core_codegen.cc:(.text+0x35e): undefined reference to `grpc_empty_slice'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_malloc(unsigned long)':
core_codegen.cc:(.text+0x3b1): undefined reference to `grpc_slice_malloc'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_ref(grpc_slice)':
core_codegen.cc:(.text+0x41e): undefined reference to `grpc_slice_ref'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_split_tail(grpc_slice*, unsigned long)':
core_codegen.cc:(.text+0x474): undefined reference to `grpc_slice_split_tail'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_split_head(grpc_slice*, unsigned long)':
core_codegen.cc:(.text+0x4c4): undefined reference to `grpc_slice_split_head'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_sub(grpc_slice, unsigned long, unsigned long)':
core_codegen.cc:(.text+0x524): undefined reference to `grpc_slice_sub'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_from_static_buffer(void const*, unsigned long)':
core_codegen.cc:(.text+0x574): undefined reference to `grpc_slice_from_static_buffer'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_slice_from_copied_buffer(void const*, unsigned long)':
core_codegen.cc:(.text+0x5c4): undefined reference to `grpc_slice_from_copied_buffer'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::assert_fail(char const*, char const*, int)':
core_codegen.cc:(.text+0x67f): undefined reference to `gpr_log'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_factory_lookup(grpc_completion_queue_attributes const*)':
core_codegen.cc:(.text+0x28): undefined reference to `grpc_completion_queue_factory_lookup'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_create(grpc_completion_queue_factory const*, grpc_completion_queue_attributes const*, void*)':
core_codegen.cc:(.text+0x3e): undefined reference to `grpc_completion_queue_create'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_create_for_next(void*)':
core_codegen.cc:(.text+0x58): undefined reference to `grpc_completion_queue_create_for_next'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_create_for_pluck(void*)':
core_codegen.cc:(.text+0x68): undefined reference to `grpc_completion_queue_create_for_pluck'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_shutdown(grpc_completion_queue*)':
core_codegen.cc:(.text+0x78): undefined reference to `grpc_completion_queue_shutdown'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue*)':
core_codegen.cc:(.text+0x88): undefined reference to `grpc_completion_queue_destroy'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_completion_queue_pluck(grpc_completion_queue*, void*, gpr_timespec, void*)':
core_codegen.cc:(.text+0xa4): undefined reference to `grpc_completion_queue_pluck'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_malloc(unsigned long)':
core_codegen.cc:(.text+0xb8): undefined reference to `gpr_malloc'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_free(void*)':
core_codegen.cc:(.text+0xc8): undefined reference to `gpr_free'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_init()':
core_codegen.cc:(.text+0xd5): undefined reference to `grpc_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::grpc_shutdown()':
core_codegen.cc:(.text+0xe5): undefined reference to `grpc_shutdown'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_init(long*)':
core_codegen.cc:(.text+0xf8): undefined reference to `gpr_mu_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_destroy(long*)':
core_codegen.cc:(.text+0x108): undefined reference to `gpr_mu_destroy'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_lock(long*)':
core_codegen.cc:(.text+0x118): undefined reference to `gpr_mu_lock'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_mu_unlock(long*)':
core_codegen.cc:(.text+0x128): undefined reference to `gpr_mu_unlock'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function `grpc::CoreCodegen::gpr_cv_init(long*)':
core_codegen.cc:(.text+0x138): undefined reference to `gpr_cv_init'
/usr/bin/ld: /usr/local/lib/libgrpc++.a(core_codegen.cc.o): in function
# there are more logs, but not enough space for SO question
For those who may run into the same issue, there is a conversation about this at https://github.com/grpc/grpc/issues/31449.

How to fix multiple definition of main building gtest project using make on ubuntu [duplicate]

This question already has an answer here:
Linking issue with GCC 4.6.1
(1 answer)
Closed 1 year ago.
I wanted to build a gtest project on linux using just a makefile, ie not using cmake. I followed along the tutorial here:
http://www.yolinux.com/TUTORIALS/Cpp-GoogleTest.html
But getting multiple definition of main errors - see below.
I am on ubuntu v20.04
angus#angus-VirtualBox:~/Documents/code/gtest_make_only/test/src$ uname -a
Linux angus-VirtualBox 5.11.0-38-generic #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I installed gtest like this:
git clone https://github.com/google/googletest.git
mkdir build
cd build
sudo snap install cmake --classic
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
If I now look on my system I have
/usr/local/include - with gtest directory with header files
/usr/local/lib - contains libgtest.a and libgtest_main.a
I modified the Makefile in the example to be like this:
CXX = g++
CXXFLAGS = -g -L/usr/local/lib -lgtest -lgtest_main -lpthread
INCS = -I./ -I../../src -I/usr/local/include
OBJS = ../../src/Addition.o Addition_Test.o ../../src/Multiply.o Multiply_Test.o
testAll: $(OBJS)
$(CXX) $(CXXFLAGS) $(INCS) -o testAll Main_TestAll.cpp $(OBJS)
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $# $(INCS)
clean:
rm testAll *.o testAll.xml
I also had to tidy up the code sample - eg where in code has Addition.h - have to change to Addition.hpp which is the filename.
The build error below. How to fix this?
I did try by removing -lgtest_main from the Makefile, but then get error:
/home/angus/Documents/code/gtest_make_only/test/src/Main_TestAll.cpp:5: undefined reference to `testing::InitGoogleTest(int*, char**)'
build error:
angus#angus-VirtualBox:~/Documents/code/gtest_make_only/test/src$ make
g++ -g -L/usr/local/lib -lgtest -lgtest_main -lpthread -c Multiply_Test.cpp -o Multiply_Test.o -I./ -I../../src -I/usr/local/include
g++ -g -L/usr/local/lib -lgtest -lgtest_main -lpthread -I./ -I../../src -I/usr/local/include -o testAll Main_TestAll.cpp ../../src/Addition.o Addition_Test.o ../../src/Multiply.o Multiply_Test.o
/usr/bin/ld: /tmp/cc4xkhF1.o: in function `RUN_ALL_TESTS()':
/home/angus/Documents/code/gtest_make_only/test/src/Main_TestAll.cpp:4: multiple definition of `main'; /usr/local/lib/libgtest_main.a(gtest_main.cc.o):gtest_main.cc:(.text+0x0): first defined here
/usr/bin/ld: /usr/local/lib/libgtest_main.a(gtest_main.cc.o): in function `main':
gtest_main.cc:(.text+0x3a): undefined reference to `testing::InitGoogleTest(int*, char**)'
/usr/bin/ld: /usr/local/lib/libgtest_main.a(gtest_main.cc.o): in function `RUN_ALL_TESTS()':
gtest_main.cc:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0x9): undefined reference to `testing::UnitTest::GetInstance()'
/usr/bin/ld: gtest_main.cc:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0x11): undefined reference to `testing::UnitTest::Run()'
/usr/bin/ld: /tmp/cc4xkhF1.o: in function `main':
/home/angus/Documents/code/gtest_make_only/test/src/Main_TestAll.cpp:5: undefined reference to `testing::InitGoogleTest(int*, char**)'
/usr/bin/ld: Addition_Test.o: in function `AdditionTest_twoValues_Test::TestBody()':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: Addition_Test.o: in function `__static_initialization_and_destruction_0(int, int)':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:16: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: Addition_Test.o: in function `testing::internal::SuiteApiResolver<AdditionTest>::GetSetUpCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Addition_Test.o: in function `testing::internal::SuiteApiResolver<AdditionTest>::GetTearDownCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Addition_Test.o: in function `testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&)':
/usr/local/include/gtest/gtest.h:1549: undefined reference to `testing::AssertionSuccess()'
/usr/bin/ld: Addition_Test.o: in function `testing::AssertionResult testing::internal::CmpHelperEQFailure<int, int>(char const*, char const*, int const&, int const&)':
/usr/local/include/gtest/gtest.h:1532: undefined reference to `testing::internal::EqFailure(char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: Addition_Test.o: in function `AdditionTest::~AdditionTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:5: undefined reference to `testing::Test::~Test()'
/usr/bin/ld: Addition_Test.o:(.data.rel.ro._ZTI12AdditionTest[_ZTI12AdditionTest]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: Addition_Test.o: in function `AdditionTest::AdditionTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:5: undefined reference to `testing::Test::Test()'
/usr/bin/ld: Multiply_Test.o: in function `MultiplyTest_twoValues_Test::TestBody()':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: Multiply_Test.o: in function `__static_initialization_and_destruction_0(int, int)':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:14: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: Multiply_Test.o: in function `testing::internal::SuiteApiResolver<MultiplyTest>::GetSetUpCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Multiply_Test.o: in function `testing::internal::SuiteApiResolver<MultiplyTest>::GetTearDownCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Multiply_Test.o: in function `MultiplyTest::~MultiplyTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:5: undefined reference to `testing::Test::~Test()'
/usr/bin/ld: Multiply_Test.o:(.data.rel.ro._ZTI12MultiplyTest[_ZTI12MultiplyTest]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: Multiply_Test.o: in function `MultiplyTest::MultiplyTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:5: undefined reference to `testing::Test::Test()'
collect2: error: ld returned 1 exit status
make: *** [Makefile:7: testAll] Error 1
Your command lines are all wrong.
Library specification should follow sources and object files. Correct line should look like this:
g++ -g -I./ -I../../src -o testAll Main_TestAll.cpp ../../src/Addition.o Addition_Test.o ../../src/Multiply.o Multiply_Test.o -lgtest_main -lgtest -lpthread
See this blog post for explanation.

Can't find libpq library for C++ program using libpqxx

I'm not a C++ developer and I don't know very much about compiling projects or makefiles, but I'm trying to compile and run someone else's C++ program. I'm using Ubuntu. Here's the makefile I have so far, based on this:
TARGET_EXEC ?= a.out
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP
CC = gcc
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CC) $(OBJS) -o $# $(LDFLAGS) /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -I/usr/local/include/boost -I/usr/local/include/pqxx -I/usr/lib/postgresql/13/lib -I/usr/include/postgresql -I/usr/include/postgresql/libpq -I/usr/include/postgresql/internal -I/usr/include/postgresql/internal/libpq -L/usr/local/lib -lboost_filesystem -lpqxx
# assembly
$(BUILD_DIR)/%.s.o: %.s
$(MKDIR_P) $(dir $#)
$(AS) $(ASFLAGS) -c $< -o $#
# c source
# $(BUILD_DIR)/%.c.o: %.c
# $(MKDIR_P) $(dir $#)
# $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $# -lstdc++
# c++ source
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $#)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $#
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)
MKDIR_P ?= mkdir -p
The part commented # c++ source seems to complete without issue, but then I run into problems with the long line above $(CC) $(OBJS) -o $# $(LDFLAGS) ...:
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::backendpid() const':
/usr/local/include/pqxx/src/connection_base.cxx:121: undefined reference to `PQbackendPID'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::sock() const':
/usr/local/include/pqxx/src/connection_base.cxx:129: undefined reference to `PQsocket'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::protocol_version() const':
/usr/local/include/pqxx/src/connection_base.cxx:214: undefined reference to `PQprotocolVersion'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::consume_input()':
/usr/local/include/pqxx/src/connection_base.cxx:501: undefined reference to `PQconsumeInput'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::is_busy() const':
/usr/local/include/pqxx/src/connection_base.cxx:507: undefined reference to `PQisBusy'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::set_verbosity(pqxx::connection_base::error_verbosity)':
/usr/local/include/pqxx/src/connection_base.cxx:551: undefined reference to `PQsetErrorVerbosity'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::err_msg() const':
/usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::set_notice_processor()':
/usr/local/include/pqxx/src/connection_base.cxx:672: undefined reference to `PQsetNoticeProcessor'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::clear_notice_processor()':
/usr/local/include/pqxx/src/connection_base.cxx:666: undefined reference to `PQsetNoticeProcessor'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::internal_set_trace()':
/usr/local/include/pqxx/src/connection_base.cxx:957: undefined reference to `PQtrace'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:958: undefined reference to `PQuntrace'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::unesc_raw[abi:cxx11](char const*)':
/usr/local/include/pqxx/src/connection_base.cxx:1152: undefined reference to `PQunescapeBytea'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::internal::wait_read(pg_conn const*)':
/usr/local/include/pqxx/src/connection_base.cxx:129: undefined reference to `PQsocket'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::internal::wait_read(pg_conn const*, long, long)':
/usr/local/include/pqxx/src/connection_base.cxx:129: undefined reference to `PQsocket'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::internal::wait_write(pg_conn const*)':
/usr/local/include/pqxx/src/connection_base.cxx:129: undefined reference to `PQsocket'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::cancel_query()':
/usr/local/include/pqxx/src/connection_base.cxx:526: undefined reference to `PQgetCancel'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:535: undefined reference to `PQcancel'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:530: undefined reference to `PQfreeCancel'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::read_capabilities()':
/usr/local/include/pqxx/src/connection_base.cxx:1360: undefined reference to `PQserverVersion'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::protocol_version() const':
/usr/local/include/pqxx/src/connection_base.cxx:214: undefined reference to `PQprotocolVersion'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::set_client_encoding(char const*)':
/usr/local/include/pqxx/src/connection_base.cxx:1395: undefined reference to `PQsetClientEncoding'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::encoding_id() const':
/usr/local/include/pqxx/src/connection_base.cxx:1419: undefined reference to `PQclientEncoding'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::encrypt_password(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/local/include/pqxx/src/connection_base.cxx:94: undefined reference to `PQencryptPassword'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::quote_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/local/include/pqxx/src/connection_base.cxx:1180: undefined reference to `PQescapeIdentifier'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::clear_notice_processor()':
/usr/local/include/pqxx/src/connection_base.cxx:666: undefined reference to `PQsetNoticeProcessor'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::set_up_state()':
/usr/local/include/pqxx/src/connection_base.cxx:321: undefined reference to `PQsendQuery'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:324: undefined reference to `PQgetResult'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::err_msg() const':
/usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::register_prepared(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/local/include/pqxx/src/connection_base.cxx:800: undefined reference to `PQprepare'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::start_exec(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/local/include/pqxx/src/connection_base.cxx:1079: undefined reference to `PQsendQuery'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::esc_raw[abi:cxx11](unsigned char const*, unsigned long)':
/usr/local/include/pqxx/src/connection_base.cxx:1139: undefined reference to `PQescapeByteaConn'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::reset()':
/usr/local/include/pqxx/src/connection_base.cxx:889: undefined reference to `PQreset'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::esc[abi:cxx11](char const*, unsigned long)':
/usr/local/include/pqxx/src/connection_base.cxx:1108: undefined reference to `PQescapeStringConn'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::end_copy_write()':
/usr/local/include/pqxx/src/connection_base.cxx:1054: undefined reference to `PQputCopyEnd'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:1070: undefined reference to `PQgetResult'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::read_copy_line(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/usr/local/include/pqxx/src/connection_base.cxx:999: undefined reference to `PQgetCopyData'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:1007: undefined reference to `PQgetResult'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:1009: undefined reference to `PQgetResult'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::consume_input()':
/usr/local/include/pqxx/src/connection_base.cxx:501: undefined reference to `PQconsumeInput'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::get_notifs()':
/usr/local/include/pqxx/src/connection_base.cxx:565: undefined reference to `PQnotifies'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:565: undefined reference to `PQnotifies'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::parameterized_exec(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const* const*, int const*, int const*, int)':
/usr/local/include/pqxx/src/connection_base.cxx:1448: undefined reference to `PQexecParams'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::exec_params(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pqxx::internal::params const&)':
/usr/local/include/pqxx/src/connection_base.cxx:1460: undefined reference to `PQexecParams'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::prepared_exec(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const* const*, int const*, int const*, int)':
/usr/local/include/pqxx/src/connection_base.cxx:836: undefined reference to `PQexecPrepared'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::exec_prepared(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pqxx::internal::params const&)':
/usr/local/include/pqxx/src/connection_base.cxx:852: undefined reference to `PQexecPrepared'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::exec(char const*, int)':
/usr/local/include/pqxx/src/connection_base.cxx:715: undefined reference to `PQexec'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::exec(char const*, int)':
/usr/local/include/pqxx/src/connection_base.cxx:721: undefined reference to `PQexec'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::write_copy_line(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/local/include/pqxx/src/connection_base.cxx:1041: undefined reference to `PQputCopyData'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::err_msg() const':
/usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::write_copy_line(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/local/include/pqxx/src/connection_base.cxx:1046: undefined reference to `PQendcopy'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::status() const':
/usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:965: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::add_receiver(pqxx::notification_receiver*)':
/usr/local/include/pqxx/src/connection_base.cxx:452: undefined reference to `PQexec'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::clear_notice_processor()':
/usr/local/include/pqxx/src/connection_base.cxx:666: undefined reference to `PQsetNoticeProcessor'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::set_notice_processor()':
/usr/local/include/pqxx/src/connection_base.cxx:672: undefined reference to `PQsetNoticeProcessor'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::get_result()':
/usr/local/include/pqxx/src/connection_base.cxx:1086: undefined reference to `PQgetResult'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::dbname()':
/usr/local/include/pqxx/src/connection_base.cxx:627: undefined reference to `PQdb'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:627: undefined reference to `PQdb'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::username()':
/usr/local/include/pqxx/src/connection_base.cxx:636: undefined reference to `PQuser'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:636: undefined reference to `PQuser'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::hostname()':
/usr/local/include/pqxx/src/connection_base.cxx:645: undefined reference to `PQhost'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:645: undefined reference to `PQhost'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::port()':
/usr/local/include/pqxx/src/connection_base.cxx:654: undefined reference to `PQport'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:654: undefined reference to `PQport'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::err_msg() const':
/usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::cancel_query() [clone .cold]':
/usr/local/include/pqxx/src/connection_base.cxx:530: undefined reference to `PQfreeCancel'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection_base.o): in function `pqxx::connection_base::err_msg() const':
/usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/include/pqxx/src/connection_base.cxx:660: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection.o): in function `pqxx::connectionpolicy::do_disconnect(pg_conn*)':
/usr/local/include/pqxx/src/connection.cxx:72: undefined reference to `PQfinish'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection.o): in function `pqxx::connect_async::do_startconnect(pg_conn*)':
/usr/local/include/pqxx/src/connection.cxx:116: undefined reference to `PQconnectStart'
/usr/bin/ld: /usr/local/include/pqxx/src/connection.cxx:118: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/include/pqxx/src/connection.cxx:121: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection.o): in function `pqxx::connect_async::do_completeconnect(pg_conn*)':
/usr/local/include/pqxx/src/connection.cxx:164: undefined reference to `PQconnectPoll'
/usr/bin/ld: /usr/local/include/pqxx/src/connection.cxx:164: undefined reference to `PQconnectPoll'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection.o): in function `pqxx::connectionpolicy::normalconnect(pg_conn*)':
/usr/local/include/pqxx/src/connection.cxx:38: undefined reference to `PQconnectdb'
/usr/bin/ld: /usr/local/include/pqxx/src/connection.cxx:40: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/include/pqxx/src/connection.cxx:42: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/include/pqxx/src/connection.cxx:43: undefined reference to `PQfinish'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection.o): in function `pqxx::connect_direct::do_startconnect(pg_conn*)':
/usr/local/include/pqxx/src/connection.cxx:88: undefined reference to `PQstatus'
/usr/bin/ld: /usr/local/include/pqxx/src/connection.cxx:90: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(connection.o): in function `pqxx::connect_async::do_completeconnect(pg_conn*)':
/usr/local/include/pqxx/src/connection.cxx:146: undefined reference to `PQerrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(encodings.o): in function `pqxx::internal::name_encoding(int)':
/usr/local/include/pqxx/src/encodings.cxx:633: undefined reference to `pg_encoding_to_char'
/usr/bin/ld: /usr/local/include/pqxx/src/encodings.cxx:633: undefined reference to `pg_encoding_to_char'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::size() const':
/usr/local/include/pqxx/src/result.cxx:96: undefined reference to `PQntuples'
/usr/bin/ld: /usr/local/include/pqxx/src/result.cxx:96: undefined reference to `PQntuples'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::empty() const':
/usr/local/include/pqxx/src/result.cxx:102: undefined reference to `PQntuples'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::size() const':
/usr/local/include/pqxx/src/result.cxx:96: undefined reference to `PQntuples'
/usr/bin/ld: /usr/local/include/pqxx/src/result.cxx:96: undefined reference to `PQntuples'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o):/usr/local/include/pqxx/src/result.cxx:96: more undefined references to `PQntuples' follow
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::cmd_status() const':
/usr/local/include/pqxx/src/result.cxx:273: undefined reference to `PQcmdStatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::affected_rows() const':
/usr/local/include/pqxx/src/result.cxx:294: undefined reference to `PQcmdTuples'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::get_is_null(unsigned long, unsigned int) const':
/usr/local/include/pqxx/src/result.cxx:312: undefined reference to `PQgetisnull'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::get_length(unsigned long, unsigned int) const':
/usr/local/include/pqxx/src/result.cxx:319: undefined reference to `PQgetlength'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::errorposition() const':
/usr/local/include/pqxx/src/result.cxx:375: undefined reference to `PQresultErrorField'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::ThrowSQLError(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
/usr/local/include/pqxx/src/result.cxx:153: undefined reference to `PQresultErrorField'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::columns() const':
/usr/local/include/pqxx/src/result.cxx:402: undefined reference to `PQnfields'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::column_type(unsigned int) const':
/usr/local/include/pqxx/src/result.cxx:325: undefined reference to `PQftype'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::column_table(unsigned int) const':
/usr/local/include/pqxx/src/result.cxx:336: undefined reference to `PQftable'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::columns() const':
/usr/local/include/pqxx/src/result.cxx:402: undefined reference to `PQnfields'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::table_column(unsigned int) const':
/usr/local/include/pqxx/src/result.cxx:352: undefined reference to `PQftablecol'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::columns() const':
/usr/local/include/pqxx/src/result.cxx:402: undefined reference to `PQnfields'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::size() const':
/usr/local/include/pqxx/src/result.cxx:96: undefined reference to `PQntuples'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::StatusError[abi:cxx11]() const':
/usr/local/include/pqxx/src/result.cxx:245: undefined reference to `PQresultStatus'
/usr/bin/ld: /usr/local/include/pqxx/src/result.cxx:259: undefined reference to `PQresultErrorMessage'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::inserted_oid() const':
/usr/local/include/pqxx/src/result.cxx:288: undefined reference to `PQoidValue'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::column_name(unsigned int) const':
/usr/local/include/pqxx/src/result.cxx:386: undefined reference to `PQfname'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::internal::clear_result(pg_result const*)':
/usr/local/include/pqxx/src/result.cxx:32: undefined reference to `PQclear'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::GetValue(unsigned long, unsigned int) const':
/usr/local/include/pqxx/src/result.cxx:304: undefined reference to `PQgetvalue'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::columns() const':
/usr/local/include/pqxx/src/result.cxx:402: undefined reference to `PQnfields'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::internal::clear_result(pg_result const*)':
/usr/local/include/pqxx/src/result.cxx:32: undefined reference to `PQclear'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::StatusError[abi:cxx11]() const':
/usr/local/include/pqxx/src/result.cxx:265: undefined reference to `PQresultStatus'
/usr/bin/ld: /usr/local/lib/libpqxx.a(result.o): in function `pqxx::result::columns() const':
/usr/local/include/pqxx/src/result.cxx:402: undefined reference to `PQnfields'
/usr/bin/ld: /usr/local/lib/libpqxx.a(row.o): in function `pqxx::result::column_number(char const*) const':
/usr/local/include/pqxx/src/row.cxx:209: undefined reference to `PQfnumber'
/usr/bin/ld: /usr/local/lib/libpqxx.a(util.o): in function `pqxx::describe_thread_safety()':
/usr/local/include/pqxx/src/util.cxx:35: undefined reference to `PQisthreadsafe'
/usr/bin/ld: /usr/local/lib/libpqxx.a(util.o): in function `pqxx::internal::freepqmem(void const*)':
/usr/local/include/pqxx/src/util.cxx:108: undefined reference to `PQfreemem'
collect2: error: ld returned 1 exit status
make: *** [Makefile:17: build/a.out] Error 1
From what I can tell, some necessary parts of the libpq library can't be found. I don't know if I'm supposed to be using -I or -L, /usr/lib/postgresql/13/ or /usr/include/postgresql or something else, so I've just been trying different combinations, but to no avail. In addition to installing PostgreSQL, I installed libpq-dev with apt-get, but I don't know what that actually did.

makefile example to use soplex

I'm trying to link soplex (the infinite precision LP solver of SCIP) in my C/C++ code. I managed to install soplex in my linux machine and from the command line it works.
My problem is that I do not manage to link it in my code:
I'm currently using a normal makefile in which I've put:
#sopleX HERE
SOPLEX_DIR = /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib
SOPLEX_INCLUDE= /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/src
LP_LIBS = -L/usr/lib/x86_64-linux-gnu/ -lgmp -L$(CPLEXLIBDIR) -lilocplex -lcplex -lm -lpthread -ldl -frounding-math -L$(GRBLIBDIR) -lgurobi90 -L$(SOPLEX_DIR) -lsoplex
DBG= -O3 -DIL_STD
INCDIR = -I. -I$(LP_INCLUDE) -I/usr/local/include -I$(GRB_LP_INCLUDE) -I$(SOPLEX_INCLUDE)
CXXFLAGS = $(DBG) $(INCDIR)
.c.o:
gcc -c $(CXXFLAGS) $< -o $#
#LDLIBS = $(CONCORDE_LIBS) $(MY_LIBS) $(LP_LIBS)
#LDLIBS = $(CONCORDE_LIBS) $(LP_LIBS)
LDLIBS = $(LP_LIBS)
all:BPPS
BPPS: $(OBJS)
$(CXX) $(CXXFLAGS) -o $# $(OBJS) $(LDLIBS)
$(OBJS): Makefile
clean:
rm -f $(OBJS) rm BPPS
but when I try to compile it gives me a series of errors:
g++ -O3 -DIL_STD -I. -I/home/fabio/ILOG/CPLEX_Studio_AcademicResearch129/cplex/include/ilcplex -I/usr/local/include -I/home/fabio/GUROBI/gurobi903/linux64/include -I/home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/src -o BPPS src/Main.o src/DP.o src/DP_LEX.o src/BPPS_BP_MASTER.o src/BPPS_BP_PRICER.o src/BPPS_BP_TREE.o src/BPPS_BP_TRIPLETS.o src/BPPS_BP_DIVING.o src/BPPS_BP_LP_HEUR.o src/BPPS_BP_SP_HEUR.o src/BPPS_BP_MAPPING.o src/REDUCTIONS.o src/preprocessing.o src/global_functions.o source/errors.o source/dp_master.o source/heap.o source/mckpsc-ls.o source/sort.o source/tools.o src/BPPS_FORM_B.o src/BPPS_FORM_A.o -L/usr/lib/x86_64-linux-gnu/ -lgmp -L/home/fabio/ILOG/CPLEX_Studio_AcademicResearch129/cplex/lib/x86-64_linux/static_pic -lilocplex -lcplex -lm -lpthread -ldl -frounding-math -L/home/fabio/GUROBI/gurobi903/linux64/lib -lgurobi90 -L/home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib -lsoplex
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::~Rational()':
rational.cpp:(.text+0x44): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::freeListMem()':
rational.cpp:(.text+0x138): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0x157): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::disableListMem()':
rational.cpp:(.text+0x1f8): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0x217): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(soplex::Rational const&)':
rational.cpp:(.text+0x2a0): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(long double const&)':
rational.cpp:(.text+0x2ec): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x30c): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x32c): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x34b): undefined reference to `__gmpq_set_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(double const&)':
rational.cpp:(.text+0x398): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3b2): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3ca): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3d9): undefined reference to `__gmpq_set_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(int const&)':
rational.cpp:(.text+0x413): undefined reference to `__gmpq_set_si'
/usr/bin/ld: rational.cpp:(.text+0x428): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x440): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x458): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(__mpq_struct const (&) [1])':
rational.cpp:(.text+0x47d): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator double() const':
rational.cpp:(.text+0x4aa): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x4bd): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator long double() const':
rational.cpp:(.text+0x51e): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x531): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x53d): undefined reference to `__gmpq_get_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator float() const':
rational.cpp:(.text+0x59e): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x5b9): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x5cd): undefined reference to `__gmpq_get_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator+=(soplex::Rational const&)':
rational.cpp:(.text+0x641): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x654): undefined reference to `__gmpq_add'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator-=(soplex::Rational const&)':
rational.cpp:(.text+0x681): undefined reference to `__gmpq_sub'
/usr/bin/ld: rational.cpp:(.text+0x694): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator*=(soplex::Rational const&)':
rational.cpp:(.text+0x6e2): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x6f1): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x707): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x716): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x72a): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x753): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x76f): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x782): undefined reference to `__gmpq_mul'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator/=(soplex::Rational const&)':
rational.cpp:(.text+0x7c0): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7d6): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7e5): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7f4): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x806): undefined reference to `__gmpq_div'
/usr/bin/ld: rational.cpp:(.text+0x827): undefined reference to `__gmpq_inv'
/usr/bin/ld: rational.cpp:(.text+0x84f): undefined reference to `__gmpq_inv'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::invert()':
rational.cpp:(.text+0x870): undefined reference to `__gmpq_inv'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::powRound()':
rational.cpp:(.text+0x8a5): undefined reference to `__gmpz_init'
/usr/bin/ld: rational.cpp:(.text+0x8b5): undefined reference to `__gmpz_cdiv_q'
/usr/bin/ld: rational.cpp:(.text+0x8c5): undefined reference to `__gmpz_sub_ui'
/usr/bin/ld: rational.cpp:(.text+0x8d2): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x8e2): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0x8ee): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0x8f6): undefined reference to `__gmpz_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::isAdjacentTo(double const&) const':
rational.cpp:(.text+0x94b): undefined reference to `__gmpq_get_d'
/usr/bin/ld: rational.cpp:(.text+0x959): undefined reference to `__gmpq_init'
/usr/bin/ld: rational.cpp:(.text+0x96b): undefined reference to `__gmpq_set_d'
/usr/bin/ld: rational.cpp:(.text+0x976): undefined reference to `__gmpq_cmp'
/usr/bin/ld: rational.cpp:(.text+0x980): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::sizeInBase(int) const':
rational.cpp:(.text+0xa92): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xaa1): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::readStringRational(char const*, soplex::Rational&)':
rational.cpp:(.text+0xb2e): undefined reference to `__gmpq_set_str'
/usr/bin/ld: rational.cpp:(.text+0xb6d): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xba2): undefined reference to `__gmpz_init'
/usr/bin/ld: rational.cpp:(.text+0xbaa): undefined reference to `__gmpq_init'
/usr/bin/ld: rational.cpp:(.text+0xc99): undefined reference to `__gmpq_set_str'
/usr/bin/ld: rational.cpp:(.text+0xcaa): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xcd8): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xce0): undefined reference to `__gmpz_clear'
/usr/bin/ld: rational.cpp:(.text+0xce8): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0xdfb): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0xe06): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0xe15): undefined reference to `__gmpq_mul'
/usr/bin/ld: rational.cpp:(.text+0xe82): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0xe8d): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0xe9c): undefined reference to `__gmpq_div'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<<(std::ostream&, soplex::Rational const&)':
rational.cpp:(.text+0xede): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xeef): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xf0c): undefined reference to `__gmpq_get_str'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator==(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xf7f): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator!=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xf9f): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfbf): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfdf): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator>(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfff): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator>=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0x101f): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::totalSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x108e): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x109d): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::dlcmSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x1103): undefined reference to `__gmpz_init_set_ui'
/usr/bin/ld: rational.cpp:(.text+0x1132): undefined reference to `__gmpz_lcm'
/usr/bin/ld: rational.cpp:(.text+0x1142): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x114d): undefined reference to `__gmpz_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::dmaxSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x11b2): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::rationalToString[abi:cxx11](soplex::Rational const&, int)':
rational.cpp:(.text+0x1245): undefined reference to `__gmpf_init2'
/usr/bin/ld: rational.cpp:(.text+0x1251): undefined reference to `__gmpf_set_q'
/usr/bin/ld: rational.cpp:(.text+0x1267): undefined reference to `__gmpf_out_str'
/usr/bin/ld: rational.cpp:(.text+0x1274): undefined reference to `__gmpf_clear'
/usr/bin/ld:
[.....]
I think that there must be a problem linking the libraries of gmp, can anybody please help me?
The library gmp is here:
fabio#canarino3:~/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid$ grep gmp soplex-targets.cmake
INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libgmp.so;/usr/lib/x86_64-linux-gnu/libgmpxx.so;quadmath"
INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libgmp.so;/usr/lib/x86_64-linux-gnu/libgmpxx.so;quadmath"
I've built soplex from source, dowloaded from the scip webpage
Do you have an example of makefile in which soplex is linked?
MANY THANKS!!!!

Compiler not finding jpeg and png libraries

I have downloaded and installed this C++ package for plotting and visulisation https://github.com/alandefreitas/matplotplusplus. I have sussessfully linked to it in my CMake file and have no linking errors when including #include <matplot/matplot.h>. However, whenever I use any functions from the library matplot.h I get the following error at compilation.
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o): in function `cimg_library::CImg<unsigned char>::_cimg_jpeg_error_exit(jpeg_common_struct*)':
common.cpp:(.text._ZN12cimg_library4CImgIhE21_cimg_jpeg_error_exitEP18jpeg_common_struct[_ZN12cimg_library4CImgIhE21_cimg_jpeg_error_exitEP18jpeg_common_struct]+0x1e): undefined reference to `jpeg_destroy'
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o): in function `cimg_library::CImg<unsigned char>::_save_jpeg(_IO_FILE*, char const*, unsigned int) const':
common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x12b): undefined reference to `jpeg_std_error'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x152): undefined reference to `jpeg_CreateCompress'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x16d): undefined reference to `jpeg_stdio_dest'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x198): undefined reference to `jpeg_set_defaults'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x1b2): undefined reference to `jpeg_set_quality'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x1c6): undefined reference to `jpeg_start_compress'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x2cf): undefined reference to `jpeg_write_scanlines'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x2ed): undefined reference to `jpeg_finish_compress'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x302): undefined reference to `jpeg_destroy_compress'
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o): in function `cimg_library::CImg<unsigned char>::_save_png(_IO_FILE*, char const*, unsigned int) const':
common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x2f4): undefined reference to `png_create_write_struct'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x309): undefined reference to `png_create_info_struct'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x32b): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x34f): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x409): undefined reference to `png_init_io'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x474): undefined reference to `png_set_IHDR'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x485): undefined reference to `png_write_info'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0xc36): undefined reference to `png_write_image'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0xc43): undefined reference to `png_write_end'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0xc50): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: common.cpp:(.text._ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE9_save_pngEP8_IO_FILEPKcj]+0x1830): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o): in function `cimg_library::CImg<unsigned char>::save_cimg(char const*, bool) const':
common.cpp:(.text._ZNK12cimg_library4CImgIhE9save_cimgEPKcb[_ZNK12cimg_library4CImgIhE9save_cimgEPKcb]+0x3bb): undefined reference to `compress'
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o): in function `cimg_library::CImg<unsigned char>::_load_png(_IO_FILE*, char const*, unsigned int*)':
common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x88): undefined reference to `png_sig_cmp'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0xa2): undefined reference to `png_create_read_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0xb7): undefined reference to `png_create_info_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0xcd): undefined reference to `png_create_info_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0xef): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x14a): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x1c9): undefined reference to `png_init_io'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x1d7): undefined reference to `png_set_sig_bytes'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x1e4): undefined reference to `png_read_info'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x20e): undefined reference to `png_get_IHDR'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x252): undefined reference to `png_get_valid'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x280): undefined reference to `png_set_filler'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x28d): undefined reference to `png_read_update_info'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x2c2): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x369): undefined reference to `png_set_expand_gray_1_2_4_to_8'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x389): undefined reference to `png_set_gray_to_rgb'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x3a9): undefined reference to `png_set_tRNS_to_alpha'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x41f): undefined reference to `png_read_image'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x42c): undefined reference to `png_read_end'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x461): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x4f1): undefined reference to `png_set_palette_to_rgb'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x683): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x84a): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj[_ZN12cimg_library4CImgIhE9_load_pngEP8_IO_FILEPKcPj]+0x9d3): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o): in function `cimg_library::CImgList<unsigned char>::_load_cimg(_IO_FILE*, char const*)':
common.cpp:(.text._ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc[_ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc]+0x404): undefined reference to `uncompress'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc[_ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc]+0x70c): undefined reference to `uncompress'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc[_ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc]+0x93b): undefined reference to `uncompress'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc[_ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc]+0xce5): undefined reference to `uncompress'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc[_ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc]+0x10f7): undefined reference to `uncompress'
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o):common.cpp:(.text._ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc[_ZN12cimg_library8CImgListIhE10_load_cimgEP8_IO_FILEPKc]+0x1506): more undefined references to `uncompress' follow
/usr/bin/ld: /usr/local/lib/libmatplot.a(common.cpp.o): in function `cimg_library::CImg<unsigned char>::_load_jpeg(_IO_FILE*, char const*)':
common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x67): undefined reference to `jpeg_std_error'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0xb3): undefined reference to `jpeg_CreateDecompress'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0xc5): undefined reference to `jpeg_stdio_src'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0xd2): undefined reference to `jpeg_read_header'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0xda): undefined reference to `jpeg_start_decompress'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x1f8): undefined reference to `jpeg_read_scanlines'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x278): undefined reference to `jpeg_finish_decompress'
/usr/bin/ld: common.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x284): undefined reference to `jpeg_destroy_decompress'
/usr/bin/ld: /usr/local/lib/libmatplot.a(network.cpp.o): in function `matplot::network::process_force_layout()':
network.cpp:(.text+0x304e): undefined reference to `nodesoup::size_radiuses(std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, double, double)'
/usr/bin/ld: network.cpp:(.text+0x312a): undefined reference to `nodesoup::fruchterman_reingold(std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, unsigned int, unsigned int, unsigned int, double, std::function<void (std::vector<nodesoup::Point2D, std::allocator<nodesoup::Point2D> > const&, int)>)'
/usr/bin/ld: /usr/local/lib/libmatplot.a(network.cpp.o): in function `matplot::network::process_kawai_layout()':
network.cpp:(.text+0x3842): undefined reference to `nodesoup::size_radiuses(std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, double, double)'
/usr/bin/ld: network.cpp:(.text+0x390c): undefined reference to `nodesoup::kamada_kawai(std::vector<std::vector<unsigned long, std::allocator<unsigned long> >, std::allocator<std::vector<unsigned long, std::allocator<unsigned long> > > > const&, unsigned int, unsigned int, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/example.dir/build.make:84: example] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/example.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
The errors are plenty, but they are all of the form undefined reference to png_... or undefined reference to jpeg_... except for those that are undefined reference to 'uncompress'. It seems as though CMake is not finding png and jpeg. I definitely do have libjpeg and libpng installed. Why are these errors ocurring? Do I need to add lines to my CMakeLists.txt to find jpeg and png? I am running Ubuntu 20.04, g++ 9.3.0, and cmake 3.16.3.
Here is a very simple example that prodces the error. This is the cmake file
cmake_minimum_required(VERSION 3.10)
project(example)
set(CMAKE_CXX_COMPILER "c++")
find_package(Matplot++)
add_executable(example example.cpp)
target_link_libraries(example PUBLIC matplot)
Here is an example c++ code (pulled directly from the examples on the linked site).
#include <cmath>
#include <matplot/matplot.h>
int main() {
using namespace matplot;
std::vector<double> x = linspace(0, 10, 150);
std::vector<double> y = transform(x, [](auto x) { return cos(5 * x); });
plot(x, y)->color({0, 0.7, 0.9});
title("2-D Line Plot");
xlabel("x");
ylabel("cos(5x)");
show();
return 0;
}
I had the same problem (with Windows MinGW). Thanks to #drescherjm hint (add the option -DBUILD_SHARED_LIBS=ON), these are the steps I used to solve the problem:
git clone http://github.com/alandefreitas/matplotplusplus
cd matplotplusplus/
mkdir compil-release && cd compil-release
rm CMakeCache.txt # if already exists
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="${YOUR_LIB_PATH}/matplot1.0.1"
make -j4 && make install
Then, and I guess that is a bug, I had to manually copy the .dll to the install path
cp source/matplot/libmatplot.dll ${YOUR_LIB_PATH}/matplot1.0.1/lib/
Hope this works for you.