davisking / dlib

A toolkit for making real world machine learning and data analysis applications in C++
http://dlib.net
Boost Software License 1.0
13.59k stars 3.38k forks source link

Segfault in dnn_face_recognition_ex example #2397

Closed zingchen closed 3 years ago

zingchen commented 3 years ago

A fully automated (Cmake) build of examples/dnn_face_recognition_ex.cpp results in an application that causes segmentation fault at run time. No problems were observed with other examples. A working version of the example can be built manually. This was observed on Windows with MinGW-w64 using GCC compiler, detailed later.

For privacy, my real name and computer name in the command prompt are redacted, replaced with USER and COMPUTER, respectively, in following sections.

Expected Behavior

The following behavior was observed from manually built version of the example, detailed in the next section. The manually built (working) version uses the same libdlib.a as the fully automated (non-working) one.

(Using MINGW64.exe shell)

USER@COMPUTER MINGW64 /d/USER/testdlib/bin/relea
$ ./testdlib
Run this example by invoking it like this:
   ./dnn_face_recognition_ex faces/bald_guys.jpg

You will also need to get the face landmarking model file as well as
the face recognition model file.  Download and then decompress these files from:
http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2
http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

USER@COMPUTER MINGW64 /d/USER/testdlib/bin/relea
$ 

(Using cmd.exe shell)

d:\USER\TestDlib\bin\Relea>testDlib
Run this example by invoking it like this:
   ./dnn_face_recognition_ex faces/bald_guys.jpg

You will also need to get the face landmarking model file as well as
the face recognition model file.  Download and then decompress these files from:

http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2
http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

d:\USER\TestDlib\bin\Relea>

Current Behavior

(Using MINGW64.exe shell)

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ ./dnn_face_recognition_ex
Run this example by invoking it like this:
   ./dnn_face_recognition_ex faces/bald_guys.jpg

You will also need to get the face landmarking model file as well as
the face recognition model file.  Download and then decompress these files from:
http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2
http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

Segmentation fault

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$

(Using cmd.exe shell)

c:\C-lib>cd dlib-master\examples\build

c:\C-lib\dlib-master\examples\build>dnn_face_recognition_ex
Run this example by invoking it like this:
   ./dnn_face_recognition_ex faces/bald_guys.jpg

You will also need to get the face landmarking model file as well as
the face recognition model file.  Download and then decompress these files from:

http://dlib.net/files/shape_predictor_5_face_landmarks.dat.bz2
http://dlib.net/files/dlib_face_recognition_resnet_model_v1.dat.bz2

Dialog box dinn_face_recognition_ex.exe appears, displaying the following

dnn_face_recorgnition_ex.exe has stopped working
Windows can check online for a solution to the problem.
  => Check online for a solution and close the program
  => Close the program
(Click on 'View problem details' to see the following.)
Problem signature:
  Problem Event Name:   BEX64
  Application Name: dnn_face_recognition_ex.exe
  Application Version:  0.0.0.0
  Application Timestamp:    60fe3970
  Fault Module Name:    StackHash_9e8a
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   00000000
  Exception Offset: 0000000000500158
  Exception Code:   c0000005
  Exception Data:   0000000000000008
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1: 9e8a
  Additional Information 2: 9e8a3532ce8a5c43b3993abbe10de9fa
  Additional Information 3: eac1
  Additional Information 4: eac142ef81a0cc5065e421b9653fbd78

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

Steps to Reproduce

Either of the following two sequence of steps, called scenario A and B respectively, can produce the broken build. The full session log is given in Appendix 1A and 1B, respectively.

Scenario A. Build dlib, then build the example in two separate cmake commands.

cmake -G "MinGW Makefiles" ..
cmake --build dlib_build --config Release
cmake --build . --target dnn_face_recognition_ex --config Release

Scenario B. Build the example, which invokes building Dlib, in a single cmake command.

cmake -G "MinGW Makefiles" ..
cmake --build . --target dnn_face_recognition_ex --config Release

The good build, on the other hand, can be obtained manually as follows. (Actually, I configured Code::Blocks to generate the sequence.) Note that the libdlib.a here is exactly the same as one produced from scenario A or scenario B above.

