install a Debug version of library (Bug #260)
Description
SVN version: 2997
Compiler: gcc (TDM-2 mingw32) 4.4.1
OS: Win7
I have first create a specific build for Debug build of the library using in CMake:
CMAKE_BUILD_TYPE="Debug"
The compilation work well but it seem that it define automatically CMAKE_INSTALL_CONFIG_NAME as Release and not Debug
I think you should replace:
IF
IF
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
ELSE
SET
ENDIF
ENDIF
by:
IF
IF
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${CMAKE_BUILD_TYPE}")
ELSE
SET
ENDIF
ENDIF
It is easy to resolve the bug by setting: CMAKE_INSTALL_CONFIG_NAME="Debug", but I think it is not the best solution
Associated revisions
Merge pull request #260 from alekcac:css_fix
History
Updated by Benoit R almost 15 years ago
Forget to add the error:
...
[100%] Built target opencv_ffmpeg
Install the project...
-- Install configuration: "Release"
CMake Error at src/cxcore/cmake_install.cmake:49 (FILE):
file INSTALL cannot find
"C:/Libs/OpenCV/2.x/MinGW/debug/bin/libcxcore210.dll".
Call Stack (most recent call first):
src/cmake_install.cmake:32 (INCLUDE)
cmake_install.cmake:32 (INCLUDE)
mingw32-make: *** [INSTALL] Error 1
Updated by Vadim Pisarevsky almost 15 years ago
Where the change is supposed to be made? I can not find the original code anywhere in OpenCV project tree.
- Status deleted (
Open)
Updated by anonymous - almost 15 years ago
The BUILD_TYPE variable is set in a lot of files
Doing a:
I obtain, <pre> 3rdparty/include/png.h:# define PNG_LIBPNG_BUILD_TYPE \ 3rdparty/include/png.h:# define PNG_LIBPNG_BUILD_TYPE \ 3rdparty/include/png.h:# define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE) 3rdparty/flann/CMakeLists.txt:#set(CMAKE_BUILD_TYPE Debug) 3rdparty/flann/.svn/text-base/CMakeLists.txt.svn-base:#set(CMAKE_BUILD_TYPE Debug) CMakeLists.txt:# In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release: CMakeLists.txt: if("${CMAKE_BUILD_TYPE}" STREQUAL "") CMakeLists.txt: set(CMAKE_BUILD_TYPE Release) [[OpenCVPCHSupport]].cmake: STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) [[OpenCVPCHSupport]].cmake: SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch/${_targetName}_${CMAKE_BUILD_TYPE}.gch") [[OpenCVPCHSupport]].cmake: IF(NOT CMAKE_BUILD_TYPE) [[OpenCVPCHSupport]].cmake: "You must set CMAKE_BUILD_TYPE!" [[OpenCVPCHSupport]].cmake: ENDIF(NOT CMAKE_BUILD_TYPE) release/cxcore/cmake_install.cmake: IF(BUILD_TYPE) release/cxcore/cmake_install.cmake: CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") release/cxcore/cmake_install.cmake: ELSE(BUILD_TYPE) release/cxcore/cmake_install.cmake: ENDIF(BUILD_TYPE) release/ml/cmake_install.cmake: IF(BUILD_TYPE) release/ml/cmake_install.cmake: CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") release/ml/cmake_install.cmake: ELSE(BUILD_TYPE) release/ml/cmake_install.cmake: ENDIF(BUILD_TYPE) release/cv/cmake_install.cmake: IF(BUILD_TYPE) release/cv/cmake_install.cmake: CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") release/cv/cmake_install.cmake: ELSE(BUILD_TYPE) release/cv/cmake_install.cmake: ENDIF(BUILD_TYPE) release/CMakeCache.txt:CMAKE_BUILD_TYPE:STRING=RELEASE release/cvaux/cmake_install.cmake: IF(BUILD_TYPE) release/cvaux/cmake_install.cmake: CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") release/cvaux/cmake_install.cmake: ELSE(BUILD_TYPE) release/cvaux/cmake_install.cmake: ENDIF(BUILD_TYPE) release/cmake_install.cmake: IF(BUILD_TYPE) release/cmake_install.cmake: CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") release/cmake_install.cmake: ELSE(BUILD_TYPE) release/cmake_install.cmake: ENDIF(BUILD_TYPE) release/highgui/cmake_install.cmake: IF(BUILD_TYPE) release/highgui/cmake_install.cmake: CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") release/highgui/cmake_install.cmake: ELSE(BUILD_TYPE) release/highgui/cmake_install.cmake: ENDIF(BUILD_TYPE) </pre> The variable BUILD_TYPE is used but never defined. Therefore you can do two things: -# 1: Change all the BUILD_TYPE in CMAKE_BUILD_TYPE. -# 2: Create the variable BUILD_TYPE (set(BUILD_TYPE "${CMAKE_BUILD_TYPE}") in trunk/CMakeLists.txt)
Updated by stathis -- over 14 years ago
i have the same problem. Basically, I use NMakefiles to build opencv, but nmake install only works for release builds. Even if I define CMAKE_BUILD_TYPE="Debug" on the cmake command line it still tries to install the release binaries, which it can't find, and fails.
D:\dev\opencv\debug>cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=..\ -DCMAKE_BUILD_TYPE=Debug -DBUILD_NEW_PYTHON_SUPPORT=OFF ..\ D:\dev\opencv\debug> nmake install . . [100%] Built target opencv_test_ml Install the project... -- Install configuration: "Release" CMake Error at modules/calib3d/cmake_install.cmake:44 (FILE): file INSTALL cannot find "D:/dev/opencv/debug/bin/opencv_calib3d211.dll". Call Stack (most recent call first): modules/cmake_install.cmake:32 (INCLUDE) cmake_install.cmake:33 (INCLUDE) NMAKE : fatal error U1077: 'D:\dev\cmake\bin\cmake.exe' : return code '0x1' Stop.
Notice above how it reports installing the release version: "-- Install configuration: "Release"
despite that it had to be Debug. I tried to modify the toplevel CMakeLists.txt, but it appears the build type is reset somewhere else. I think this may be a cmake issue, as I have manually edited the generated cmake_install.cmake files to set the BUILD_TYPE to debug, which worked. Anyone has any additional information would be great to have this fixed.
Updated by Benoit R over 14 years ago
First of all in Visual Studio (NMake) the CMAKE_BUILD_TYPE should not be touched, because all the type are defined in the same projects, then at compilation you can define which one to use (I don't know how to do this in NMAKE)
Then if you want to install debug you need to force the variable CMAKE_INSTALL_CONFIG_NAME="Debug" because the Cmake script will search by default the "Release" version, and as it can't find the installation failed.
Updated by stathis -- over 14 years ago
as far as I know that you can't tell nmake which configuration at compile time. The way cmake generates Makefiles implies that all generated makefiles are of a single configuration type, either debug or release in the case of opencv.
After the Makefiles are generated you are supposed to use build targets to build (or install). So if you execute "nmake help" you only have a range of targets that allow you to build/install various things, but all these will be the same for the configuration.
For whatever reason the generated makefiles for the debug version revert the install target to Release, that's why I think is the problem. What you are suggesting with the CMAKE_INSTALL_CONFIG_NAME="Debug" does not work for me. Apparently, none of the suggestions above work.
Updated by Dmitry Bely about 14 years ago
I was able to overcome that by removing FORCE from
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
(CMakeLists.txt in the root directory) and then configuring with CMAKE_CONFIGURATION_TYPES="Debug". Don't know if it's the correct method...
Updated by Vadim Pisarevsky almost 14 years ago
BUILD_TYPE can not be found in OpenCV CMake scripts anymore; hopefully, the problem has been solved
- Status set to Done
- (deleted custom field) set to obsolete