I am facing some problem while cross compiling OpenCV library for RISCV architecture.

asked 2018-08-02 23:50:36 -0600

I am trying to cross compiling OpenCV library on X-86 (Platform) for riscv architecture,but i am getting some errors.Please can any one help me regarding these errors.

command used for cross compile :--

cmake -DCMAKE_TOOLCHAIN_FILE=../riscv.toolchain.cmake ../../.. -DWITH_PNG=OFF -DWITH_QT=ON -DWITH_GTK_2_X=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_ZLIB=ON -DBUILD_opencv_dnn=OFF -DBUILD_EXAMPLES=ON -DBUILD_LIST=core,highgui -DCMAKE_EXE_LINKER_FLAGS="-static"

Error Details:

In file included from /usr/include/qt4/QtCore/qatomic_arch.h:88:0, from /usr/include/qt4/QtCore/qbasicatomic.h:213, from /usr/include/qt4/QtCore/qatomic.h:46, from /usr/include/qt4/QtCore/qbytearray.h:45, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/qabstracteventdispatcher.h:45, from /usr/include/qt4/QtCore/QAbstractEventDispatcher:1, from /home/billa/Downloads/opencv-3.4.2/platforms/linux/riscv_build/modules/highgui/src/../../../../../../modules/highgui/src/window_QT.h:54, from /home/billa/Downloads/opencv-3.4.2/platforms/linux/riscv_build/modules/highgui/src/moc_window_QT.cxx:9: /usr/include/qt4/QtCore/qatomic_x86_64.h: In static member function 'static void GuiReceiver::qt_static_metacall(QObject, QMetaObject::Call, int, void)': /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:121:29: error: impossible constraint in 'asm' : "memory"); ^ /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint ... (more)

edit retag flag offensive close merge delete

Comments

it's the same as with all your previous questions: you have to either disable all 3rd party dependancies, or cross-compile those from src. and the latter is probably not possible for gui libs like qt or gtk.

berak gravatar imageberak ( 2018-08-03 01:05:51 -0600 )edit

When I am trying to use -DWITH_QT=ON flag in my command configurations not done correctly and I am getting errors while executing make -j8.

Billa Surendra gravatar imageBilla Surendra ( 2018-08-03 04:00:34 -0600 )edit

you cannot use your x86 Qt on risc anyway, so you have to disable it. same for gtk, and a lot of others.

berak gravatar imageberak ( 2018-08-03 04:06:11 -0600 )edit

Especially when I am using a -DWITH_QT=ON in my command for cross compiling for riscv.I am getting following error :--

*/usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in 'asm' : "memory"); ^ modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:131: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o' failed make[2]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o] Error 1 CMakeFiles/Makefile2:3233: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed make[1]: [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 make[1]: Waiting for unfinished jobs....*

Billa Surendra gravatar imageBilla Surendra ( 2018-08-07 03:21:10 -0600 )edit