Arrayfire/openCV 4.2 Problem

Skip to first unread message

matthieu debailleul

Apr 25, 2022, 8:45:30 AMApr 25
to ArrayFire Users
i'm using Arrayfire 3.8 and everything is fine with arrayfire alone, but I get an error when i try to use openCV 4.2 :

cv::Mat img=cv::imread("/home/mat/i017.bmp",CV_8UC1);
//<- this line causes the error

Arrayfire give me the following error :

 ArrayFire Exception (Unknown error:999):

In function setDevice
In file src/api/cpp/device.cpp:77

Am i missing something ?

Umar Arshad

May 12, 2022, 1:58:45 PMMay 12
to ArrayFire Users
Hey Matthieu,

I don't have enough information here to debug this issue. You could get more information regarding the
error details by setting the AF_PRINT_ERRORS=1 environment variable. I suspect there is an issue
with the standard c++ library incompatibilities of the two projects. How did you install the two libraries?
Which system are you running this on?

You could LD_PRELOAD the system libstdc++ and see if that fixes the issue. If not then I would need
more information about how you installed the libraries and the OS you are running this on.


Matthieu Debailleul

May 16, 2022, 9:22:14 AMMay 16
to Umar Arshad, ArrayFire Users
Hi Umar,
thank you for this answer :)
Actualy l solved the problem with a workaround. At first, I manually installed arrayfire 3.8.1  and linked to the libraries/includes files (typically in /opt/arrayfire/ on Linux).
For an unknown reason, this causes a crash with openCV.
After some testing, i noticed that OpenCL backend (from ubuntu repositories) was ok, but this repo had no Cuda backend. So i installed arrayfire from the regular PPA (, with Cuda 10.2), and everything is fine  now.

Anyway, thanks again for your time :)


De: "Umar Arshad" <>
À: "ArrayFire Users" <>
Envoyé: Jeudi 12 Mai 2022 19:58:45
Objet: Re: Arrayfire/openCV 4.2 Problem

You received this message because you are subscribed to a topic in the Google Groups "ArrayFire Users" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit

logo de l'UHA
Debailleul Matthieu
Laboratoire MIPS,
IUT Mulhouse
Université de Haute-Alsace
61 rue A. Camus - 68093 Mulhouse Cedex

Téléphone : +33 (0) 
Télécopie : +33 (0)

Reply all
Reply to author
0 new messages