PCANbasic compilation problem on Linux

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
felixlechat
Posts: 2
Joined: Sun 18. May 2014, 12:21

PCANbasic compilation problem on Linux

Post by felixlechat » Sun 18. May 2014, 12:56

Hello,

I have some trouble compiling pcanbasic on linux (ubuntu 12.04).
The peak-linux-driver-7.11 compiled and installed like a charm. (Juste needed a apt-get install libpopt-dev)
Now as I wanted to use the Java API, I downloaded PCAN_Basic_Linux-2.0.2.tar.gz

So I tried to compile the libpcanbasic, and I am encountering the following error:

/PCAN_Basic_Linux-2.0.2/pcanbasic $ make
# ln -sf ../driver/pcan.h pcan.h
g++ src/libpcanbasic.cpp -fPIC -shared -O2 -Wall -Wl,-soname,libpcanbasic.so.0 -lc -I. -I../driver -DNO_RT -o libpcanbasic.so.0.1
src/libpcanbasic.cpp: In function ‘__u32 CAN_SetValue(__u8, __u8, void*, __u32)’:
src/libpcanbasic.cpp:1477:26: error: ‘SF_SET_SERIALNUMBER’ was not declared in this scope
make: *** [libpcanbasic.so.0.1] Error 1

I tried to copy the /usr/include/pcan.h file into the src directory, but error is still here.

Do you please have any hint or help on this problem ?

felixlechat
Posts: 2
Joined: Sun 18. May 2014, 12:21

Re: PCANbasic compilation problem on Linux

Post by felixlechat » Sun 18. May 2014, 22:40

I have tried some test which may be usefull:

diff peak-linux-driver-7.10/driver/pcan.h peak-linux-driver-7.11/driver/pcan.h
32c32
< // $Id: pcan.h 753 2014-01-21 10:45:03Z stephane $
---
> // $Id: pcan.h 766 2014-04-17 09:03:30Z stephane $
176d175
< #define SF_SET_SERIALNUMBER 2 // to set the serial number (currently only pcan-usb)
185c184
< DWORD dwSerialNumber; // to get and set the pcan-usb serial number
---
> DWORD dwSerialNumber; // to get the pcan-usb serial number



I just tried to compile with peak-linux-driver-7.10 and it worked.
So It is maybe a bug in peak-linux-driver-7.11 ?

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: PCANbasic compilation problem on Linux

Post by PEAK-Support » Mon 19. May 2014, 11:37

Hi, you are right - this is a bug in the PCAN Basic Lib. The serial number function was removed from the driver because of non functionality with newer hardware. It was never been used - it´s a historical feature for very old hardware only, but we have miss to remove this also from the PCAN Basic Lib. We will update the PCAN Basic LIB within the next days.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

b.blattmann
Posts: 1
Joined: Thu 24. Jul 2014, 17:23

Re: PCANbasic compilation problem on Linux

Post by b.blattmann » Thu 24. Jul 2014, 17:43

Hi,

i had the same problem, is the new PCAN Basic LIB already available?

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: PCANbasic compilation problem on Linux

Post by PEAK-Support » Thu 24. Jul 2014, 19:51

no, the new version is not online - please simply remove all referenzes to the serial number in the header files.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

H.Mueller
Posts: 6
Joined: Wed 6. Aug 2014, 16:05

Re: PCANbasic compilation problem on Linux

Post by H.Mueller » Wed 6. Aug 2014, 16:10

peak-linux-driver-7.12 is online with still the same problem :o

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: PCANbasic compilation problem on Linux

Post by M.Maidhof » Wed 6. Aug 2014, 16:24

Hi,

don´t mix up the driver version with the PCANbasic library. There is no new PCANBasic library available at the moment

regards

Michael

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: PCANbasic compilation problem on Linux

Post by PEAK-Support » Thu 14. Aug 2014, 16:11

Until we have not update the package, please remove this part inside the libpcanbasic.cpp and it will work.

Code: Select all

		case PCAN_DEVICE_NUMBER:
			if (BufferLength < sizeof(int)) {
				Result = PCAN_ERROR_ILLPARAMVAL;
				goto leave;
			}
			TPEXTRAPARAMS Params;
			Params.nSubFunction = SF_SET_SERIALNUMBER;
			Params.func.dwSerialNumber = *((int*) Buffer);
			if (__ioctl(desc->nFileNo, PCAN_EXTRA_PARAMS, &Params) < 0) {
				Result = PCAN_ERROR_UNKNOWN;
				goto leave;
			}
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply