Ask Your Question

Revision history [back]

I can not build OpenCV3.4.1 on FreeBSD11.1.

An error occurred when trying to build OpenCV 3.4.1 with the make command. How do I build successfully?

/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:108:17: error: 
      variable has incomplete type 'struct stat'
    struct stat stat_buf;
                ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:108:12: note: 
      forward declaration of 'stat'
    struct stat stat_buf;
           ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:129:23: error: 
      use of undeclared identifier 'rmdir'
        bool result = rmdir(path.c_str()) == 0;
                      ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:141:23: error: 
      use of undeclared identifier 'unlink'
        bool result = unlink(path.c_str()) == 0;
                      ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:380:17: error: 
      allocation of incomplete type 'cv::utils::fs::FileLock::Impl'
    : pImpl(new Impl(fname))
                ^~~~
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/include/opencv2/core/utils/filesystem.private.hpp:55:12: note: 
      forward declaration of 'cv::utils::fs::FileLock::Impl'
    struct Impl;
           ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:386:5: warning: 
      deleting pointer to incomplete type 'cv::utils::fs::FileLock::Impl' may
      cause undefined behavior [-Wdelete-incomplete]
    delete pImpl;
    ^      ~~~~~
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/include/opencv2/core/utils/filesystem.private.hpp:55:12: note: 
      forward declaration of 'cv::utils::fs::FileLock::Impl'
    struct Impl;
           ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:390:40: error: 
      member access into incomplete type 'cv::utils::fs::FileLock::Impl'
void FileLock::lock() { CV_Assert(pImpl->lock()); }
                                       ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/include/opencv2/core/utils/filesystem.private.hpp:55:12: note: 
      forward declaration of 'cv::utils::fs::FileLock::Impl'
    struct Impl;
           ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:391:42: error: 
      member access into incomplete type 'cv::utils::fs::FileLock::Impl'
void FileLock::unlock() { CV_Assert(pImpl->unlock()); }
                                         ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/include/opencv2/core/utils/filesystem.private.hpp:55:12: note: 
      forward declaration of 'cv::utils::fs::FileLock::Impl'
    struct Impl;
           ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:392:47: error: 
      member access into incomplete type 'cv::utils::fs::FileLock::Impl'
void FileLock::lock_shared() { CV_Assert(pImpl->lock_shared()); }
                                              ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/include/opencv2/core/utils/filesystem.private.hpp:55:12: note: 
      forward declaration of 'cv::utils::fs::FileLock::Impl'
    struct Impl;
           ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/src/utils/filesystem.cpp:393:49: error: 
      member access into incomplete type 'cv::utils::fs::FileLock::Impl'
void FileLock::unlock_shared() { CV_Assert(pImpl->unlock_shared()); }
                                                ^
/home/ユーザ名/support/src/opencv/opencv-3.4.1/modules/core/include/opencv2/core/utils/filesystem.private.hpp:55:12: note: 
      forward declaration of 'cv::utils::fs::FileLock::Impl'
    struct Impl;
           ^
1 warning and 8 errors generated.
*** Error code 1

Stop.
make[2]: stopped in /home/ユーザ名/support/src/opencv/opencv-3.4.1/build
*** Error code 1

Stop.
make[1]: stopped in /home/ユーザ名/support/src/opencv/opencv-3.4.1/build
*** Error code 1

Stop.
make: stopped in /home/ユーザ名/support/src/opencv/opencv-3.4.1/build