Ask Your Question
0

Trouble installing opencv 4.0.0 under linux

asked 2019-01-30 12:32:26 -0500

aeroleo gravatar image

updated 2019-01-30 13:19:35 -0500

Hi, As far as I understand it, to install opencv 4.0.0 on a mint 18 linux, i need to build it from sources. So I tried (and failed).

The Website (https://docs.opencv.org/4.0.0/d7/d9f/...) informs:

cd ~/<my_working_directory>
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

cd ~/opencv
mkdir build
cd build

so far nothing exciting. Next:

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

which yields:

CMake Error at CMakeLists.txt:11 (message):


  FATAL: In-source builds are not allowed.

         You should create a separate directory for build files.



-- Configuring incomplete, errors occurred!

I tried to add -DCMAKE_SOURCE_DIR and/or -DMAKE_BINARY_DIR but more or less in vain.

Can someone help me?

Regards

Leo

edit retag flag offensive close merge delete

Comments

1

did you really cd into your build folder ? shouldn't it be: mkdir build && cd build ?

berak gravatar imageberak ( 2019-01-30 12:34:54 -0500 )edit
1

yes, you're right. Sorry the forum is ignoring single line feeds, so i had to make double line feeds (which looks kind of strange). Yes i did cd into the right dir (otherwise it would complain about missing CMakeLists.txt.

aeroleo gravatar imageaeroleo ( 2019-01-30 12:38:45 -0500 )edit

you can also mark your code and press ctrl-k to format it properly

berak gravatar imageberak ( 2019-01-30 12:42:04 -0500 )edit

thanks, this is much more readable.

aeroleo gravatar imageaeroleo ( 2019-01-30 13:20:02 -0500 )edit
1

otherwise it would complain about missing CMakeLists.txt it doesn't if there is ~/<my_working_directory>/CMakeLists.txt file.

dkurt gravatar imagedkurt ( 2019-01-31 05:24:34 -0500 )edit
1

dkurt, you're right. On the other hand, it would have to be not just any CMakeLists.txt, but one which starts (up to line 11)just like the one for opencv. But I have no experience using cmake, maybe this is standard for all of these files.

aeroleo gravatar imageaeroleo ( 2019-01-31 05:29:15 -0500 )edit
1

Maybe you have some unusual characters in ~/<my_working_directory>? I.e. whitespaces, non English characters, opencv or opencv2folders names (there were some issue about it https://github.com/opencv/opencv/issu... Try to clean up build folder cd build && rm -rf * and check that there is no extra files in source tree generated by cmake: cd /path/to/opencv && git status.

dkurt gravatar imagedkurt ( 2019-01-31 05:42:42 -0500 )edit

Well, there were no unusual characters, but it was on an encrypted fs (/media/veracrypt2/opencv). When I did the same on /home/etc... everything worked fine. Never would have guessed that, i thought there were good chances of wasting my time, when i did it on my home dir.

Thank you dkurt :)

aeroleo gravatar imageaeroleo ( 2019-01-31 07:47:57 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-01-31 08:01:16 -0500

mshabunin gravatar image

As the comment says: In-source builds are forbidden

You should create build directory on the same level as source directory:

git clone https://github.com/opencv/opencv
mkdir build
cd build
cmake <your-arguments> ../opencv
edit flag offensive delete link more

Comments

1

Nope, I tried that one. It didn't work either. But dkurts Solution worked, so i am fine.

aeroleo gravatar imageaeroleo ( 2019-01-31 08:37:38 -0500 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2019-01-30 12:32:26 -0500

Seen: 123 times

Last updated: Jan 31