g++.exe -std=c++11 -O2 -IC:\C-lib\dlib-master -c C:\C-lib\dlib-master\examples\dnn_face_recognition_ex.cpp -o obj\Relea\C\C-lib\dlib-master\examples\dnn_face_recognition_ex.o
g++.exe -LC:\C-lib\dlib-master\examples\build\dlib_build -o bin\Relea\TestDlib.exe obj\Relea\C\C-lib\dlib-master\examples\dnn_face_recognition_ex.o  -ldlib -lgdi32 -lcomctl32 -luser32 -lwinmm -lws2_32 -limm32 -llibgif -s  

Appendix 1. Session log

(result: broken example.) (Scenario A. Build dlib, then build the example in two separate cmake commands)

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ cmake ..
-- Building for: Ninja
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/C-lib/dlib-master/examples/build/CMakeFiles/CMakeOutput.log".

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ cmake -G "MinGW Makefiles" ..
CMake Error: Error: generator : MinGW Makefiles
Does not match the generator used previously: Ninja
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ rm ./CMakeCache.txt

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ cmake -G "MinGW Makefiles" ..
-- 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
-- Using CMake version: 3.21.0
-- Compiling dlib version: 19.22.99
-- Found system copy of libpng: C:/msys64/mingw64/lib/libpng.dll.a;C:/msys64/mingw64/lib/libz.dll.a
-- Found system copy of libjpeg: C:/msys64/mingw64/lib/libjpeg.dll.a
-- Searching for BLAS and LAPACK
-- Searching for BLAS and LAPACK
-- Found PkgConfig: C:/msys64/mingw64/bin/pkg-config.exe (found version "1.7.4")
-- Checking for module 'cblas'
--   Package 'cblas', required by 'virtual:world', not found
-- Checking for module 'lapack'
--   Package 'lapack', required by 'virtual:world', not found
-- Looking for cblas_ddot
-- Looking for cblas_ddot - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
 *****************************************************************************
 *** No BLAS library found so using dlib's built in BLAS.  However, if you ***
 *** install an optimized BLAS such as OpenBLAS or the Intel MKL your code ***
 *** will run faster.  On Ubuntu you can install OpenBLAS by executing:    ***
 ***    sudo apt-get install libopenblas-dev liblapack-dev                 ***
 *** Or you can easily install OpenBLAS from source by downloading the     ***
 *** source tar file from http://www.openblas.net, extracting it, and      ***
 *** running:                                                              ***
 ***    make; sudo make install                                            ***
 *****************************************************************************
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.5")
-- Found CUDA, but CMake was unable to find the cuBLAS libraries that should be part of every basic CUDA install. Your CUDA install is somehow broken or incomplete. Since cuBLAS is required for dlib to use CUDA we won't use CUDA.
-- DID NOT FIND CUDA
-- Disabling CUDA support for dlib.  DLIB WILL NOT USE CUDA
-- C++11 activated.
OpenCV not found, so we won't build the webcam_face_pose_ex example.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/C-lib/dlib-master/examples/build

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ cmake --build dlib_build --config Release
Consolidate compiler generated dependencies of target dlib
[  0%] Building CXX object dlib_build/CMakeFiles/dlib.dir/base64/base64_kernel_1.cpp.obj
[  0%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_1.cpp.obj
[  4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bigint/bigint_kernel_2.cpp.obj
[  4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bit_stream/bit_stream_kernel_1.cpp.obj
[  9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_1.cpp.obj
[  9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_decoder/entropy_decoder_kernel_2.cpp.obj
[  9%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_1.cpp.obj
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/entropy_encoder/entropy_encoder_kernel_2.cpp.obj
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/md5/md5_kernel_1.cpp.obj
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/tokenizer/tokenizer_kernel_1.cpp.obj
[ 18%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.cpp.obj
[ 18%] Building CXX object dlib_build/CMakeFiles/dlib.dir/test_for_odr_violations.cpp.obj
[ 22%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_1.cpp.obj
[ 22%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.obj
[ 22%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_1.cpp.obj
[ 27%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_2.cpp.obj
[ 27%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_extensions.cpp.obj
[ 27%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.obj
[ 31%] Building CXX object dlib_build/CMakeFiles/dlib.dir/linker/linker_kernel_1.cpp.obj
[ 31%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/extra_logger_headers.cpp.obj
[ 36%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_kernel_1.cpp.obj
[ 36%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_config_file.cpp.obj
[ 36%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_1.cpp.obj
[ 40%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_2.cpp.obj
[ 40%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_extensions.cpp.obj
[ 40%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_2.cpp.obj
[ 45%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf.cpp.obj
[ 45%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf_unbuffered.cpp.obj
[ 50%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_kernel.cpp.obj
[ 50%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_iostream.cpp.obj
[ 50%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_http.cpp.obj
[ 54%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/multithreaded_object_extension.cpp.obj
[ 54%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threaded_object_extension.cpp.obj
[ 54%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_1.cpp.obj
[ 59%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_2.cpp.obj
[ 59%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_shared.cpp.obj
[ 63%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/thread_pool_extension.cpp.obj
[ 63%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/async.cpp.obj
[ 63%] Building CXX object dlib_build/CMakeFiles/dlib.dir/timer/timer.cpp.obj
[ 68%] Building CXX object dlib_build/CMakeFiles/dlib.dir/stack_trace.cpp.obj
[ 68%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cpu_dlib.cpp.obj
[ 68%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/tensor_tools.cpp.obj
[ 72%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.obj
[ 72%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/mnist.cpp.obj
[ 77%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/cifar.cpp.obj
[ 77%] Building CXX object dlib_build/CMakeFiles/dlib.dir/global_optimization/global_function_search.cpp.obj
[ 77%] Building CXX object dlib_build/CMakeFiles/dlib.dir/filtering/kalman_filter.cpp.obj
In file included from C:/C-lib/dlib-master/dlib/matrix.h:11,
                 from C:\C-lib\dlib-master\dlib\filtering\kalman_filter.h:7,
                 from C:\C-lib\dlib-master\dlib\filtering\kalman_filter.cpp:6:
C:/C-lib/dlib-master/dlib/matrix/matrix_la.h: In function 'long int dlib::svd4(dlib::svd_u_mode, bool, const dlib::matrix_exp<EXP>&, dlib::matrix<typename EXP::type, uM, uN, MM1, L1>&, dlib::matrix<typename EXP::type, qN, qX, MM2, L1>&, dlib::matrix<typename EXP::type, vM, vN, MM3, L1>&) [with EXP = dlib::matrix_op<dlib::op_trans<dlib::matrix_op<dlib::op_trans<dlib::matrix<double, 1, 2, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > > > >; long int qN = 1; long int qX = 1; long int uM = 1; long int uN = 1; long int vM = 2; long int vN = 1; MM1 = dlib::memory_manager_stateless_kernel_1<char>; MM2 = dlib::memory_manager_stateless_kernel_1<char>; MM3 = dlib::memory_manager_stateless_kernel_1<char>; L1 = dlib::row_major_layout]':
C:/C-lib/dlib-master/dlib/matrix/matrix_la.h:225:32: warning: iteration 1 invokes undefined behavior [-Waggressive-loop-optimizations]
  225 |             y = abs(q(i)) + abs(e(i));
      |                             ~~~^~~~~~
C:/C-lib/dlib-master/dlib/matrix/matrix_la.h:163:20: note: within this loop
  163 |         for (i=0; i<n; i++)
      |                   ~^~
[ 81%] Building CXX object dlib_build/CMakeFiles/dlib.dir/svm/auto.cpp.obj
[ 81%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/widgets.cpp.obj
[ 81%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/drawable.cpp.obj
[ 86%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/canvas_drawing.cpp.obj
[ 86%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/style.cpp.obj
[ 86%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/base_widgets.cpp.obj
[ 90%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_1.cpp.obj
[ 90%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_2.cpp.obj
[ 95%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/png_loader.cpp.obj
[ 95%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_png.cpp.obj
[ 95%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/jpeg_loader.cpp.obj
[100%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_jpeg.cpp.obj
[100%] Linking CXX static library libdlib.a
[100%] Built target dlib

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ cmake --build . --target dnn_face_recognition_ex --config Release
[ 95%] Built target dlib
[100%] Linking CXX executable dnn_face_recognition_ex.exe
[100%] Built target dnn_face_recognition_ex

(Scenario B. Build the example, which invokes building Dlib, in a single cmake command.)

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ cmake --build . --target clean

USER@COMPUTER MINGW64 /c/c-lib/dlib-master/examples/build
$ cmake --build . --target dnn_face_recognition_ex --config Release
Consolidate compiler generated dependencies of target dlib
[  0%] Building CXX object dlib_build/CMakeFiles/dlib.dir/md5/md5_kernel_1.cpp.obj
[  0%] Building CXX object dlib_build/CMakeFiles/dlib.dir/tokenizer/tokenizer_kernel_1.cpp.obj
[  4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/unicode/unicode.cpp.obj
[  4%] Building CXX object dlib_build/CMakeFiles/dlib.dir/test_for_odr_violations.cpp.obj
[  8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_1.cpp.obj
[  8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.obj
[  8%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_1.cpp.obj
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_kernel_2.cpp.obj
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/dir_nav/dir_nav_extensions.cpp.obj
[ 13%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.obj
[ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/linker/linker_kernel_1.cpp.obj
[ 17%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/extra_logger_headers.cpp.obj
[ 21%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_kernel_1.cpp.obj
[ 21%] Building CXX object dlib_build/CMakeFiles/dlib.dir/logger/logger_config_file.cpp.obj
[ 21%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_1.cpp.obj
[ 26%] Building CXX object dlib_build/CMakeFiles/dlib.dir/misc_api/misc_api_kernel_2.cpp.obj
[ 26%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_extensions.cpp.obj
[ 26%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockets/sockets_kernel_2.cpp.obj
[ 30%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf.cpp.obj
[ 30%] Building CXX object dlib_build/CMakeFiles/dlib.dir/sockstreambuf/sockstreambuf_unbuffered.cpp.obj
[ 34%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_kernel.cpp.obj
[ 34%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_iostream.cpp.obj
[ 34%] Building CXX object dlib_build/CMakeFiles/dlib.dir/server/server_http.cpp.obj
[ 39%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/multithreaded_object_extension.cpp.obj
[ 39%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threaded_object_extension.cpp.obj
[ 39%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_1.cpp.obj
[ 43%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_2.cpp.obj
[ 43%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/threads_kernel_shared.cpp.obj
[ 47%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/thread_pool_extension.cpp.obj
[ 47%] Building CXX object dlib_build/CMakeFiles/dlib.dir/threads/async.cpp.obj
[ 47%] Building CXX object dlib_build/CMakeFiles/dlib.dir/timer/timer.cpp.obj
[ 52%] Building CXX object dlib_build/CMakeFiles/dlib.dir/stack_trace.cpp.obj
[ 52%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/cpu_dlib.cpp.obj
[ 52%] Building CXX object dlib_build/CMakeFiles/dlib.dir/cuda/tensor_tools.cpp.obj
[ 56%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/image_dataset_metadata.cpp.obj
[ 56%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/mnist.cpp.obj
[ 60%] Building CXX object dlib_build/CMakeFiles/dlib.dir/data_io/cifar.cpp.obj
[ 60%] Building CXX object dlib_build/CMakeFiles/dlib.dir/global_optimization/global_function_search.cpp.obj
[ 60%] Building CXX object dlib_build/CMakeFiles/dlib.dir/filtering/kalman_filter.cpp.obj
In file included from C:/C-lib/dlib-master/dlib/matrix.h:11,
                 from C:\C-lib\dlib-master\dlib\filtering\kalman_filter.h:7,
                 from C:\C-lib\dlib-master\dlib\filtering\kalman_filter.cpp:6:
C:/C-lib/dlib-master/dlib/matrix/matrix_la.h: In function 'long int dlib::svd4(dlib::svd_u_mode, bool, const dlib::matrix_exp<EXP>&, dlib::matrix<typename EXP::type, uM, uN, MM1, L1>&, dlib::matrix<typename EXP::type, qN, qX, MM2, L1>&, dlib::matrix<typename EXP::type, vM, vN, MM3, L1>&) [with EXP = dlib::matrix_op<dlib::op_trans<dlib::matrix_op<dlib::op_trans<dlib::matrix<double, 1, 2, dlib::memory_manager_stateless_kernel_1<char>, dlib::row_major_layout> > > > >; long int qN = 1; long int qX = 1; long int uM = 1; long int uN = 1; long int vM = 2; long int vN = 1; MM1 = dlib::memory_manager_stateless_kernel_1<char>; MM2 = dlib::memory_manager_stateless_kernel_1<char>; MM3 = dlib::memory_manager_stateless_kernel_1<char>; L1 = dlib::row_major_layout]':
C:/C-lib/dlib-master/dlib/matrix/matrix_la.h:225:32: warning: iteration 1 invokes undefined behavior [-Waggressive-loop-optimizations]
  225 |             y = abs(q(i)) + abs(e(i));
      |                             ~~~^~~~~~
C:/C-lib/dlib-master/dlib/matrix/matrix_la.h:163:20: note: within this loop
  163 |         for (i=0; i<n; i++)
      |                   ~^~
[ 65%] Building CXX object dlib_build/CMakeFiles/dlib.dir/svm/auto.cpp.obj
[ 65%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/widgets.cpp.obj
[ 65%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/drawable.cpp.obj
[ 69%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/canvas_drawing.cpp.obj
[ 69%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/style.cpp.obj
[ 69%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_widgets/base_widgets.cpp.obj
[ 73%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_1.cpp.obj
[ 73%] Building CXX object dlib_build/CMakeFiles/dlib.dir/gui_core/gui_core_kernel_2.cpp.obj
[ 78%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/png_loader.cpp.obj
[ 78%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_png.cpp.obj
[ 78%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_loader/jpeg_loader.cpp.obj
[ 82%] Building CXX object dlib_build/CMakeFiles/dlib.dir/image_saver/save_jpeg.cpp.obj
[ 82%] Linking CXX static library libdlib.a
[ 95%] Built target dlib
[ 95%] Building CXX object CMakeFiles/dnn_face_recognition_ex.dir/dnn_face_recognition_ex.cpp.obj
[100%] Linking CXX executable dnn_face_recognition_ex.exe
[100%] Built target dnn_face_recognition_ex

Appendix 2. Session log

(result: good build) (using the same libdlib.a as the broken build)


-------------- Clean: Relea in TestDlib (compiler: GNU GCC Compiler)---------------

Cleaned "TestDlib - Relea"

-------------- Build: Relea in TestDlib (compiler: GNU GCC Compiler)---------------

g++.exe -std=c++11 -O2 -IC:\C-lib\dlib-master -c C:\C-lib\dlib-master\examples\dnn_face_recognition_ex.cpp -o obj\Relea\C\C-lib\dlib-master\examples\dnn_face_recognition_ex.o
g++.exe -LC:\C-lib\dlib-master\examples\build\dlib_build -o bin\Relea\TestDlib.exe obj\Relea\C\C-lib\dlib-master\examples\dnn_face_recognition_ex.o  -ldlib -lgdi32 -lcomctl32 -luser32 -lwinmm -lws2_32 -limm32 -llibgif -s  
Output file is bin\Relea\TestDlib.exe with size 2.08 MB
Process terminated with status 0 (0 minute(s), 35 second(s))
0 error(s), 0 warning(s) (0 minute(s), 35 second(s))
davisking commented 3 years ago

I can't tell what the issue is. Presumably something about your mingw env is confusing cmake and leading it to do something funny. But I can't tell what from the logs here.

dlib-issue-bot commented 3 years ago

Warning: this issue has been inactive for 35 days and will be automatically closed on 2021-09-11 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot commented 3 years ago

Warning: this issue has been inactive for 42 days and will be automatically closed on 2021-09-11 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot commented 3 years ago

Notice: this issue has been closed because it has been inactive for 45 days. You may reopen this issue if it has been closed in error.