assimp cmake mingw-w64 VSCode win10 - opengl

UPDATE
later version of assimp (5.2.5) can be successfully built by mingw-w64 (gcc version 12.2.0) by disabling ASSIMP_WARNING_AS_ERROR.
However, it cannot load .obj model (the model doesn't show in the opengl scene) previously loaded by msvc built assimp.
Assimp 5.2.5 compiled by cmake-gui and mingw-w64 faild to load .obj model in opengl rendering
UPDATE: the developer of assimp has confirmed the bug and planned to fix it by adding this to ToDo in Planning for Release V5.1 on 26 May.
https://github.com/assimp/assimp/issues/3221
I'm trying to use assimp in opengl, following building instructions here: https://github.com/assimp/assimp/blob/master/Build.md under the following environment:
assimp 5.0.1
cmake 3.17.2
mingw-w64 with gcc/g++ 8.1.0
VSCode in Win10
I tried in cmake-gui, use MinGW Makefile , I can obtain a makefile in the build path.
I then tried to make it by mingw32-make and stopped at 69% with
[ 67%] Linking CXX shared library libassimp.dll
[ 67%] Built target assimp
Scanning dependencies of target assimp_cmd
[ 67%] Building RC object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/assimp_cmd.rc.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/CompareDump.cpp.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/ImageExtractor.cpp.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/Main.cpp.obj
[ 68%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/WriteDumb.cpp.obj
[ 69%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/Info.cpp.obj
[ 69%] Building CXX object tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/Export.cpp.obj
[ 69%] Linking CXX executable assimp.exe
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x8d): undefined reference to `Assimp::Importer::ValidateFlags(unsigned int) const'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0xc4): undefined reference to `Assimp::Importer::ReadFile(char const*, unsigned int)'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x14e): undefined reference to `Assimp::DefaultLogger::create(char const*, Assimp::Logger::LogSeverity, unsigned int, Assimp::IOSystem*)'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x183): undefined reference to `Assimp::DefaultLogger::kill()'
CMakeFiles\assimp_cmd.dir/objects.a(Main.cpp.obj):Main.cpp:(.text+0x1b8): undefined reference to `Assimp::Importer::GetErrorString() const'
......
......
......
CMakeFiles\assimp_cmd.dir/objects.a(Export.cpp.obj):Export.cpp:(.text+0xf44): undefined reference to `Assimp::Exporter::GetExportFormatDescription(unsigned long long) const'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [tools\assimp_cmd\CMakeFiles\assimp_cmd.dir\build.make:197: tools/assimp_cmd/assimp.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:297: tools/assimp_cmd/CMakeFiles/assimp_cmd.dir/all] Error 2
mingw32-make: *** [Makefile:149: all] Error 2
Though I can get a "libassimp.dll" and a "libassimp.dll.a" in the build directory, I failed to link them into my project. there are many "undefined reference to xxxx" errors.
I placed the .dll in the exe path, placed .a file in lib path, placed all the assimp .h files in the include path.
VSCode doesn't seem to support the file name "libassimp.dll.a", I have to rename it as libassimpdll.a and write "-lassimp" in tasks.json. But "undefined reference" errors exists.
I tried to build assimp to VS2017 and I can get dll and lib.
I tried to directly link the assimp 3.1.1 (with x86/x64 dll and lib already provided officially) but also failed.
So my question is if anyone succeed in building assimp with cmake and mingw-w64 and link it in the project in VSCode Win10?

I am able to build assimp 5.0.1 with:
cmake.exe -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=OFF -DASSIMP_HEADERCHECK:BOOL=OFF -DASSIMP_OPT_BUILD_PACKAGES:BOOL=OFF -DSYSTEM_IRRXML:BOOL=OFF -DASSIMP_BUILD_SAMPLES:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DASSIMP_BUILD_TESTS:BOOL=OFF -S. -Bbuild_win &&
make -Cbuild_win &&
echo Success
and even the same with -DBUILD_SHARED_LIBS:BOOL=ON under the MSYS2 shell.
It doesn't work with -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=ON though.

Related

Undefined reference errors when building fast map matching (FMM) tool with MinGW-w64

I am trying to build the fast map matching (FMM) tool on Windows using this documentation. The documentation talks about using Cygwin, but I chose to use MSYS2. Here are the details on what I have done so far:
Download Rtools42 for Windows from here and install it (I am using Rtools42 because I am creating an R package that provides an R wrapper for the FMM tool),
Search for Rtools42 bash shell using Windows startup menu and launch it,
Update MSYS2 by typing pacman -Syu in the shell (relaunch the shell if it's closed),
Type pacman -S msys2-keyring in the shell to avoid invalid signature and corrupt database errors,
Install additional dependencies by typing the following command in the shell: pacman -Sy mingw-w64-x86_64-gcc mingw-w64-x86_64-openmp mingw-w64-x86_64-cmake mingw-w64-x86_64-gdal mingw-w64-x86_64-boost mingw-w64-x86_64-swig mingw-w64-x86_64-python mingw-w64-x86_64-make,
Launch MinGW64 shell: C:\rtools42\mingw64.exe,
Create a directory called fmm & make it the current working directory: mkdir fmm && cd fmm,
Clone git repo into the fmm directory: git clone https://github.com/cyang-kth/fmm.git .,
Edit line 30 of fmm/CMakeLists.txt: set(CMAKE_CXX_STANDARD 14) (14 instead of 11; this change is needed for compatibility with the latest version of boost),
Create a new directory called build under fmm and make it the current working directory: mkdir build && cd build,
Create the makefile using cmake: cmake -G "MSYS Makefiles" ..,
Execute the makefile: mingw32-make -j8
The execution of makefile (without the j8 option) produces the following error:
$ mingw32-make
-- CMAKE version 3.25.2
-- Set CMP0074 state to NEW
-- Set CMP0086 state to NEW
-- Set CMP0078 state to NEW
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/rtools42/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/rtools42/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
No conda environment found in PATH!
PATH=C:\rtools42\mingw64\bin;C:\rtools42\usr\local\bin;C:\rtools42\usr\bin;C:\rtools42\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\progra~1\git\cmd;C:\rtools42\usr\bin\site_perl;C:\rtools42\usr\bin\vendor_perl;C:\rtools42\usr\bin\core_perl
-- Could NOT find Conda (missing: CONDA_PREFIX)
-- Non conda exist, search library in default path
-- GDAL headers found at C:/rtools42/mingw64/include
-- GDAL library found at C:/rtools42/mingw64/lib/libgdal.dll.a
-- Boost headers found at C:/rtools42/mingw64/include
-- Boost library found at Boost::serialization;Boost::exception
-- Boost library version 1_81
-- OpenMP_HEADERS found at
-- OpenMP_CXX_LIBRARIES found at C:/rtools42/mingw64/lib/libgomp.dll.a;C:/rtools42/mingw64/lib/libmingwthrd.a;C:/rtools42/mingw64/lib/libmingwthrd.a
-- Installation folder C:/Program Files (x86)/fmm
-- Not install fmm headers
-- Add python cmake information
-- Swig version is 4.1.1
-- Python header found at C:/rtools42/mingw64/include/python3.10
-- Python library found at C:/rtools42/mingw64/lib/libpython3.10.dll.a
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
-- Python packages C:/rtools42/mingw64/lib/python3.10/site-packages
-- Using swig add library
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/ashir/Documents/testing/fmm/fmm/build
[ 1%] Built target CORE
[ 3%] Built target ALGORITHM
[ 9%] Built target CONFIG
[ 13%] Built target IO
[ 15%] Built target UTIL
[ 23%] Built target NETWORK
[ 26%] Built target MM_OBJ
[ 40%] Built target FMM_OBJ
[ 46%] Built target STMATCH_OBJ
[ 76%] Built target H3_OBJ
[ 78%] Built target FMMLIB
[ 80%] Linking CXX executable fmm.exe
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x26): undefined reference to `FMM::MM::FMMAppConfig::FMMAppConfig(int, char**)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x3c): undefined reference to `FMM::MM::FMMAppConfig::validate() const'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x88): undefined reference to `FMM::NETWORK::Network::Network(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&, 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&)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x9b): undefined reference to `FMM::NETWORK::NetworkGraph::NetworkGraph(FMM::NETWORK::Network const&)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0xba): undefined reference to `FMM::MM::UBODT::read_ubodt_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0xc7): undefined reference to `FMM::MM::FMMApp::run()'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0xd9): undefined reference to `FMM::MM::FMMAppConfig::print_help()'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles/fmm.dir/build.make:108: fmm.exe] Error 1
mingw32-make[1]: *** [CMakeFiles/Makefile2:425: CMakeFiles/fmm.dir/all] Error 2
mingw32-make: *** [Makefile:136: all] Error 2
How can I fix this?
Update (2023-01-29)
#Milan Š. asked me to edit CMakeLists.txt to include: message(STATUS ${FMMGlob}) and message(STATUS "EMPTY_LINE") message(STATUS ${NETWORK}) before the line add_executable(fmm src/app/fmm.cpp) and re-run cmake/make. Here's the output of running cmake:
$ cmake -G "MSYS Makefiles" ..
-- CMAKE version 3.25.2
-- Set CMP0074 state to NEW
-- Set CMP0086 state to NEW
-- Set CMP0078 state to NEW
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/rtools42/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/rtools42/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
No conda environment found in PATH!
PATH=C:\rtools42\mingw64\bin;C:\rtools42\usr\local\bin;C:\rtools42\usr\bin;C:\rtools42\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\progra~1\git\cmd;C:\rtools42\usr\bin\site_perl;C:\rtools42\usr\bin\vendor_perl;C:\rtools42\usr\bin\core_perl
-- Could NOT find Conda (missing: CONDA_PREFIX)
-- Non conda exist, search library in default path
-- Found GDAL: C:/rtools42/mingw64/lib/libgdal.dll.a (found suitable version "3.6.2", minimum required is "2.2")
-- GDAL headers found at C:/rtools42/mingw64/include
-- GDAL library found at C:/rtools42/mingw64/lib/libgdal.dll.a
-- Found Boost: C:/rtools42/mingw64/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.56.0") found components: serialization exception
-- Boost headers found at C:/rtools42/mingw64/include
-- Boost library found at Boost::serialization;Boost::exception
-- Boost library version 1_81
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- OpenMP_HEADERS found at
-- OpenMP_CXX_LIBRARIES found at C:/rtools42/mingw64/lib/libgomp.dll.a;C:/rtools42/mingw64/lib/libmingwthrd.a;C:/rtools42/mingw64/lib/libmingwthrd.a
-- C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/fmm_algorithm.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/fmm_app.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/fmm_app_config.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt_gen_algorithm.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt_gen_app.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt_gen_app_config.cpp
-- EMPTY_LINE
--
-- Installation folder C:/Program Files (x86)/fmm
-- Not install fmm headers
-- Add python cmake information
-- Found SWIG: C:/rtools42/mingw64/bin/swig.exe (found version "4.1.1")
-- Swig version is 4.1.1
-- Found PythonInterp: C:/rtools42/mingw64/bin/python.exe (found version "3.10.9")
-- Found PythonLibs: C:/rtools42/mingw64/lib/libpython3.10.dll.a (found version "3.10.9")
-- Python header found at C:/rtools42/mingw64/include/python3.10
-- Python library found at C:/rtools42/mingw64/lib/libpython3.10.dll.a
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
-- Python packages C:/rtools42/mingw64/lib/python3.10/site-packages
-- Using swig add library
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/ashir/Documents/testing/fmm/fmm/build
And the output of running make (output is trimmed to not exceed SO's 30,000 characters limit):
$ mingw32-make
[ 34%] Building CXX object CMakeFiles/FMM_OBJ.dir/src/mm/fmm/ubodt.cpp.obj
[ 36%] Building CXX object CMakeFiles/FMM_OBJ.dir/src/mm/fmm/ubodt_gen_algorithm.cpp.obj
In file included from C:/rtools42/mingw64/include/boost/geometry/core/config.hpp:16,
from C:/rtools42/mingw64/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp:27,
from C:/rtools42/mingw64/include/boost/geometry/strategies/strategies.hpp:137,
from C:/rtools42/mingw64/include/boost/geometry/geometry.hpp:57,
from C:/rtools42/mingw64/include/boost/geometry.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/core/geometry.hpp:15,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/type.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/network.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt_gen_algorithm.hpp:14,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt_gen_algorithm.cpp:5:
C:/rtools42/mingw64/include/boost/function_output_iterator.hpp:14:1: note: '#pragma message: This header is deprecated. Use <boost/iterator/function_output_iterator.hpp> instead.'
14 | BOOST_HEADER_DEPRECATED("<boost/iterator/function_output_iterator.hpp>")
| ^~~~~~~~~~~~~~~~~~~~~~~
[ 38%] Building CXX object CMakeFiles/FMM_OBJ.dir/src/mm/fmm/ubodt_gen_app.cpp.obj
In file included from C:/rtools42/mingw64/include/boost/geometry/core/config.hpp:16,
from C:/rtools42/mingw64/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp:27,
from C:/rtools42/mingw64/include/boost/geometry/strategies/strategies.hpp:137,
from C:/rtools42/mingw64/include/boost/geometry/geometry.hpp:57,
from C:/rtools42/mingw64/include/boost/geometry.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/core/geometry.hpp:15,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/type.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/network.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt_gen_app.hpp:14,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/ubodt_gen_app.cpp:5:
C:/rtools42/mingw64/include/boost/function_output_iterator.hpp:14:1: note: '#pragma message: This header is deprecated. Use <boost/iterator/function_output_iterator.hpp> instead.'
14 | BOOST_HEADER_DEPRECATED("<boost/iterator/function_output_iterator.hpp>")
| ^~~~~~~~~~~~~~~~~~~~~~~
[ 40%] Building CXX object CMakeFiles/FMM_OBJ.dir/src/mm/fmm/ubodt_gen_app_config.cpp.obj
[ 40%] Built target FMM_OBJ
[ 42%] Building CXX object CMakeFiles/STMATCH_OBJ.dir/src/mm/stmatch/stmatch_algorithm.cpp.obj
In file included from C:/rtools42/mingw64/include/boost/geometry/core/config.hpp:16,
from C:/rtools42/mingw64/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp:27,
from C:/rtools42/mingw64/include/boost/geometry/strategies/strategies.hpp:137,
from C:/rtools42/mingw64/include/boost/geometry/geometry.hpp:57,
from C:/rtools42/mingw64/include/boost/geometry.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/core/geometry.hpp:15,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/type.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/network.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_algorithm.hpp:12,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_algorithm.cpp:1:
C:/rtools42/mingw64/include/boost/function_output_iterator.hpp:14:1: note: '#pragma message: This header is deprecated. Use <boost/iterator/function_output_iterator.hpp> instead.'
14 | BOOST_HEADER_DEPRECATED("<boost/iterator/function_output_iterator.hpp>")
| ^~~~~~~~~~~~~~~~~~~~~~~
[ 44%] Building CXX object CMakeFiles/STMATCH_OBJ.dir/src/mm/stmatch/stmatch_app.cpp.obj
In file included from C:/rtools42/mingw64/include/boost/geometry/core/config.hpp:16,
from C:/rtools42/mingw64/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp:27,
from C:/rtools42/mingw64/include/boost/geometry/strategies/strategies.hpp:137,
from C:/rtools42/mingw64/include/boost/geometry/geometry.hpp:57,
from C:/rtools42/mingw64/include/boost/geometry.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/core/geometry.hpp:15,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/type.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/network.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_algorithm.hpp:12,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_app_config.hpp:16,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_app.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_app.cpp:5:
C:/rtools42/mingw64/include/boost/function_output_iterator.hpp:14:1: note: '#pragma message: This header is deprecated. Use <boost/iterator/function_output_iterator.hpp> instead.'
14 | BOOST_HEADER_DEPRECATED("<boost/iterator/function_output_iterator.hpp>")
| ^~~~~~~~~~~~~~~~~~~~~~~
[ 46%] Building CXX object CMakeFiles/STMATCH_OBJ.dir/src/mm/stmatch/stmatch_app_config.cpp.obj
In file included from C:/rtools42/mingw64/include/boost/geometry/core/config.hpp:16,
from C:/rtools42/mingw64/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp:27,
from C:/rtools42/mingw64/include/boost/geometry/strategies/strategies.hpp:137,
from C:/rtools42/mingw64/include/boost/geometry/geometry.hpp:57,
from C:/rtools42/mingw64/include/boost/geometry.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/core/geometry.hpp:15,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/type.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/network.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_algorithm.hpp:12,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_app_config.hpp:16,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/stmatch/stmatch_app_config.cpp:5:
C:/rtools42/mingw64/include/boost/function_output_iterator.hpp:14:1: note: '#pragma message: This header is deprecated. Use <boost/iterator/function_output_iterator.hpp> instead.'
14 | BOOST_HEADER_DEPRECATED("<boost/iterator/function_output_iterator.hpp>")
| ^~~~~~~~~~~~~~~~~~~~~~~
[ 46%] Built target STMATCH_OBJ
[ 48%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/algos.c.obj
[ 50%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/baseCells.c.obj
[ 51%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/bbox.c.obj
[ 53%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/coordijk.c.obj
[ 55%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/faceijk.c.obj
[ 57%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/geoCoord.c.obj
[ 59%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/h3Index.c.obj
[ 61%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/h3UniEdge.c.obj
[ 63%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/linkedGeo.c.obj
[ 65%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/localij.c.obj
[ 67%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/mathExtensions.c.obj
[ 69%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/polygon.c.obj
[ 71%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/vec2d.c.obj
[ 73%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/vec3d.c.obj
[ 75%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/vertex.c.obj
[ 76%] Building C object CMakeFiles/H3_OBJ.dir/third_party/h3/lib/vertexGraph.c.obj
[ 76%] Built target H3_OBJ
[ 78%] Linking CXX shared library libFMMLIB.dll
[ 78%] Built target FMMLIB
[ 80%] Building CXX object CMakeFiles/fmm.dir/src/app/fmm.cpp.obj
In file included from C:/rtools42/mingw64/include/boost/geometry/core/config.hpp:16,
from C:/rtools42/mingw64/include/boost/geometry/strategy/cartesian/side_by_triangle.hpp:27,
from C:/rtools42/mingw64/include/boost/geometry/strategies/strategies.hpp:137,
from C:/rtools42/mingw64/include/boost/geometry/geometry.hpp:57,
from C:/rtools42/mingw64/include/boost/geometry.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/core/geometry.hpp:15,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/type.hpp:17,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/network/network.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/fmm_algorithm.hpp:13,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/fmm_app_config.hpp:16,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/mm/fmm/fmm_app.hpp:14,
from C:/Users/ashir/Documents/testing/fmm/fmm/src/app/fmm.cpp:10:
C:/rtools42/mingw64/include/boost/function_output_iterator.hpp:14:1: note: '#pragma message: This header is deprecated. Use <boost/iterator/function_output_iterator.hpp> instead.'
14 | BOOST_HEADER_DEPRECATED("<boost/iterator/function_output_iterator.hpp>")
| ^~~~~~~~~~~~~~~~~~~~~~~
[ 82%] Linking CXX executable fmm.exe
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x26): undefined reference to `FMM::MM::FMMAppConfig::FMMAppConfig(int, char**)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x3c): undefined reference to `FMM::MM::FMMAppConfig::validate() const'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x88): undefined reference to `FMM::NETWORK::Network::Network(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&, 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&)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0x9b): undefined reference to `FMM::NETWORK::NetworkGraph::NetworkGraph(FMM::NETWORK::Network const&)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0xba): undefined reference to `FMM::MM::UBODT::read_ubodt_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0xc7): undefined reference to `FMM::MM::FMMApp::run()'
C:/rtools42/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/fmm.dir/objects.a(fmm.cpp.obj):fmm.cpp:(.text.startup+0xd9): undefined reference to `FMM::MM::FMMAppConfig::print_help()'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles/fmm.dir/build.make:108: fmm.exe] Error 1
mingw32-make[1]: *** [CMakeFiles/Makefile2:425: CMakeFiles/fmm.dir/all] Error 2
mingw32-make: *** [Makefile:136: all] Error 2
Update (2023-02-05)
#Milan Š. actually meant to add ${NetworkGlob} instead of ${NETWORK} to CMakeLists.txt. The output of cmake changed slightly (only showing the diff and the context rows):
...
-- EMPTY_LINE
-- C:/Users/ashir/Documents/testing/fmm/fmm/src/network/bidirectional_network_graph.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/network/network.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/network/network_graph.cppC:/Users/ashir/Documents/testing/fmm/fmm/src/network/rtree.cpp
-- Installation folder C:/Program Files (x86)/fmm
...
The output of running make is unchanged.

Error building and linking OpenCV when built with LLVM and mingw under windows

I cannot build OpenCV under windows with llvm(From www.llvm.org)
and Mingw(from https://github.com/niXman/mingw-builds-binaries/releases).
While everything seems to build
correctly, it fails to link and the whole compilation stops as follows:
[ 9%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/split.avx2.cpp.obj
[ 9%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/sum.avx2.cpp.obj
[ 9%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/matmul.avx512_skx.cpp.obj
[ 9%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
[ 9%] Linking CXX shared library ..\..\bin\libopencv_core460.dll
There are tons of messages that indicate that I cannot link to pthread
C:\Users\akar\bin\mingw\mingw64\bin\ld.exe: CMakeFiles\opencv_core.dir/objects.a(system.cpp.obj):system.cpp:(.text$_ZN2cv5errorERKNS_9ExceptionE[_ZN2cv5errorERKNS_9ExceptionE]+0x34): undefined reference to `pthread_mutex_lock'
C:\Users\akar\bin\mingw\mingw64\bin\ld.exe: CMakeFiles\opencv_core.dir/objects.a(system.cpp.obj):system.cpp:(.text$_ZN2cv5errorERKNS_9ExceptionE[_ZN2cv5errorERKNS_9ExceptionE]+0xc5): undefined reference to `pthread_mutex_unlock'
C:\Users\akar\bin\mingw\mingw64\bin\ld.exe: CMakeFiles\opencv_core.dir/objects.a(system.cpp.obj):system.cpp:(.text$_ZN2cv5errorERKNS_9ExceptionE[_ZN2cv5errorERKNS_9ExceptionE]+0x176): undefined reference to `pthread_mutex_unlock'
From my bash environment I have defined the following:
export CC="clang.exe -target x86_64-pc-windows-gnu"
export CXX="clang++.exe -target x86_64-pc-windows-gnu"
export CMAKE_GENERATOR="MinGW Makefiles"
if I don't specify the -target argument in clang msvc builds correctly. If i try to cheat
the linker by setting
alias ld="ld -lpthread"
I get this nice error
C:/Users/akar/source/repos/opencv/modules/core/include\opencv2/core/utility.hpp:718:9: error: no type named 'recursive_mutex' in namespace 'std'; did you mean '__gnu_cxx::__recursive_mutex'?
typedef std::recursive_mutex Mutex;
^~~~~~~~~~~~~~~~~~~~
__gnu_cxx::__recursive_mutex
C:\Users\akar\bin\mingw\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0\include\c++\ext/concurrence.h:170:9: note: '__gnu_cxx::__recursive_mutex' declared here
class __recursive_mutex
^
1 error generated.

trying to update TWSAPI.. getting error on linking? is this the new intel lib?

I utilize a conan recipe to build the TWS-API in C++ .. and recently (4-10 months ago) IBKR pushed in a prebuilt library into the mix.. some intel lib..
I tried to fix all the code , refresh function definitions.. but on linking I am getting stuck
...
-- Library z found /home/emcp/.conan/data/zlib/1.2.12/_/_/package/dfbe50feef7f3c6223a476cd5aeadb687084a646/lib/libz.a
-- Library bz2 found /home/emcp/.conan/data/bzip2/1.0.8/_/_/package/c32092bf4d4bb47cf962af898e02823f499b017e/lib/libbz2.a
-- Library backtrace found /home/emcp/.conan/data/libbacktrace/cci.20210118/_/_/package/dfbe50feef7f3c6223a476cd5aeadb687084a646/lib/libbacktrace.a
-- Library ssl found /home/emcp/.conan/data/openssl/1.1.1o/_/_/package/dfbe50feef7f3c6223a476cd5aeadb687084a646/lib/libssl.a
-- Library crypto found /home/emcp/.conan/data/openssl/1.1.1o/_/_/package/dfbe50feef7f3c6223a476cd5aeadb687084a646/lib/libcrypto.a
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /home/emcp/git/build_cmake
-- Conan: Compiler GCC>=5, checking major version 11
-- Conan: Checking correct version: 11
-- Configuring done
-- Generating done
-- Build files have been written to: /home/emcp/Dev/git/build_cmake
[ 12%] Building CXX object CMakeFiles/ibrokers_server.dir/src/ibrokers_server.cpp.o
[ 25%] Building CXX object CMakeFiles/ibrokers_server.dir/src/gen-cpp/ibrokers.cpp.o
[ 37%] Building CXX object CMakeFiles/ibrokers_server.dir/src/gen-cpp/ibrokers_types.cpp.o
[ 50%] Building CXX object CMakeFiles/ibrokers_server.dir/src/tws-client/AccountSummaryTags.cpp.o
[ 62%] Building CXX object CMakeFiles/ibrokers_server.dir/src/tws-client/AvailableAlgoParams.cpp.o
[ 75%] Building CXX object CMakeFiles/ibrokers_server.dir/src/tws-client/TestCppClient.cpp.o
[ 87%] Building CXX object CMakeFiles/ibrokers_server.dir/src/tws-client/Utils.cpp.o
[100%] Linking CXX executable bin/ibrokers_server
/usr/bin/ld: CMakeFiles/ibrokers_server.dir/src/tws-client/TestCppClient.cpp.o: in function `decimalStringToDisplay[abi:cxx11](unsigned long long)':
TestCppClient.cpp:(.text._Z22decimalStringToDisplayB5cxx11y[_Z22decimalStringToDisplayB5cxx11y]+0x46): undefined reference to `__bid64_to_string'
/usr/bin/ld: /home/emcp/.conan/data/twsapi/10.17.01/stonks/prod/package/062863c92a5a0a247840166e9f84ebe8d10786b9/lib/libtwsapi.a(EClient.cpp.o): in function `void EClient::EncodeField<unsigned long long>(std::ostream&, unsigned long long)':
EClient.cpp:(.text+0x52e): undefined reference to `__bid64_to_string'
/usr/bin/ld: /home/emcp/.conan/data/twsapi/10.17.01/stonks/prod/package/062863c92a5a0a247840166e9f84ebe8d10786b9/lib/libtwsapi.a(EDecoder.cpp.o): in function `EDecoder::DecodeField(unsigned long long&, char const*&, char const*)':
EDecoder.cpp:(.text+0x803c): undefined reference to `__bid64_from_string'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/ibrokers_server.dir/build.make:247: bin/ibrokers_server] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/ibrokers_server.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
chmod: cannot access 'ibrokers_server': No such file or directory
Is there a way I can .. ensure or refresh my conan cache other than erase the build area and do
conan install .. --upgrade
?
according to this post https://github.com/InteractiveBrokers/tws-api/issues/1150#issuecomment-1215515313
we have a problem with the new intel code not linking properly.. this user was on Debian and was able to apt install the library.. and link it manually
sudo apt install libintelrdfpmath-dev
and in your linker.. add this module
bidgcc000

CMake linker cannot find library that does not begin with "lib"

I am using CMake to compile an application which uses the HSImage library on github. After installing with pip, the HSI library generates a shared library file, in my case it is created at /usr/src/HSI/HSI.cpython-36m-aarch64-linux-gnu.so
I am trying to link this library to my application with CMake, but the CMake find_library method is having some trouble finding the library. Here is the relevant part of my CMakeLists.txt file:
CMakeLists.txt
set(HSI_DIR /usr/src/HSI)
find_library(HSI_LIB HSI.cpython-36m-aarch64-linux-gnu PATHS ${HSI_DIR})
message(STATUS "HSI: ${HSI_LIB}") # outputs /usr/src/HSI/HSI.cpython-36m-aarch64-linux-gnu.so
add_executable(${TARGET_NAME} <sources...>)
target_link_directories(${TARGET_NAME} PUBLIC ${HSI_DIR})
target_link_libraries(${TARGET_NAME}
${HSI_LIB}
<other libs...>
-Wl,--unresolved-symbols=ignore-in-shared-libs
)
When building, this produces the following error message:
cd /home/nvidia/projects/HsiInference/build;/usr/local/bin/cmake --build "/home/nvidia/projects/HsiInference/build" --target hsi_inference_onnx -- ;
Scanning dependencies of target hsi_inference_onnx
[ 14%] Building CXX object CMakeFiles/hsi_inference_onnx.dir/targets/HsiInferenceOnnx/main_onnx.cpp.o
[ 28%] Building CXX object CMakeFiles/hsi_inference_onnx.dir/targets/HsiInferenceOnnx/HsiInferenceOnnx.cpp.o
[ 42%] Building CXX object CMakeFiles/hsi_inference_onnx.dir/src/ftpnano.cpp.o
[ 57%] Building CXX object CMakeFiles/hsi_inference_onnx.dir/src/getOptions.cpp.o
[ 71%] Building CXX object CMakeFiles/hsi_inference_onnx.dir/src/logger.cpp.o
[ 85%] Building CXX object CMakeFiles/hsi_inference_onnx.dir/src/utils.cpp.o
[100%] Linking CXX executable hsi_inference_onnx_debug
CMakeFiles/hsi_inference_onnx.dir/build.make:245: recipe for target 'hsi_inference_onnx_debug' failed
CMakeFiles/Makefile2:123: recipe for target 'CMakeFiles/hsi_inference_onnx.dir/all' failed
**/usr/bin/ld: cannot find -lHSI.cpython-36m-aarch64-linux-gnu**
**collect2: error: ld returned 1 exit status**
make[3]: *** [hsi_inference_onnx_debug] Error 1
make[2]: *** [CMakeFiles/hsi_inference_onnx.dir/all] Error 2
CMakeFiles/Makefile2:130: recipe for target 'CMakeFiles/hsi_inference_onnx.dir/rule' failed
make[1]: *** [CMakeFiles/hsi_inference_onnx.dir/rule] Error 2
Makefile:196: recipe for target 'hsi_inference_onnx' failed
make: *** [hsi_inference_onnx] Error 2
Build failed.
The important part:
/usr/bin/ld: cannot find -lHSI.cpython-36m-aarch64-linux-gnu
collect2: error: ld returned 1 exit status
From what I have gathered, target_link_libraries simply adds -l<library_name> to the link command, and -l<library_name> assumes that there is a file called lib<library_name>.so to link, which is not the case here. How can I get CMake to link the library properly despite the weird filename?
NOTE:
I am able to get the project to build by doing the following:
Delete the project's build directory to clear CMake caches
Rename the file or create a symbolic link to libhsi.so
Change CMakeLists.txt to find_library(HSI_LIB hsi PATHS ${HSI_DIR})
This changes the link command to -lhsi instead, which is able to find the renamed/soft-linked library file. HOWEVER, this is not ideal for me and the original question remains unanswered :)
For libraries with weird filename you should add : before the filename. Be careful, like mentioned in https://linux.die.net/man/1/ld : If namespec is of the form :filename, ld will search the library path for a file called filename, otherwise it will search the library path for a file called libnamespec.a (namespec is what comes after -l).
For your example you should replace ${HSI_LIB} in target_link_libraries by :${HSI_LIB}.so.

Cannot build opencv 2.4 on a 64 bit mac for C++ project in Xcode

After looking around a lot and trying every option I found on SO, I'm a little confused about how to get the OpenCV library for architecture x86_64 loaded on my Mac. Here's a little bit of background info:
The first folder contains the Android SDK. The second is the iPhone framework, which uses i386 and armv7 architectures.
Now, I want to create a simple "Hello World" C++ application in Xcode which needs the correct library for x86_64 architecture.
I've looked at this tutorial as well as others' posted steps as follows:
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make -j8
sudo make install
With all version (except OpenCV-2.4.6.1), the process fails at "make -j8". I get the same error every time:
Linking CXX shared library ../../lib/libopencv_core.dylib
Undefined symbols for architecture x86_64:
"___sincos_stret", referenced from:
cv::RotatedRect::points(cv::Point_<float>*) const in matrix.cpp.o
cv::RotatedRect::boundingRect() const in matrix.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]: *** [lib/libopencv_core.2.4.3.dylib] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 28%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfThreading.cpp.o
[ 28%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTileDescriptionAttribute.cpp.o
[ 28%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTiledInputFile.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTiledMisc.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTiledOutputFile.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTiledRgbaFile.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTileOffsets.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTimeCode.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfTimeCodeAttribute.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfVecAttribute.cpp.o
[ 29%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfVersion.cpp.o
[ 29%] [ 30%] Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfWav.cpp.o
Building CXX object 3rdparty/openexr/CMakeFiles/IlmImf.dir/IlmImf/ImfZipCompressor.cpp.o
Linking CXX static library ../lib/libIlmImf.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThread.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThreadMutex.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThreadSemaphore.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThreadSemaphorePosixCompat.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThread.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThreadMutex.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThreadSemaphore.cpp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../lib/libIlmImf.a(IlmThreadSemaphorePosixCompat.cpp.o) has no symbols
[ 30%] Built target IlmImf
make: *** [all] Error 2
pdls-mbp:build pdl$
With OpenCV-2.4.6.1, the process fails at "sudo make install" and I get the following error:
Linking CXX shared library ../../lib/libopencv_core.dylib
Undefined symbols for architecture x86_64:
"___sincos_stret", referenced from:
cv::RotatedRect::points(cv::Point_<float>*) const in matrix.cpp.o
cv::RotatedRect::boundingRect() const in matrix.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]: *** [lib/libopencv_core.2.4.6.dylib] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
Lucys-MacBook-Pro:build pdl$
When I installed OpenCV using Homebrew, opencv was installed in use/local/opt/opencv and I can see all of the dylib files under the lib folder:
All of this completely confuses me, because I think all I need is a .a library file, no?
I have found the dylib files that were installed with HomeBrew in /usr/local/Cellar/opencv/2.4.6.1/lib but when I try to choose frameworks and libraries to add, they do not show up in the list. Instead, this is all I see:
Aldo, been following this MacPorts tutorial.
Have you considered using macports? It has opencv 2.4.8 available.
So after installing macports, all that nonsense you've been through, is reduced to:
$ sudo port selfupdate
$ sudo port install opencv
if you want a variant or two, for example OpenCL and Python support, then that would be:
$ sudo port install opencv +opencl +python27
and the binaries/libraries/whatever will be installed into /opt/local/....