Thank you
I used alternative codes, however, despite finding the boost, it gives me the following error:
– The C compiler identification is GNU 10.3.0
– The CXX compiler identification is GNU 10.3.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/msys64/mingw64/bin/gcc.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:/msys64/mingw64/bin/g++.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to find_package_handle_standard_args (Boost) does
not match the name of the calling package (BOOST). This can lead to
problems in calling code that expects find_package result variables
(e.g., _FOUND) to follow a certain pattern.
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args)
CMakeLists.txt:5 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
– Found Boost: C:/Program Files/boost_1_70_0/boost_1_70_0 (found version “1.70.0”)
– Configuring done
CMake Warning:
Value of Tensorflow_INCLUDE_DIRS contained a newline; truncating
CMake Error at CMakeLists.txt:14 (add_library):
Target “obj_loader” links to target “BOOST::filesystem” but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
– The C compiler identification is GNU 10.3.0
– The CXX compiler identification is GNU 10.3.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/msys64/mingw64/bin/gcc.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:/msys64/mingw64/bin/g++.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found Boost 1.70.0 at C:/Program Files/boost/lib/cmake/Boost-1.70.0
– Requested configuration: QUIET REQUIRED COMPONENTS filesystem
– Found boost_headers 1.70.0 at C:/Program Files/boost/lib/cmake/boost_headers-1.70.0
– Found boost_filesystem 1.70.0 at C:/Program Files/boost/lib/cmake/boost_filesystem-1.70.0
– No suitable boost_filesystem variant has been identified!
– libboost_filesystem-mgw103-mt-d-x32-1_70.a (32 bit, need 64)
– libboost_filesystem-mgw103-mt-d-x64-1_70.a (mgw103, detected mgw10, set Boost_COMPILER to override)
– libboost_filesystem-mgw103-mt-x32-1_70.a (32 bit, need 64)
– libboost_filesystem-mgw103-mt-x64-1_70.a (mgw103, detected mgw10, set Boost_COMPILER to override) CMake Error at C:/Program Files/boost/lib/cmake/Boost-1.70.0/BoostConfig.cmake:95 (find_package):
Found package configuration file:
It should be Boost, not BOOST. The find_package works because you’re on Windows and the case-insensitive file name behaviors make it work. However, CMake is case-sensitive and the targets it makes are named Boost::. Using the right casing will also resolve the warning about the case mismatch you received.
The output is saying that the Boost you have is not suitable. It found debug (the -d libraries) and release libraries. Of those, the 32bit ones are unsuitable (expected) and the x64 ones are built using MSVC which is not compatible with MinGW. You’ll need a Boost built with the MinGW toolchain.
Whoops, they are MinGW, just not the right version. They are MinGW 10.0 when you have 10.3. I think setting Boost_COMPILER to mgw10 might work?
I tested Boost_COMPILER with gcc and mingw / numbers 10 and 103.
Only error : - libboost_filesystem-mgw103-mt-d-x64-1_70.a (mgw103, detected mgw10, set Boost_COMPILER to override)
converted to - libboost_filesystem-mgw103-mt-x64-1_70.a (mgw103, Boost_COMPILER = gcc10).
I followed the error. Cannot set __boost_variants and __boost_configs in boost_filesystem-config.cmake. This probably goes back to the same issue you mentioned, but I have gcc (Rev5, Built by MSYS2 project) 10.3.0 installed on the system and I also installed boost 1.70 with the same gcc, so where does this mismatch come from?
Boost_filesystem-config.cmake
# Generated by Boost 1.70.0
if(TARGET Boost::filesystem)
return()
endif()
message(STATUS "Found boost_filesystem ${boost_filesystem_VERSION} at ${boost_filesystem_DIR}")
# Compute the include and library directories relative to this file.
get_filename_component(_BOOST_CMAKEDIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
get_filename_component(_BOOST_INCLUDEDIR "${_BOOST_CMAKEDIR}/../../include/boost-1_70/" ABSOLUTE)
get_filename_component(_BOOST_LIBDIR "${_BOOST_CMAKEDIR}/../" ABSOLUTE)
# Create imported target Boost::filesystem
add_library(Boost::filesystem UNKNOWN IMPORTED)
set_target_properties(Boost::filesystem PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_BOOST_INCLUDEDIR}"
INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB"
)
include(${CMAKE_CURRENT_LIST_DIR}/../BoostDetectToolset-1.70.0.cmake)
if(Boost_DEBUG)
message(STATUS "Scanning ${CMAKE_CURRENT_LIST_DIR}/libboost_filesystem-variant*.cmake")
endif()
file(GLOB __boost_variants "${CMAKE_CURRENT_LIST_DIR}/libboost_filesystem-variant*.cmake")
macro(_BOOST_SKIPPED fname reason)
if(Boost_DEBUG)
message(STATUS " ... skipped ${fname} (${reason})")
endif()
list(APPEND __boost_skipped "${fname} (${reason})")
endmacro()
foreach(f IN LISTS __boost_variants)
if(Boost_DEBUG)
message(STATUS " Including ${f}")
endif()
include(${f})
endforeach()
unset(_BOOST_LIBDIR)
unset(_BOOST_INCLUDEDIR)
unset(_BOOST_CMAKEDIR)
get_target_property(__boost_configs Boost::filesystem IMPORTED_CONFIGURATIONS)
if(__boost_variants AND NOT __boost_configs)
message(STATUS "No suitable boost_filesystem variant has been identified!")
if(NOT Boost_DEBUG)
foreach(s IN LISTS __boost_skipped)
message(STATUS " ${s}")
endforeach()
endif()
set(boost_filesystem_FOUND 0)
set(boost_filesystem_NOT_FOUND_MESSAGE "No suitable build variant has been found.")
unset(__boost_skipped)
unset(__boost_configs)
unset(__boost_variants)
unset(_BOOST_FILESYSTEM_DEPS)
return()
endif()
unset(__boost_skipped)
unset(__boost_configs)
unset(__boost_variants)
if(_BOOST_FILESYSTEM_DEPS)
list(REMOVE_DUPLICATES _BOOST_FILESYSTEM_DEPS)
message(STATUS "Adding boost_filesystem dependencies: ${_BOOST_FILESYSTEM_DEPS}")
endif()
foreach(dep_boost_filesystem IN LISTS _BOOST_FILESYSTEM_DEPS)
set(_BOOST_QUIET)
if(boost_filesystem_FIND_QUIETLY)
set(_BOOST_QUIET QUIET)
endif()
set(_BOOST_REQUIRED)
if(boost_filesystem_FIND_REQUIRED)
set(_BOOST_REQUIRED REQUIRED)
endif()
get_filename_component(_BOOST_CMAKEDIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
find_package(boost_${dep_boost_filesystem} 1.70.0 EXACT CONFIG ${_BOOST_REQUIRED} ${_BOOST_QUIET} HINTS ${_BOOST_CMAKEDIR})
set_property(TARGET Boost::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES Boost::${dep_boost_filesystem})
unset(_BOOST_QUIET)
unset(_BOOST_REQUIRED)
unset(_BOOST_CMAKEDIR)
if(NOT boost_${dep_boost_filesystem}_FOUND)
set(boost_filesystem_FOUND 0)
set(boost_filesystem_NOT_FOUND_MESSAGE "A required dependency, boost_${dep_boost_filesystem}, has not been found.")
unset(_BOOST_FILESYSTEM_DEPS)
return()
endif()
endforeach()
unset(_BOOST_FILESYSTEM_DEPS)
Yes . I had to reinstall Boost, but this time I changed both the boost version and the gcc version!
As my impression, the problem may have been with MSYS2, however, for those who refer to this topic later, I used Boost 1.77 and gcc 8.1.0, and it worked for me.
Returns the path of the tensorflow, but when I want to use op.h,OpKernel in the objectLoder.cpp file, I find the following error :
CMakeFiles\obj_loader.dir/objects.a(obj_loader.cpp.obj):obj_loader.cpp:(.text$_ZN11ObjLoaderOpD1Ev[_ZN11ObjLoaderOpD1Ev]+0x46): undefined reference to `tensorflow::OpKernel::~OpKernel()
And my addressing type in, objectloader.cpp is as follows :
Just because you can include headers does not mean that you’ve done everything that is needed. I don’t know TensorFlow, so you’ll have to look there for what exactly is needed, but you need to ask for the libraries that you need to link against (probably similar mechanisms to getting its include directories).