Error! Cannot load library pcanbasic
I am trying to communicate with CAN interface via peakcan hardware, this is the link that I follow https://doc.qt.io/qt-5.11/qtserialbus-peakcan-overview.html
Program is run without errors if I dont use peakcan interface in the code
The error is : Cannot load library pcanbasic: (pcanbasic: cannot open shared object file: No such file or directory)
Hardware is connected successfully, when I "dmesg" on the console it outputs
91929.495137] peak_usb 1-11:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial FFFFFFFF (1 channel) [91929.495564] peak_usb 1-11:1.0 can0: attached to PCAN-USB channel 0 (device 20)
this is my sample code, and this line couldn't run also, error occurs here.
QCanBusDevice *device = QCanBus::instance()->createDevice( QStringLiteral("peakcan"), QStringLiteral("can0"));
and also if I try to run my application it outputs to the kernel an error, which is shown when I type 'dmesg'
segfault at 8 ip 00007f1fe3409049 sp 00007ffebd9e07b0 error 4 in libQt5SerialBus.so.5.10.0[7f1fe33fc000+40000]
Before that I connected a real BMS' can line, it worked well, but now I am trying to make CAN Simulator via using PeakCan, and this is where I found myself.
Thanks for help people.
Hi @xmastree, welcome!
Cannot load library pcanbasic: (pcanbasic: cannot open shared object file: No such file or directory)
The error is very obvious, it cannot load the shared library pcanbasic.so - therefore your program crashes.
So please tell us:
- where the library
- Which Qt version you are using?
- where the library
I am using Qt 5.10
and pcanbasic.so outputs I will provide 1-2 hours later, I am so sorry about that, little far away from computer,
Any suggestion after outputting
Seems, you can try a generic SocketCAN plugin (as I assume, you work on Linux) too. I'm think, the Linux kernel already contains an appropriate PCAN drivers.
Yes ı am working on linux, but the problem is, I have peak hardware, so I should use it, and also in Qt there is peak interface, So how can I use it, or how can I add the pcanbasic library, how to make it work ?
Thanks for helps
On Linux you can indeed use SocketCAN, please see https://doc.qt.io/qt-5.11/qtserialbus-socketcan-overview.html
Peak hardware has a good support here, if your Linux Kernel is recent enough and has the Peak SocketCAN driver included.
If you like to use the Peak proprietary driver and library, you have to compile the Peak driver and PCAN-Basic library yourself:
Can I use SocketCAN to send and receive can messages from connected PEAK Hardware.
I mean it could be possible, because connected PEAK Hardware also using can0...
What is your opinion ?
I found the solution, whether or not using PEAK hardware does not matter, SocketCAN is a general purpose Can driver, so if your CAN hardware connected at can0, usb1, usb2 etc. you dont need to use peakcan interface because of your hardware is PEAKCAN, you could connect it via socketcan.