I'm trying to install mydumper but the make step complains about undefine symbols. I've searched other questions where they talk about linking your object file to make sure the compiler can find the methods it needs. However this is just plain installation and I am not a C guy. Any pointer is highly appreciated. Here's the error I am seeing:
[ 16%] Linking C executable myloader
Undefined symbols for architecture x86_64:
"_CFRelease", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFStringGetCString", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFStringGetCStringPtr", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFStringGetLength", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFURLCopyFileSystemPath", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFURLCreateFromFSRef", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_FSFindFolder", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"std::terminate()", referenced from:
___clang_call_terminate in libmysqlclient.a(ssl.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[2]: *** [myloader] Error 1
make[1]: *** [CMakeFiles/myloader.dir/all] Error 2
make: *** [all] Error 2
Related
I have created a small C++ SDL2 project with CMake under macOS Big Sur (m1).
This is the CMakeLists.txt:
cmake_minimum_required(VERSION 3.22.2)
project(sdl2gamepad)
add_library(sdl2lib SHARED IMPORTED)
set_property(TARGET sdl2lib PROPERTY IMPORTED_LOCATION "/opt/homebrew/lib/libSDL2.dylib")
include_directories("/opt/homebrew/include")
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ${sdl2lib})
I installed SDL2 and CMake with homebrew.
The project was initially compiled and linked with the Makefile without problems and I was able to run it.
I then wanted to structure my project with an src and build folder and had adapted the CMakeLists.txt. Unfortunately, CMake/Make was no longer able to link the SDL2 lib.
Linking error message:
[ 50%] Linking CXX executable sdl2gamepad
Undefined symbols for architecture arm64:
"_SDL_CreateWindow", referenced from:
_main in main.cpp.o
"_SDL_DestroyWindow", referenced from:
_main in main.cpp.o
"_SDL_GetError", referenced from:
_main in main.cpp.o
"_SDL_GetWindowSurface", referenced from:
_main in main.cpp.o
"_SDL_Init", referenced from:
_main in main.cpp.o
"_SDL_LoadBMP_RW", referenced from:
_main in main.cpp.o
"_SDL_PollEvent", referenced from:
_main in main.cpp.o
"_SDL_Quit", referenced from:
_main in main.cpp.o
"_SDL_RWFromFile", referenced from:
_main in main.cpp.o
"_SDL_UpdateWindowSurface", referenced from:
_main in main.cpp.o
"_SDL_UpperBlit", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [sdl2gamepad] Error 1
make[1]: *** [CMakeFiles/sdl2gamepad.dir/all] Error 2
make: *** [all] Error 2
I then reset the CMakeLists.txt to the status where it had worked (code above). But unfortunately, the problem still exists.
But I can compile the code with this command, it is probably due to a CMake misconfiguration.
$ clang++ main.cpp -o main /opt/homebrew/lib/libSDL2.dylib -I /opt/homebrew/include
CMake Version is 3.22.2.
SDL2 Version is 2.0.20.
Many thanks for your help!
Introduction
I am trying to connect and interact with a mysql db running on my local, in a c++ project. I am also using cmake to compile my project.
Preparation
I installed mysqlconnector cpp by using mysql-connector-odbc-8.0.25-macos11-x86-64bit.dmg from their community downloads. I have the include and lib files available at /usr/local/mysql-connector-c+
CmakeLists.txt
Part of my CMakeLists.txt which deals with mysqlconnector is referenced below:
cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
set(FULL_PATH_TO_MYSQL_CONNECTOR_CPP_DIR "/usr/local/mysql-connector-c++")
include_directories(${FULL_PATH_TO_MYSQL_CONNECTOR_CPP_DIR}/include)
link_directories(${FULL_PATH_TO_MYSQL_CONNECTOR_CPP_DIR}/lib64)
add_executable(runservice main.cpp)
target_link_libraries(runservice mysqlcppconn)
The cmake command runs fine.
Build Error
When I try to build using '''make``` command, I get the following error :
Undefined symbols for architecture x86_64:
"mysqlx::abi2::r0::common::Value::print(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const", referenced from:
mysqlx::abi2::r0::Value::print(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.cpp.o
construction vtable for mysqlx::abi2::r0::common::Value-in-mysqlx::abi2::r0::Value in main.cpp.o
"typeinfo for mysqlx::abi2::r0::common::Value", referenced from:
construction vtable for mysqlx::abi2::r0::common::Value-in-mysqlx::abi2::r0::Value in main.cpp.o
typeinfo for mysqlx::abi2::r0::Value in main.cpp.o
"vtable for mysqlx::abi2::r0::DbDoc", referenced from:
mysqlx::abi2::r0::Value::~Value() in main.cpp.o
__GLOBAL__sub_I_main.cpp in main.cpp.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [runservice] Error 1
make[1]: *** [CMakeFiles/runservice.dir/all] Error 2
make: *** [all] Error 2
I can't understand this error or how to go about solving this.
Thank you for your precious time
I'm trying to use GRANSAC(Generic RANSAC) from this github repository. https://github.com/drsrinathsridhar/GRANSAC
When I build with cmake, this error happens and I don't know how to solve it.
Undefined symbols for architecture x86_64: "_omp_get_max_threads",
referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o
GRANSAC::RANSAC::RANSAC() in LineFittingSample.cpp.o "_omp_get_thread_num", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o "_omp_set_dynamic", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o "_omp_set_num_threads", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
1 (use -v to see invocation) make[2]: * [LineFittingSample] Error 1
make[1]: * [CMakeFiles/LineFittingSample.dir/all] Error 2 make: ***
[all]
Error 2
Environment: MacOS Mojave ver 10.14.16
I am trying to install zathura-pdf-poppler-0.2.5 on a Mac OS X running Yosemite. When I try and make, I get the following error:
LD pdf.so
Undefined symbols for architecture x86_64:
"_zathura_document_get_data", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_document_get_password", referenced from:
_pdf_document_open in document.o
"_zathura_document_get_path", referenced from:
_pdf_document_open in document.o
"_zathura_document_information_entry_list_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_information_entry_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_set_data", referenced from:
_pdf_document_open in document.o
_pdf_document_free in document.o
"_zathura_document_set_number_of_pages", referenced from:
_pdf_document_open in document.o
"_zathura_index_element_new", referenced from:
_pdf_document_index_generate in index.o
_build_index in index.o
"_zathura_link_free", referenced from:
_pdf_page_links_get in links.o
"_zathura_link_new", referenced from:
_poppler_link_to_zathura_link in utils.o
"_zathura_page_get_document", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_page_get_height", referenced from:
_pdf_page_links_get in links.o
_pdf_page_search_text in search.o
"_zathura_page_get_index", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_data", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_height", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_width", referenced from:
_pdf_page_init in page.o
"_zathura_plugin_add_mimetype", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_name", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_register_functions_function", referenced from:
_zathura_plugin_register in plugin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pdf.so] Error 1
I have the following path set in $PKG_CONFIG_PATH:
/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10
Does anyone know how to fix the problem.
Many thanks
I don't know the exact reason that this happens, but I have applied a patch to makefiles and config.mk from MacPort. You can download them in plaintext and use patch Makefile < make.diff and patch config.mk < config.diff to apply the patch.
patch files
I had to change /usr/lib/zathura/pdf.dylib to /usr/lib/zathura/pdf.so after the make install in order to make zathura display pdf files.
I've had issues in compiling DisplayImage.cpp, I've followed the tutorial here and to create a cmake file and generate executables, however, when I was compiling the problem with make it displays the following errors:
Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in DisplayImage.cpp.o
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in DisplayImage.cpp.o
"cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)", referenced from:
_main in DisplayImage.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [DisplayImage] Error 1
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
make: *** [all] Error 2
I am running MacOS could anyone please help!
Thanks
Try adding
#include <opencv2/highgui/highgui_c.h>
to the top of DisplayImage.cpp code. Then compile and execute again.
Hope it works! I just tried and verified it myself now.