Error compiling opencv_3.4.0 from source - cmake

I encountered the following error while trying to make opencv-3.4.0 from source:
main:StaticLib theo$ make -j8
[ 0%] Built target gen-pkgconfig
[ 1%] Built target ittnotify
[ 3%] Built target zlib
[ 5%] Built target gen_opencv_python_source
[ 8%] Built target libjpeg
[ 14%] Built target ippiw
[ 15%] Built target libjasper
[ 17%] Built target libpng
[ 23%] Built target libtiff
[ 30%] Built target libprotobuf
[ 38%] Built target IlmImf
[ 45%] Built target opencv_core
[ 46%] Built target opencv_flann
[ 48%] Built target opencv_ml
[ 56%] Built target opencv_imgproc
[ 57%] Built target opencv_objdetect
[ 59%] Built target opencv_video
[ 60%] Built target opencv_photo
[ 68%] Built target opencv_dnn
[ 68%] Built target opencv_shape
[ 70%] Built target opencv_imgcodecs
[ 70%] Built target opencv_videoio
[ 70%] Built target opencv_highgui
[ 71%] Built target opencv_superres
[ 71%] Linking CXX executable ../../bin/opencv_version
[ 71%] Linking CXX executable ../../bin/opencv_annotation
[ 71%] Linking CXX executable ../../bin/opencv_visualisation
ld: library not found for -lgstbase-1.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lgstbase-1.0
ld: library not found for -lgstbase-1.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/opencv_visualisation] Error 1
make[1]: *** [apps/visualisation/CMakeFiles/opencv_visualisation.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [bin/opencv_version] Error 1
make[2]: *** [bin/opencv_annotation] Error 1
make[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2
make[1]: *** [apps/version/CMakeFiles/opencv_version.dir/all] Error 2
[ 72%] Built target opencv_ts
[ 74%] Built target opencv_features2d
make: *** [all] Error 2
I cannot find the package lgstbase-1.0 and am not sure how to link it to the project.
I encountered the same error with lintl, but I followed advice from another thread to fix it (brew reinstall gettext).
Any ideas?

Related

Linker fails building library with CMake

I'm trying to build LUAGLM (from https://github.com/gottfriedleibniz/lua) to bind GLM library to give access in Lua using cmake. When i build, the building completes ok but the linker does not giving error:
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]: *** [glm.so] Error 1
make[1]: *** [CMakeFiles/glm.dir/all] Error 2
make: *** [all] Error 2
Above these lines there is a very long list starting with:
[ 10%] Building CXX object CMakeFiles/liblua.dir/onelua.c.o
[ 20%] Linking CXX shared library liblua54.dylib
[ 20%] Built target liblua
[ 30%] Building CXX object CMakeFiles/liblua_static.dir/onelua.c.o
[ 40%] Linking CXX static library liblua54_static.a
[ 40%] Built target liblua_static
[ 50%] Building C object CMakeFiles/lua.dir/lua.c.o
[ 60%] Linking CXX executable lua
[ 60%] Built target lua
[ 70%] Building CXX object CMakeFiles/luac.dir/onelua.c.o
[ 80%] Linking CXX executable luac
[ 80%] Built target luac
[ 90%] Building CXX object CMakeFiles/glm.dir/libs/glm_binding/lglmlib.cpp.o
[100%] Linking CXX shared module glm.so
Undefined symbols for architecture x86_64:
"glm_pushmat(lua_State*, glmMatrix const&)", referenced from:
glm_mat_add(lua_State*) in lglmlib.cpp.o
glm_mat_sub(lua_State*) in lglmlib.cpp.o
glm_mat_mul(lua_State*) in lglmlib.cpp.o
glm_mat_negate(lua_State*) in lglmlib.cpp.o
glm_mix(lua_State*) in lglmlib.cpp.o
glm_saturation(lua_State*) in lglmlib.cpp.o
glm_orthonormalize(lua_State*) in lglmlib.cpp.o
...
I'm on MacOS Intel (i386-apple-darwin11.3.0)
Not sure where to go next, do I need to edit the CMakeList somehow?
Any help much appreciated
EDIT:
The cmake error log contains the following :
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc Build flags: Id flags:
The output was: 1 ld: library not found for -lSystem clang: error: linker command failed with exit code 1 (use -v to see invocation)
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ Build flags: Id flags:
The output was: 1 ld: library not found for -lc++ clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is actually a bug in the CMakeList.txt because the library-list for the glm.so module does not contain the liblua.
If you apply the following patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8cf8a1a6..6eda2a17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
## -940,7 +940,7 ## ENDIF()
ADD_LIBRARY(glm MODULE ${SRC_LIBGLM})
TARGET_INCLUDE_DIRECTORIES(glm PRIVATE ${INCLUDE_DIRECTORIES})
-TARGET_LINK_LIBRARIES(glm PRIVATE ${LIBS})
+TARGET_LINK_LIBRARIES(glm PRIVATE ${LIBS} liblua_static)
IF( LUA_BUILD_AS_DLL )
TARGET_LINK_LIBRARIES(glm PUBLIC ${interpretor_target})
TARGET_COMPILE_DEFINITIONS(glm PRIVATE LUA_BUILD_AS_DLL)
to the freshly cloned repository and then do (inside the cloned repository):
git submodule update --init
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DONE_LUA=ON ..
make
you should find the files glm.so, lua and luac in your build directory. At least that worked on my Intel MacBook.
Using liblua_static in the CMakeList.txt for the library glm makes sure, that the resulting glm.so does not need the liblua dynamic library but contains the required code statically. That avoids problems when loading glm.so and the liblua library not being in the library path.
I opened an issue in the GitHub repository for it. So hopefully it will get fixed for everybody soon.
Usually it'll be something like -lYourLibrary not found, if -lSystem for example is not found, try adding it to your CMakeLists.
Are you still having the issue?

what is "error: variable 'writable' set but not used [-Werror,-Wunused-but-set-variable]" ?and how fix it?

i want build linphone sdk by below commands but i get error.how fix it?
git clone https://gitlab.linphone.org/BC/public/linphone-sdk.git --recursive
cd linphone-sdk
mkdir build-osx
cmake .. -DLINPHONESDK_PLATFORM=Desktop
make
and this is error:
how fix it?
-- Build files have been written to: /Users/sia/Desktop/compile1/linphone-sdk/WORK/mac-arm64/Build/ms2
[ 85%] Forcing build for 'EP_ms2'
[ 85%] Performing build step for 'EP_ms2'
[ 0%] Built target ms2-yuv2rgb-vs-header
CMake Warning at /Users/sia/Desktop/compile1/linphone-sdk/linphone-sdk/mac-arm64/share/bctoolbox/cmake/BcGitVersion.cmake:43 (message):
Project version (5.2.0) and git tag (5.2.0-alpha) differ. Please put them
identical
[ 0%] Built target ms2-git-version
[ 0%] Built target ms2-basedescs-header
[ 0%] Built target ms2-voipdescs-header
[ 0%] Built target ms2-fragment-shader-header
[ 0%] Built target ms2-vertex-shader-header
[ 0%] Built target ms2-yuv2rgb-fs-header
Consolidate compiler generated dependencies of target mediastreamer
[ 1%] Building C object src/CMakeFiles/mediastreamer.dir/audiofilters/macsnd.c.o
/Users/sia/Desktop/compile1/linphone-sdk/mediastreamer2/src/audiofilters/macsnd.c:372:10: **error: variable 'writable' set but not used [-Werror,-Wunused-but-set-variable]
Boolean writable;
^**
1 error generated.
make[8]: *** [src/CMakeFiles/mediastreamer.dir/audiofilters/macsnd.c.o] Error 1
make[7]: *** [src/CMakeFiles/mediastreamer.dir/all] Error 2
make[6]: *** [all] Error 2
make[5]: *** [/Users/sia/Desktop/compile1/linphone-sdk/WORK/mac-arm64/Stamp/EP_ms2/EP_ms2-build] Error 2
make[4]: *** [CMakeFiles/EP_ms2.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [mac-arm64-prefix/src/mac-arm64-stamp/mac-arm64-build] Error 2
make[1]: *** [CMakeFiles/mac-arm64.dir/all] Error 2
make: *** [all] Error 2

make: have built target; make install : *** No rule to make target 'install'

In Ubuntu20.04.
I want to insatll easy3d, but I can not make install it successfully.
make
[ 83%] Building CXX object CMakeFiles/easy3d.dir/surface_mesh_io_obj.cpp.o
[ 87%] Building CXX object CMakeFiles/easy3d.dir/surface_mesh_io_off.cpp.o
[ 91%] Building CXX object CMakeFiles/easy3d.dir/surface_mesh_io_ply.cpp.o
[ 95%] Building CXX object CMakeFiles/easy3d.dir/transform.cpp.o
[100%] Linking CXX static library libeasy3d.a
[100%] Built target easy3d
And the build have files:
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake libeasy3d.a
Then I excute the command make install, I got
make: *** No rule to make target 'install'. Stop.
How could I fix it
I made a big mistake that is nothing to install.

Doxygen docs installation fails due to EPSTOPDF-NOTFOUND error

I'm trying to build the Doxygen documentation. I can get the html files to build and load properly in the borwser. However, the PDF files do not build properly.
When I execute make docs (as stated in the Doxygen installation instructions), the following is the error output:
[ 37%] Built target _doxygen
[ 38%] Built target md5
[ 38%] Built target lodepng
[ 45%] Built target mscgen
[ 45%] Checking the git repository for changes...
[ 45%] Built target check_git_repository
[ 46%] Checking the doxygen version for changes...
[ 46%] Built target check_doxygen_version
[ 47%] Built target doxygen_version
[ 55%] Built target qtools
[ 55%] Built target generate_configvalues_header
[ 57%] Built target vhdlparser
[ 61%] Built target doxycfg
[ 61%] Built target doxygen
[ 85%] Built target examples
[ 85%] Generating Latex and HTML documentation.
[100%] Built target run_doxygen
[100%] Generating Doxygen Manual PDF.
/bin/sh: 1: EPSTOPDF-NOTFOUND: not found
doc/CMakeFiles/doxygen_pdf.dir/build.make:57: recipe for target 'doc/CMakeFiles/doxygen_pdf' failed
make[3]: *** [doc/CMakeFiles/doxygen_pdf] Error 127
CMakeFiles/Makefile2:637: recipe for target 'doc/CMakeFiles/doxygen_pdf.dir/all' failed
make[2]: *** [doc/CMakeFiles/doxygen_pdf.dir/all] Error 2
CMakeFiles/Makefile2:671: recipe for target 'doc/CMakeFiles/docs.dir/rule' failed
make[1]: *** [doc/CMakeFiles/docs.dir/rule] Error 2
Makefile:379: recipe for target 'docs' failed
make: *** [docs] Error 2
I have searched online extensively and installed all font packages I can find regarding the TexLive package, and I have installed the pdflatex package as well.
Help is appreciated, thank you!

Cmake building error for Vortex86DX Linux 2.6.23 platform

I´m trying to build CMAKE to an embedded platform based on Vortex86DX processor - Linux 2.6.23 kernel.
I´ve downloaded the latest CMAKE package (3.4.1), add did:
./bootstrap
Then: make
Here is the make result with the error message:
$ make
[ 1%] Built target cmIML_test
[ 4%] Built target cmsys
[ 5%] Built target cmsysTestDynload
[ 6%] Built target cmsys_c
[ 6%] Built target cmsysTestProcess
[ 6%] Built target cmsysTestSharedForward
[ 7%] Built target cmsysTestsC
[ 9%] Built target cmsysTestsCxx
[ 11%] Built target cmzlib
[ 28%] Built target cmcurl
[ 28%] Built target LIBCURL
[ 29%] Built target cmcompress
[ 30%] Built target cmbzip2
[ 40%] Built target cmliblzma
[ 41%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_write_disk_posix.c.o
/home/ftp/pub/cmake-3.4.1/cmake-3.4.1/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c: In function 'set_time':
/home/ftp/pub/cmake-3.4.1/cmake-3.4.1/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c:2805:19: error: 'AT_FDCWD' undeclared (first use in this function)
/home/ftp/pub/cmake-3.4.1/cmake-3.4.1/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c:2805:19: note: each undeclared identifier is reported only once for each function it appears in
/home/ftp/pub/cmake-3.4.1/cmake-3.4.1/Utilities/cmlibarchive/libarchive/archive_write_disk_posix.c:2805:39: error: 'AT_SYMLINK_NOFOLLOW' undeclared (first use in this function)
make[2]: *** [Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_write_disk_posix.c.o] Error 1
make[1]: *** [Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/all] Error 2
make: *** [all] Error 2
And the system version:
$ uname -a
Linux DSC_DKLinux 2.6.23 #6 Mon Sep 1 05:27:54 EDT 2008 i586 unknown
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/gcc-4.7.4/libexec/gcc/i586-pc-linux-gnu/4.7.4/lto-wrapper
Target: i586-pc-linux-gnu
Configured with: ../gcc-4.7.4/configure --prefix=/usr/gcc-4.7.4 --disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 4.7.4 (GCC)