Opencv 3.2 Install Dependencies Error

Hi Mani,

In the morning I performed the same , but not getting ahead for 67%.

P.S:- I am using ext4 formatted sd card only. And also tried the steps described here., Still while creating swap file , and linking to home folder. My emmc space is also got reduced.

So, I have download opencv freshly, flashing eMMC again for fresh start. And yes, I am giving permission to all files and folders inside sd card also

@hector_ice

Why do you want to link to home directory? Is it a soft link or hard link? To avoid overhead please use ZRAM swapspace as mentioned in below guide. If you are using latest Linaro Debian image, ZRAM modules are installed by default.

I am soft linking.
hard linking would result in same copy that consumes more space.
And sure I will do the ZRAM steps today after flashing is done.

Does this zram creates swap on eMMC or sd card. As I am not able to see
where to provide path for sd card.
can you please help me here.

Hi @hector_ice

Compiling OpenCV does require more than 1GB of RAM, you must enable zram (or a swap space on the SDCard) to get it to compile, along the way htop will show RAM usage above 2GB. There is not enough space on the onboard eMMC to recompile OpenCL, you MUST use a SDCard to do the build, 8GB is plenty, but 4GB may not make it. Finally you need a lot of patience, it takes about 6 hours to compile. I thought I had posted full instructions on compiling OpenCL on the forums here some time ago.

Zram, actually compresses the contents of RAM, and decompresses when the RAM is accessed, it’s magic :wink: ZRAM does not use eMMC or SDCard space, despite the CPU time required to compress and decompress pages of RAM, it ends up being faster that writing and reading pages of RAM from a physical device. The downside of ZRAM, is you can only get about 2 or 3x RAM, where as with swap you could get much higher multiples of the RAM space.

Full disclosure: I am currently unemployed and looking for work.

Yes, you have and I have followed them.
I am using 32 G sd card for swap file creation, But its not working.

I will make zram space once my flashing is done.

But I see you were successful to build opencv.
So If you can share the image file so I can check what I am doing wrong or missing.

Thanks in advance.

I did the OpenCV compile quite a while ago, one of the things that happens is versions of things change with time and sometimes you need to tweak your steps to complete a task. I find it is the packages you need to install to get all of the right tools to compile that usually get you in trouble.

Full disclosure: I am currently unemployed and looking for work.

yes, agreed, Problem includes broken packages.
But I was rectifying broken packages and rebuild again.

If I have more then two crashes then I would go for flashing eMMC again.
for fresh build.

Still errors. So, I will perform the steps with using zram and do again a try.
Basically the changed packages (if you meant from 3.3 to 3.4) thats fine for me.
opencv 3.3 is also fine for me right now.

Thanks

@Mani @ljking @anon91830841

hi Mani,
I have followed the steps and created the Zram space. And after freshly downloading all the dependencies and I have tried to build the options @ljking has provided.

During Cmake I have not found any errors nor not found warnings ( I have carefully examined the logs and downloaded missing ones).

But When kept for build ( building in SD card ) it got stuck at 23% (i Kept for building more then 9 Hours)
the last line in compilation was,

[23%] Building CXX object modules/core/CMakeFiles/opencv_perf_core.dir/perf/opencv/perf_arithm.cpp.o

Here there was no error but gt freezed and not moving forward at all.

Can anyone please tell me what I am doing wrong?


2nd Try:-
Here I have did ‘make clean’ and deleted build folder , again made and freshly started making using cmake.
all the options were same as prev,

Error I got
cc1plus: out of memory allocating 48 bytes after a total of 4474800 bytes.,
I know its memory issue, how do i resolve.
( I am already using zram here)
Please help me here.

Thanks

Some projects will always be difficult to compile on (relatively) low resource embedded platforms such as DB410C. Ultimately if you run out of RAM when using zswap then you either need to enable extra swap space or switch to using a different build machine.

I’d suggest you continue trying to enable swap a little longer yet but if that doesn’t work out then one alternative build machine is to create an AArch64 virtual machine on a PC and give its lots of memory. Unless you PC is a massively powerful then the emulated CPU will be slower than the DB410C but if it has lots of memory it may still perform certain build tasks faster.

I’ve written up how to install Debian using qemu on my blog:
http://www.redfelineninja.org.uk/daniel/?p=450

The challenge of this approach is working out how to copy the resulting libraries from your emulated machine to DB410C. I’m afraid I must leave that as an “exercise for the reader”.

Hi @danielt Thank you for replay. I am already trying qemu way.

But yes, I am also wondering the same question you have left for the reader :slight_smile:.

I would be glad, if you have time for further explaining, It would me miracle for me as I am approaching a deadline for this.

I’ll have to talk in generalities rather than specifically about OpenCV… anyhow.

The “right” way is to figure out how to make a debian package. That way you just copy the .deb files to the target and install them. However given the board runs debian testing there’s usually a reason why the package isn’t already up to date (like its hard or there are missing dependencies)

An alternative way is to try and force all the stuff you compile yourself into a specific directory during the install (e.g. /opt/hector_ice/ ). That way you can just rsync the directory. How you control the install directory varies depending on what you are compiling although if you have a configure script then configure --prefix=/opt/hector_ice/ usually does the trick.

A final note is that it does look to me like Debian already has an OpenCV 3.3 package. It’s in Debian experimental but if you are desperate enough this might be a pre-compiled OpenCV that is new enough for you to use. See DebianExperimental - Debian Wiki for more info on Debian Experimental (and make a lot of backups as you work…).

@danielt

Thank you for the explanation.

I will give a try
.

Hi @danielt @Mani @ljking @anon91830841

Thank you for the help and support. I am able to install opencv.
But I got some other issue.
After the installation when I rebooted the board, It asked me to select the proper appearance,(except it should default boot with LxQt) instead booting with default.
I selected lxqt-session option, And It went for processing and nothing got displayed.

I rebooted board again
booting stopped at
"[.624537] CPU: 2 PID: 1925 Comm: modprob not tainted 4.14.0-qcomlt-arm64 #1 "
I am not able to understood, Why this error coming, I have not changed any kernel arguments

Then I rebooted again, Error changed. Some other Error came,but the board did not booted properly.
Any suggestion on how do i resole and get back lxqt desktop,
(I don’t won’t go again for flashing the board and install opencv for now)
If no desktop, then command line will also work fine for me, Just board should boot properly.

Any suggestions.??

Thanks in advance

No ideas from me I’m afraid. Sorry… and the very best of luck!

@danielt,

I am trying with recovery image.
Here I have one question, If I boot with recovery image, Will it format full flash.
Or my files will be as it is, just the kernel and boot location with boot partions will get updated?

It will wipe the whole of the eMMC (it will warn you about that
do that just before it starts).

You can boot from the SD card (non-installer version) and use that as
somewhere to stand to backup eMMC if you need to.

@danielt

yes, Then I think I will to use ‘dd’ utility take backup for ‘/usr/’ directory.

@danielt

yes, Then I think I will to use ‘dd’ utility take backup for ‘/usr/’ directory.

Either that or mount the rootfs and then rsync -vaxHAX /mnt/sysimage $HOME/emmc_backup.

This is a good approach if you expect to restore individual files from
the backup (rather than restore the whole image) since there’s no need
for loop back mounts.

@danielt

Yes, Thank You for good idea. But .

every time when i do ‘update and upgrade’ and after reboot, My desktop fails to load. And this is not first time.
Is there any solution for this?
Because every time after ‘sudo apt-get update and upgrade’ the LxQt desktop fails to load.
What to do here, ?

Thanks