Page 1 of 1

PCANbasic compilation problem on Linux

Posted: Sun 18. May 2014, 12:56
by felixlechat
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 ?

Re: PCANbasic compilation problem on Linux

Posted: Sun 18. May 2014, 22:40
by felixlechat
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 ?

Re: PCANbasic compilation problem on Linux

Posted: Mon 19. May 2014, 11:37
by PEAK-Support
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.

Re: PCANbasic compilation problem on Linux

Posted: Thu 24. Jul 2014, 17:43
by b.blattmann
Hi,

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

Re: PCANbasic compilation problem on Linux

Posted: Thu 24. Jul 2014, 19:51
by PEAK-Support
no, the new version is not online - please simply remove all referenzes to the serial number in the header files.

Re: PCANbasic compilation problem on Linux

Posted: Wed 6. Aug 2014, 16:10
by H.Mueller
peak-linux-driver-7.12 is online with still the same problem :o

Re: PCANbasic compilation problem on Linux

Posted: Wed 6. Aug 2014, 16:24
by M.Maidhof
Hi,

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

regards

Michael

Re: PCANbasic compilation problem on Linux

Posted: Thu 14. Aug 2014, 16:11
by PEAK-Support
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;
			}