"No such plugin: 'socketcan'"
-
I'm using QT 6.6 android arm64-v8A, and i need to build a interface that communicates through CAN protocol.
When I deploy the App to the board, I got this error "No such plugin: 'socketcan'".
Does anyone knows how to fix it?
We tried to cross building libqtsocketcan, and when we deploy the application the erros changed to the ones bellow.
W qt.canbus.plugins.socketcan: : Cannot load library socketcan: (dlopen failed: library "socketcan" not found)
I qt.canbus.plugins.socketcan: : Cannot load library libsocketcan, some functionality will not be available.
I qt.canbus.plugins.socketcan: Cannot load library socketcan: (dlopen failed: library "socketcan" not found)thanks.
-
@LeonardoL
It seems like working, right?
I don't know why it still gives the plugin not found error. It is weird.Check my issue. I wrote "SELinux allow" policies for Qt socketcan apps on Enforcing mode. If you have android source code of your device, you can add the policy in the source code.
My issue: https://bugreports.qt.io/browse/QTBUG-118600 -
Hi and welcome to devnet,
Did you also deploy the plugin's dependencies ?
-
Hi,
Qt does not provide "socketcan" support for android by default.
Download the "qtserialbus" repo from Github.
Link: https://github.com/qt/qtserialbus/tree/6.6Comment out the "if not Android" and "only Linux" conditions within the cmake files. Compile and install. So you get all plugins for Android including "socketcan".
Check this 3 files:
https://github.com/qt/qtserialbus/blob/6.6/tests/auto/CMakeLists.txt -> comment out line 25 and 27https://github.com/qt/qtserialbus/blob/6.6/src/serialbus/configure.cmake -> comment out line 32 and 36
https://github.com/qt/qtserialbus/blob/6.6/src/tools/CMakeLists.txt -> comment out line 6
Make sure you are using the correct version of the "qtserialbus" repo .
Make sure you are using android cmake of Qt. (in your 6.6 sources. Like this /home/ubuntu/Qt/6.6/android_arm64_v8a/bin/qt-cmake)And check it out: https://blog.csdn.net/qq_19649851/article/details/126227486
https://bugreports.qt.io/browse/QTBUG-118600 -
@LeonardoL said in "No such plugin: 'socketcan'":
which plugins?
qt.canbus.plugins.socketcan
Did you deploy the dependencies of this plug-in?
-
@jsulm i've put
libplugins_canbus_qtsocketcanbus_arm64-v8a.so, libplugins_canbus_qtpassthrucanbus_arm64-v8a.so, libplugins_canbus_qtpeakcanbus_arm64-v8a.so, libplugins_canbus_qttinycanbus_arm64-v8a.so, libplugins_canbus_qtvirtualcanbus_arm64-v8a.soNow i'm trying to cross compile libsocketcan.so to aarch64.
-
@LeonardoL
I'm using 6.5.3. I did it as described above and I use it flawlessly. I recommend you compile and install the whole qtcanbus project. Just compiling the plugin and putting it into the project file does not work. I tried it too and it didn't work. -
@osos11 I did as you mentioned earlier and i got this log when i deploy my application to my board.
Additionally i set this parameters on the board.
setenforce 0 ip link set can0 up type can bitrate 250000
Log when the application was deployed
D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 1010109; state: ENABLED W ziparchive: Unable to open '/data/app/~~Z9lSHxcSdAN667SHOjZS4g==/teste.qmake-YkNiMRALxdP-xXK51Dmo4A==/base.dm': No such file or directory W ziparchive: Unable to open '/data/app/~~Z9lSHxcSdAN667SHOjZS4g==/teste.qmake-YkNiMRALxdP-xXK51Dmo4A==/base.dm': No such file or directory V GraphicsEnvironment: ANGLE Developer option for 'teste.qmake' set to: 'default' V GraphicsEnvironment: ANGLE GameManagerService for teste.qmake: false V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported. D NetworkSecurityConfig: No Network Security Config specified, using platform default D NetworkSecurityConfig: No Network Security Config specified, using platform default I RenderThread: type=1400 audit(0.0:100): avc: denied { open } for path="/dev/__properties__/u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=319 scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=1 I RenderThread: type=1400 audit(0.0:101): avc: denied { getattr } for path="/dev/__properties__/u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=319 scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=1 W System : ClassLoader referenced unknown path: I RenderThread: type=1400 audit(0.0:102): avc: denied { map } for path="/dev/__properties__/u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=319 scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=1 I QtCore : Start I Qt : qt started D CompatibilityChangeReporter: Compat change id reported: 210923482; UID 1010109; state: DISABLED D CompatibilityChangeReporter: Compat change id reported: 37756858; UID 1010109; state: ENABLED E OpenGLRenderer: Device claims wide gamut support, cannot find matching config, error = EGL_SUCCESS W OpenGLRenderer: Failed to initialize 101010-2 format, error = EGL_SUCCESS I display : open gpu gralloc module! E OpenGLRenderer: Unable to match the desired swap behavior. W Parcel : Expecting binder but got null! W Qt A11Y : Could not (yet) activate platform accessibility. W qt.canbus.plugins.socketcan: : Cannot load library socketcan: (dlopen failed: library "socketcan" not found) I qt.canbus.plugins.socketcan: : Cannot load library libsocketcan, some functionality will not be available. I qt.canbus.plugins.socketcan: Cannot load library socketcan: (dlopen failed: library "socketcan" not found) W qt.canbus.plugins.socketcan: : Function can_set_bitrate() is not available. W qt.canbus.plugins.socketcan: : Cannot apply parameter: 4 with value: 500000. D libteste_Android_Qmake_arm64-v8a.so: QList("passthrucan", "peakcan", "socketcan", "tinycan", "virtualcan") I qtMainLoopThrea: type=1400 audit(0.0:103): avc: denied { create } for scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tclass=can_socket permissive=1 I qtMainLoopThrea: type=1400 audit(0.0:104): avc: denied { ioctl } for path="socket:[234517]" dev="sockfs" ino=234517 ioctlcmd=0x8933 scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tclass=can_socket permissive=1 I qtMainLoopThrea: type=1400 audit(0.0:105): avc: denied { bind } for scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tclass=can_socket permissive=1 I qtMainLoopThrea: type=1400 audit(0.0:106): avc: denied { setopt } for scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tclass=can_socket permissive=1 D libteste_Android_Qmake_arm64-v8a.so: 0 D libteste_Android_Qmake_arm64-v8a.so: 0 D libteste_Android_Qmake_arm64-v8a.so: 0 I qtMainLoopThrea: type=1400 audit(0.0:107): avc: denied { read } for scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tclass=can_socket permissive=1 D libteste_Android_Qmake_arm64-v8a.so: true D libteste_Android_Qmake_arm64-v8a.so: false I qtMainLoopThrea: type=1400 audit(0.0:108): avc: denied { read } for scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tclass=can_socket permissive=1 I qtMainLoopThrea: type=1400 audit(0.0:109): avc: denied { ioctl } for path="socket:[234517]" dev="sockfs" ino=234517 ioctlcmd=0x8906 scontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tcontext=u:r:untrusted_app_30:s0:c109,c256,c522,c768 tclass=can_socket permissive=1
-
@LeonardoL
It seems like working, right?
I don't know why it still gives the plugin not found error. It is weird.Check my issue. I wrote "SELinux allow" policies for Qt socketcan apps on Enforcing mode. If you have android source code of your device, you can add the policy in the source code.
My issue: https://bugreports.qt.io/browse/QTBUG-118600 -
-
@LeonardoL
I did some research and realized there is another library called libsocketcan. When the application starts, it searches for that library. Apps gives a warning if apps cannot find libsocketcan.
I compiled and tested the libsocketcan library for Android. I couldn't test the "resetController" function because my can devices never entered to "BusOff" state. Also, "BusStatus" functions works fine. If you would like to include libsocketcan in your project, I shared it on my github page.Check the two functions at the bottom of the page : https://doc.qt.io/qt-6/qtserialbus-socketcan-overview.html
Libsocketcan sources: https://github.com/lalten/libsocketcan/tree/master
My github for precompiled libsocketcan : https://github.com/osos11-Git/libsocketcan_android
You should add the following to your .pro project file:
$$PWD -> your project directoryandroid:arm64-v8a:LIBS += -L/$$PWD/android_libs/libsocketcan/lib -lsocketcan android:arm64-v8a:INCLUDEPATH += /$$PWD/android_libs/libsocketcan/include android:arm64-v8a:DEPENDPATH += /$$PWD/android_libs/libsocketcan/include contains(ANDROID_TARGET_ARCH,arm64-v8a) { ANDROID_EXTRA_LIBS = \ $$PWD/android_libs/libsocketcan/lib/libsocketcan.so }
-
@osos11 said in "No such plugin: 'socketcan'":
android:arm64-v8a:LIBS += -L/$$PWD/android_libs/libsocketcan/lib -lsocketcan
android:arm64-v8a:INCLUDEPATH += /$$PWD/android_libs/libsocketcan/include
android:arm64-v8a:DEPENDPATH += /$$PWD/android_libs/libsocketcan/includeIt worked. Thank you again. you've saved me :D
-
@LeonardoL
You are welcome.Can you click on the link below and do what is said in the last 1-2 messages so that the Selinux problem can at least be investigated by Qt, or can you at least share a log( with device specs, at least Android version etc.) indicating that you have the same problem in the link?
https://bugreports.qt.io/browse/QTBUG-118600
Thanks!