I've been trying to run make on the recent release of openCV (2.4.3) but I've been having problems. I've created a build folder in the openCV directory and ran the following commands:
cmake -G "Unix Makefiles" ..
make -js
I get the following error:
Linking CXX shared library ../../lib/libopencv_highgui.dylib
[ 35%] Building CXX object modules/video/CMakeFiles/opencv_video.dir/src/bgfg_gaussmix.cpp.o
Undefined symbols for architecture x86_64:
"_ModPlug_GetCurrentOrder", referenced from:
_modplug_read_packet in libavformat.a(libmodplug.o)
"_ModPlug_GetCurrentPattern", referenced from:
_modplug_read_packet in libavformat.a(libmodplug.o)
"_ModPlug_GetCurrentRow", referenced from:
_modplug_read_packet in libavformat.a(libmodplug.o)
"_ModPlug_GetCurrentSpeed", referenced from:
_modplug_read_packet in libavformat.a(libmodplug.o)
"_ModPlug_GetCurrentTempo", referenced from:
_modplug_read_packet in libavformat.a(libmodplug.o)
"_ModPlug_GetLength", referenced from:
_modplug_read_header in libavformat.a(libmodplug.o)
"_ModPlug_GetMessage", referenced from:
_modplug_read_header in libavformat.a(libmodplug.o)
"_ModPlug_GetName", referenced from:
_modplug_read_header in libavformat.a(libmodplug.o)
There's more but the rest of the message is the similar to that.
It looks like the linker is having a hard time with highgui.
I've received a similar error when I (somehow miraculously) had openCV installed previously (I deleted the former installation) when trying to run code using XCode
Any thoughts?
I don't know the cause of this particular problem. However, I found a workaround that works for my situation. I disabled ffmpeg and it seems to compile ok. I cleaned out my build directory and ran cmake with the option -DWITH_FFMPEG=OFF
Related
I am trying to build the pocl library on MacOS
System:
MBP 16" 2019
Intel i9, AMD Radeon 5500m
Mac OS 12.4
using bash, instead of zsh
llvm from home-brew, -version 14
I have the following in my .bash_profile to setup the build environment
export PATH=/usr/local/opt/llvm/bin:$PATH
export CC=clang
export CMAKE_C_COMPILER=clang
export CXX=clang++
export CMAKE_CXX_COMPILER=clang++
I go and clone the repo with git, cd into the source directory, mkdir build
Then in build/ run:
cmake .. -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF -DENABLE_ICD=OFF
The config seems to work and then when I run make everything builds, and gets to the end but then gives me the following error:
[100%] Linking C executable poclcc
clang-14: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
Undefined symbols for architecture x86_64:
"_clBuildProgram", referenced from:
_main in poclcc.c.o
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clCreateCommandQueue", referenced from:
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clCreateContext", referenced from:
_main in poclcc.c.o
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clCreateContextFromType", referenced from:
_poclu_create_any_context in libpoclu.a(misc.c.o)
"_clCreateProgramWithBinary", referenced from:
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clCreateProgramWithIL", referenced from:
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clCreateProgramWithSource", referenced from:
_main in poclcc.c.o
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clGetDeviceIDs", referenced from:
_main in poclcc.c.o
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clGetDeviceInfo", referenced from:
_main in poclcc.c.o
_poclu_load_program_multidev in libpoclu.a(misc.c.o)
"_clGetPlatformIDs", referenced from:
_main in poclcc.c.o
_poclu_create_any_context in libpoclu.a(misc.c.o)
_poclu_get_any_device2 in libpoclu.a(misc.c.o)
_poclu_get_multiple_devices in libpoclu.a(misc.c.o)
"_clGetProgramBuildInfo", referenced from:
_main in poclcc.c.o
_poclu_show_program_build_log in libpoclu.a(misc.c.o)
"_clGetProgramInfo", referenced from:
_main in poclcc.c.o
_poclu_show_program_build_log in libpoclu.a(misc.c.o)
"_clReleaseContext", referenced from:
_main in poclcc.c.o
"_clReleaseProgram", referenced from:
_main in poclcc.c.o
ld: symbol(s) not found for architecture x86_64
I checked and libOpenCL.dylib was successfully built in the pocl/build/lib/CL/ directory. Just as a check, I tried compiling clinfo with a direct link to this library and it gave me the same set of error messages shown above.
Running nm libOpenCL.dylib | grep clBuildProgram prints the following:
0000000000013850 t _clBuildProgram
So its in there, but it is a local text section symbol. I don't actually know what that means though, and if that means it should work, or should not work. I don't actually understand what the problem is here or why this linking is failing, or what to do about it. Looking for some guidance on that.
The meaning of the lower case t is that the symbols are local, i.e. not externally visible to linking programs. Upper case T would be externally visible.
POCL has a number of configuration options, not all of which are documented in the Build section of the docs. The VISIBILITY_HIDDEN option is on by default unless the ENABLE_PROXY option is on.
In build/, running:
cmake .. -DENABLE_ICD=OFF -DVISIBILITY_HIDDEN=OFF
and then:
make
the compile succeeds to the end. Then in build/lib/CL/ running:
nm libOpenCL.dylib | grep clBuildProgram
now prints:
0000000000013790 T _clBuildProgram
I am writing a test for a Biquad Filter class I have written in C++, and I am attempting to use to FFTWPP header to simplify the use of the FFTW library. I have successfully built and run the FFTWPP examples, so I can be sure that the FFTW3 library is successfully built and installed on my Mac (running OS Catalina 10.15.5 (19F101)).
I have managed to include the FFTW lib directory into the cmake project definitions, and I have added the appropriate include paths into the CMAKE file:
cmake_minimum_required(VERSION 3.16)
project(IIR)
set(CMAKE_CXX_STANDARD 14)
find_package(Python 3.7 COMPONENTS Development) # Used for MatplotlibPP
include_directories(.)
include_directories(./../../../fftwpp/)
include_directories(./../../../fftw-3.3.8/api/)
include_directories(./../../../matplotlib-cpp/) #Plotting
include_directories(./../../../AudioFile/) #AudiofileIO
include_directories(/usr/local/include) # contains includes for FFTW3
link_directories(.)
link_directories(/usr/local/lib)# contains binary for FFTW3
find_library(
fftw3
NAMES fftw lfftw3 libfftw3
HINTS /usr/local/lib
)
add_executable(IIR
Test_BiquadFilter.cpp)
target_link_libraries(IIR PUBLIC Python fftw3)
However, it appears the linker is failing to link the symbols through the FFTWPP header:
[100%] Linking CXX executable IIR
Undefined symbols for architecture x86_64:
"fftwpp::ThreadBase::ThreadBase()", referenced from:
fftwpp::fftw::fftw(unsigned int, int, unsigned int, unsigned int) in Test_BiquadFilter.cpp.o
"fftwpp::fftw::maxthreads", referenced from:
_main in Test_BiquadFilter.cpp.o
fftwpp::fftw::Setup(std::__1::complex<double>*, std::__1::complex<double>*) in Test_BiquadFilter.cpp.o
"fftwpp::fftw::testseconds", referenced from:
fftwpp::fftw::time(fftw_plan_s*, fftw_plan_s*, std::__1::complex<double>*, std::__1::complex<double>*, unsigned int) in Test_BiquadFilter.cpp.o
"fftwpp::fftw::effort", referenced from:
fftwpp::rcfft1d::Plan(std::__1::complex<double>*, std::__1::complex<double>*) in Test_BiquadFilter.cpp.o
fftwpp::crfft1d::Plan(std::__1::complex<double>*, std::__1::complex<double>*) in Test_BiquadFilter.cpp.o
"fftwpp::fftw::planner", referenced from:
fftwpp::fftw::Setup(std::__1::complex<double>*, std::__1::complex<double>*) in Test_BiquadFilter.cpp.o
"fftwpp::inout", referenced from:
fftwpp::fftw::Setout(std::__1::complex<double>*, std::__1::complex<double>*) in Test_BiquadFilter.cpp.o
"fftwpp::crfft1d::threadtable", referenced from:
fftwpp::crfft1d::lookup(bool, unsigned int) in Test_BiquadFilter.cpp.o
fftwpp::crfft1d::store(bool, fftwpp::threaddata const&) in Test_BiquadFilter.cpp.o
"fftwpp::rcfft1d::threadtable", referenced from:
fftwpp::rcfft1d::lookup(bool, unsigned int) in Test_BiquadFilter.cpp.o
fftwpp::rcfft1d::store(bool, fftwpp::threaddata const&) in Test_BiquadFilter.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)
Should I be linking the FFTW library against FFTWPP and be building that as its own library, and then link that library against my project?
I know I have probably added some extra parts to the Cmake project unnecessarily, but is my CMake configuration otherwise incorrect for another reason, when linking a library this way?
Many thanks,
The answer to my issues as kindly pointed out by a commenter to the original post, was that I was not linking against FFTWPP.
The solution in this was to add FFTWPP as a library to the project, and add that library to the list of target linked libraries.
link_directories(./../../../fftwpp/)
find_library(
fftw3
NAMES fftw lfftw3 libfftw3
HINTS /usr/local/lib
)
add_library(fftwpp STATIC ./../../../fftwpp/fftw++.cc)
add_executable(IIR
Test_BiquadFilter.cpp)
target_link_libraries(IIR PUBLIC Python fftw3 fftwpp)
I am working on a little software that needed a small server that listens to http requests. Unfortunately, the productive server uses https only, so the requests fail. I've search the web and found this example: http://www.boost.org/doc/libs/1_65_0/doc/html/boost_asio/example/cpp03/ssl/server.cpp
I tried my best to apply the required changes. But I can't compile it. I am on a MacOS machine, but the Server is a Ubuntu Server. I installed OpenSSL via brew.
The compilation fails at the linking process:
[ 98%] Linking CXX executable GpdServer
Undefined symbols for architecture x86_64:
"_ERR_remove_thread_state", referenced from:
boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.cpp.o
boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in TcpServer.cpp.o
boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in TcpConnection.cpp.o
"_TLSv1_1_client_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_1_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_1_server_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_2_client_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_2_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.cpp.o
"_TLSv1_2_server_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in TcpServer.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]: *** [GpdServer] Error 1
make[1]: *** [CMakeFiles/GpdServer.dir/all] Error 2
make: *** [all] Error 2
The TcpConnection files that cause this issue are here:
https://github.com/cwansart/gpd/blob/master/src/TcpServer.h
https://github.com/cwansart/gpd/blob/master/src/TcpServer.cpp
My build system is CMake. Including it works fine.
What am I doing wrong? How do I fix this?
As it turns out the macOS was the issue. I installed OpenSSL via brew. First, my CLion/CMake didn't find it, so I added an if to check if its an Apple PC. In that case I set the path manually to the path brew gave me. Now, for some reason the linking doesn't work.
On Linux with libssl-dev there are no issues.
So I'm trying to build a program using OpenGL and GLFW. The only errors I'm getting are:
Undefined symbols for architecture x86_64:
"_glewInit", referenced from:
_main in main.o
"_glfwCreateWindow", referenced from:
_main in main.o
"_glfwGetKey", referenced from:
_main in main.o
"_glfwInit", referenced from:
_main in main.o
"_glfwMakeContextCurrent", referenced from:
_main in main.o
"_glfwPollEvents", referenced from:
_main in main.o
"_glfwSetInputMode", referenced from:
_main in main.o
"_glfwSwapBuffers", referenced from:
_main in main.o
"_glfwTerminate", referenced from:
_main in main.o
"_glfwWindowHint", referenced from:
_main in main.o
"_glfwWindowShouldClose", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So obviously this is a linking error. After doing some research, I think I found my error. It seems like I need to add the GLFW library (libglfw.dylib) and the Cocoa and OpenGL libraries. My problem is that I can't find libglfw.dylib - or anything glfw for that matter - under the "Link Binary With Libraries" section. I found OpenGL.framework and Cocoa.framework, but I can't find the glfw one. I tried going through the whole cmake process (cmake > make > sudo make install) for glfw but it didn't show up. I then tried installing using brew and that didn't work either. I can't figure out why I can't find this file. Any ideas? This is my first time doing anything with GLFW and one of my first projects doing any coding on OSX. If I'm forgetting any information you need to help let me know and I'll get it to you all as fast as I can.
First of all, using GLEW on OS X is 100% pointless (OpenGL extensions are all handled statically at link-time on this platform). You should add some code to your project that does something along the lines of:
#ifndef __APPLE__
// GLEW-specific code here
#endif
Also, .dylib is for dynamically linking - there's not much point in doing that on OS X. GLFW is not distributed in the form of a Framework, you'll have to compile it yourself. You can still use a dynamic linking version of GLFW if you wish, but you'd wind up having to package the library in your .app bundle. I would advise you just use the static version and avoid all of that.
Have you reviewed the OS X section of the GLFW compilation instructions?
I'm trying to get up to speed using libcurl with D on Mac.
I'm using the latest dmd2 compiler (DMD64 D Compiler v2.062).
The following example compiles and works fine on Windows:
import std.net.curl, std.conv, std.stdio;
void main() {
string content = to!string(get("dlang.org"));
writeln(content);
}
When compiling it on Mac I get the following output:
~/src $ dmd dcurl.d
Undefined symbols for architecture x86_64:
"_curl_easy_cleanup", referenced from:
_D3std3net4curl4Curl8shutdownMFZv in libphobos2.a(curl_1522_37c.o)
"_curl_easy_duphandle", referenced from:
_D3std3net4curl4Curl3dupMFZS3std3net4curl4Curl in libphobos2.a(curl_151e_149.o)
"_curl_easy_init", referenced from:
_D3std3net4curl4Curl10initializeMFZv in libphobos2.a(curl_151d_432.o)
"_curl_easy_perform", referenced from:
_D3std3net4curl4Curl7performMFbZi in libphobos2.a(curl_1528_2fb.o)
"_curl_easy_setopt", referenced from:
_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionlZv in libphobos2.a(curl_1525_14c.o)
_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionAxaZv in libphobos2.a(curl_1524_14c.o)
_D3std3net4curl4Curl3setMFE3etc1c4curl10CurlOptionPvZv in libphobos2.a(curl_1526_14c.o)
_D3std3net4curl4Curl5clearMFE3etc1c4curl10CurlOptionZv in libphobos2.a(curl_1527_207.o)
"_curl_easy_strerror", referenced from:
_D3std3net4curl4Curl11errorStringMFiZAya in libphobos2.a(curl_1520_4a1.o)
"_curl_global_cleanup", referenced from:
_D3std3net4curl4Curl19_sharedStaticDtor29FZv in libphobos2.a(curl.o)
"_curl_global_init", referenced from:
_D3std3net4curl4Curl19_sharedStaticCtor28FZv in libphobos2.a(curl.o)
"_curl_slist_append", referenced from:
_D3std3net4curl3FTP3dupMFZS3std3net4curl3FTP in libphobos2.a(curl_1518_ea.o)
_D3std3net4curl3FTP10addCommandMFAxaZv in libphobos2.a(curl_1518_ea.o)
_D3std3net4curl4HTTP3dupMFZS3std3net4curl4HTTP in libphobos2.a(curl_1517_140.o)
_D3std3net4curl4HTTP16addRequestHeaderMFAxaAxaZv in libphobos2.a(curl_1517_140.o)
"_curl_slist_free_all", referenced from:
_D3std3net4curl3FTP4Impl6__dtorMFZv in libphobos2.a(curl_1518_ea.o)
_D3std3net4curl3FTP13clearCommandsMFZv in libphobos2.a(curl_1518_ea.o)
_D3std3net4curl4HTTP4Impl6__dtorMFZv in libphobos2.a(curl_1517_140.o)
_D3std3net4curl4HTTP19clearRequestHeadersMFZv in libphobos2.a(curl_1517_140.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
--- errorlevel 1
Which seems to imply a linking issue.
I have libcurl at:
/usr/lib/libcurl.3.dylib /usr/lib/libcurl.4.dylib /usr/lib/libcurl.dylib
But I'm not even sure whether dmd is trying to use them.
I've done this before with C/C++ (on the same machine using these libraries) so I think it must be a versioning issue or else I need to pass some flags to the compiler.
Any help would be most appreciated.
You need to link against libcurl. It's not linked against by default. So, instead of
dmd dcurl.d
you need to do
dmd -L-lcurl dcurl.d