Skip to content

Instantly share code, notes, and snippets.

@akkijp
Last active April 5, 2016 05:43
Show Gist options
  • Save akkijp/f241efbb683dc6d138a7733f6daa2248 to your computer and use it in GitHub Desktop.
Save akkijp/f241efbb683dc6d138a7733f6daa2248 to your computer and use it in GitHub Desktop.
OpneCVをビルドした時のエラーログと、ビルドに成功した時のコマンド
#!/bin/sh
g++ `pkg-config --cflags opencv` -lopencv_core -lopencv_highgui -lopencv_imgproc version_cv.cpp `pkg-config --libs opencv`
k4zzk@Kosuke-no-MacBook-Pro ~ » ssh -p 64628 ubuntu@54.187.188.148 -i ~/.ssh/github_authorized_keys.pem
Last login: Tue Apr 5 00:50:32 2016 from 54.204.195.177
(venv-3.5.0) ubuntu@box552:~$ ls
aptkey.tmp fb-adb-1.2.0.tar.gz postgis-2.1.0.tar.gz.md5
aptkey.tmp.md5 lessons-opencv setuptools-3.4.4.zip
aptkey.tmp.new nvm target
aptkey.tmp.~1~ openssl.patch tmp
bin php versions.json
cassandra.logdir_IS_UNDEFINED pkg-versions.sh virtualenvs
(venv-3.5.0) ubuntu@box552:~$ cd lessons-opencv/
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ ls
README.md install-opencv-2.4.12.sh src version_cv.cpp
circle.yml install-opencv-3.1.0.sh test.sh
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ g++ version_cv.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ ./a.out
version: 2.4.9
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ ls
README.md circle.yml install-opencv-3.1.0.sh test.sh
a.out install-opencv-2.4.12.sh src version_cv.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ cd src/
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$ ld
ld: no input files
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$ ls
1.画像の読み込みと表示 2.画像の作成と保存
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$ cd 1.画像の読み込みと表示/
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ ls
README.md main.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ main.cpp
/tmp/cc9ZGH3z.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/cc9ZGH3z.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/cc9ZGH3z.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ `pkg-config opencv --cflags --libs`
-bash: -I/usr/local/include/opencv: そのようなファイルやディレクトリはありません
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ pkg-config opencv --cflags --libs
-I/usr/local/include/opencv -I/usr/local/include /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -ltbb -lrt -lpthread -lm -ldl
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --cflags --libs` main.cpp
/tmp/ccphcACT.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/ccphcACT.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccphcACT.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ sudo ldconfig
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --cflags --libs` main.cpp
/tmp/cc5vqqXI.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/cc5vqqXI.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/cc5vqqXI.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --cflags --libs` -lopencv_core -lopencv_highgui -lopencv_imgproc main.cpp
/tmp/ccsSlnVb.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/ccsSlnVb.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccsSlnVb.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ pkg-config opencv --libs
/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -ltbb -lrt -lpthread -lm -ldl
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ pkg-config opencv --libs^C
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --libs` -lopencv_core -lopencv_highgui -lopencv_imgproc main.cpp
/tmp/ccDj0CBX.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/ccDj0CBX.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccDj0CBX.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ opencv_imgcodecs
-bash: opencv_imgcodecs: コマンドが見つかりません
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --libs` -lopencv_core -lopencv_highgui -lopencv_imgproc main.cpp -lmine
/usr/bin/ld: cannot find -lmine
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --libs` -lopencv_core -lopencv_highgui -lopencv_imgproc -lmine main.cpp
/usr/bin/ld: cannot find -lmine
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ ls
README.md main.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ cd ..
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$ ls
1.画像の読み込みと表示 2.画像の作成と保存
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$ cd ..
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ ls
README.md a.out circle.yml install-opencv-2.4.12.sh install-opencv-3.1.0.sh src test.sh version_cv.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ cd ..
(venv-3.5.0) ubuntu@box552:~$ ls
aptkey.tmp aptkey.tmp.~1~ fb-adb-1.2.0.tar.gz openssl.patch postgis-2.1.0.tar.gz.md5 tmp
aptkey.tmp.md5 bin lessons-opencv php setuptools-3.4.4.zip versions.json
aptkey.tmp.new cassandra.logdir_IS_UNDEFINED nvm pkg-versions.sh target virtualenvs
(venv-3.5.0) ubuntu@box552:~$ LIBRARIES += glog gflags protobuf leveldb snappy \
> lmdb boost_system hdf5_hl hdf5 m \
> opencv_core opencv_highgui opencv_imgproc
-bash: LIBRARIES: コマンドが見つかりません
(venv-3.5.0) ubuntu@box552:~$ cd ..^C
(venv-3.5.0) ubuntu@box552:~$ ls
aptkey.tmp aptkey.tmp.~1~ fb-adb-1.2.0.tar.gz openssl.patch postgis-2.1.0.tar.gz.md5 tmp
aptkey.tmp.md5 bin lessons-opencv php setuptools-3.4.4.zip versions.json
aptkey.tmp.new cassandra.logdir_IS_UNDEFINED nvm pkg-versions.sh target virtualenvs
(venv-3.5.0) ubuntu@box552:~$ cd lessons-opencv/
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ l
-bash: l: コマンドが見つかりません
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ ls
README.md a.out circle.yml install-opencv-2.4.12.sh install-opencv-3.1.0.sh src test.sh version_cv.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ cd circle.yml
-bash: cd: circle.yml: ディレクトリではありません
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ ls
README.md a.out circle.yml install-opencv-2.4.12.sh install-opencv-3.1.0.sh src test.sh version_cv.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv$ cd src/
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$ ls
1.画像の読み込みと表示 2.画像の作成と保存
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src$ cd 1.画像の読み込みと表示/
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ ls
README.md main.cpp
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ c++
c++: fatal error: no input files
compilation terminated.
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ c++ main.cpp
/tmp/ccPwWd8b.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/ccPwWd8b.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccPwWd8b.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++
g++: fatal error: no input files
compilation terminated.
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ main.cpp
/tmp/cciQozoS.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/cciQozoS.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/cciQozoS.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ c++^C
ui -lopencv_imgproc -lmine main.cpps-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --libs` -lopencv_core -lopencv_highg
-bash: g++g++: コマンドが見つかりません
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --libs` -lopencv_core -lopencv_highgui -lopencv_imgproc -lmine main.cpp
/usr/bin/ld: cannot find -lmine
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ sudo apt-get install mine
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
E: パッケージ mine が見つかりません
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ g++ `pkg-config opencv --libs` -lopencv_core -lopencv_highgui -lopencv_imgproc main.cpp
/tmp/ccJQH6bc.o: In function `main':
main.cpp:(.text+0x71): undefined reference to `cv::imread(std::string const&, int)'
main.cpp:(.text+0x9a): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
main.cpp:(.text+0xdd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
main.cpp:(.text+0x105): undefined reference to `cv::waitKey(int)'
/tmp/ccJQH6bc.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)'
/tmp/ccJQH6bc.o: In function `cv::Mat::release()':
main.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
(venv-3.5.0) ubuntu@box552:~/lessons-opencv/src/1.画像の読み込みと表示$ Connection to 54.187.188.148 closed by remote host.
Connection to 54.187.188.148 closed.
k4zzk@Kosuke-no-MacBook-Pro ~ » 255 ↵
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment