Test and Measurement Forum

Problem when compiling PS2000con.c

Post your Linux discussions here

Problem when compiling PS2000con.c

Postby FBL » Sun Jul 07, 2013 6:17 am

Hi,
I have a Picoscope 2207 and my PC is running Ubuntu 12.04.
To use the Pico, I run Picoscope 6 under Windows XP running itself in Virtual Box (it works fine except some troubles with the channel triggering).
I'd like to develop myself some C applications under Linux for my PicoScope.
I downloaded libps2_3000_R3_6_4_4_1.x86_64.tgz from you website and followed the README and INSTALL instructions.
I can see the PicoScope ok using usbtest but I can't compile the PS2000con.c file.
I got the following messages (I copy/past only the begining since it is several pages long) :

/tmp/ccJzSEHx.o: In function `set_defaults':
PS2000con.c:(.text+0x389): undefined reference to `ps2000_set_ets'
PS2000con.c:(.text+0x3f5): undefined reference to `ps2000_set_channel'
/tmp/ccJzSEHx.o: In function `set_trigger_advanced':
PS2000con.c:(.text+0x55d): undefined reference to `ps2000SetAdvTriggerChannelConditions'


I tried several things (remove all the PREF0 to PREF4 in ps2000.h for exemple), used Code::Blocks to compile (and got the same kind of messages), changed the driver to libps2000_2.0.7.7-2_amd64.deb (found on http://code.google.com/p/qpicoscope/) and read most of your forum concerning Linux.
If I rename differently ps2000.h, then the error is different (PS2000con.c:64:30: erreur fatale: libps2000/ps2000.h : Aucun fichier ou dossier de ce type, compilation terminée.) meaning that the header file is correctly found when it is properly named.

Since many people seem to compile without any trouble (other troubles may come later), I think that I'm probably missing something, may be a very simple one.

So, if anybody has an idea to help me solve this problem, I thank him in advance.
FBL
Newbie
 
Posts: 0
Joined: Sun Jul 07, 2013 5:09 am

Re: Problem when compiling PS2000con.c

Postby Martyn » Mon Jul 08, 2013 1:00 pm

The driver you have downloaded is for the 2203/4/5, which will not work for your device.

You will need to download the correct version from http://www.picotech.com/software.html by chosing 2207 at Step1
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2287
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problem when compiling PS2000con.c

Postby FBL » Tue Jul 09, 2013 2:12 am

Thank you for your quick repply.
I omitted to indicate that it is what I did first. But it didn't work, so I looked in this forum and understood (wrongly) that the libps2_3000_R3_6_4_4_1.x86_64.tgz could do it.
Actually, when I install the driver proposed for 2207, the installation seem to be done ok but there is no library nor header file in /usr/local (nor anywhere else). The Picoscope is correctly found by "usbtest" but I can't compile "PS2000Acon.c".
Is it because I'm using a 64bits version of Ubuntu?
FBL
Newbie
 
Posts: 0
Joined: Sun Jul 07, 2013 5:09 am

Re: Problem when compiling PS2000con.c

Postby Martyn » Tue Jul 09, 2013 8:02 am

I have just tried with the attached package and it is working. Please note that you need to follow the instructions in Install and Readme files and test with usbtest to ensure you can open and read the device from the user account
Code: Select all
sudo dpkg -i ps2000alinux_1.0-1_i386.deb
gcc PS2000Acon.c -m32 -oPS2000Acon -lps2000a -lusb_pico-1.0

Code: Select all
PS2000A driver example program
Version 2.0



Opening the device...
Handle: 1
Device opened successfully, cycle 1

Driver Version: PS2000A Linux Driver, development version
USB Version: 1.1
Hardware Version: 1
Variant Info: 2207
Serial: AS612/044


Readings will be scaled in (mV)
Channel A Voltage Range = 5V
Channel B Voltage Range = 5V


B - Immediate block                           V - Set voltages
T - Triggered block                           I - Set timebase
E - Collect a block of data using ETS         A - ADC counts/mV
R - Collect set of rapid captures             G - Signal generator
S - Immediate streaming
W - Triggered streaming
                                              X - Exit

Operation:
Attachments
ps2000alinux.tar.gz
(904.24 KiB) Downloaded 197 times
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2287
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problem when compiling PS2000con.c

Postby FBL » Wed Jul 10, 2013 2:03 am

This time, it goes farther and the message is different.
Here are the details of what I did :

- I uninstalled the previous pacakage and installed the one attached to your reply.
Result was (sorry, it's partly in french) :
Sélection du paquet ps2000alinux:i386 précédemment désélectionné.
(Lecture de la base de données... 838959 fichiers et répertoires déjà installés.)
Dépaquetage de ps2000alinux:i386 (à partir de ps2000alinux_1.0-1_i386.deb) ...
Paramétrage de ps2000alinux:i386 (1.0-1) ...
Traitement des actions différées (« triggers ») pour « libc-bin »...
ldconfig deferred processing now taking place


- Then I connected the Pico2207 and ran "usbtest" wich replied (among other messages) : Pico USB device found: /dev/bus/usb/001/006

- Then, after having copied "PS2000Acon.c" in /usr/local/src where I usually put my C source files, I copy/past your formula and got :
fred@Atoll:/usr/local/src$ gcc PS2000Acon.c -m32 -oPS2000Acon -lps2000a -lusb_pico-1.0
In file included from /usr/include/stdio.h:28:0,
from PS2000Acon.c:43:
/usr/include/features.h:324:26: erreur fatale: bits/predefs.h : Aucun fichier ou dossier de ce type
compilation terminée.

which means that it didn't find "bits/predefs.h".

- I found this file in usr/include/x86_64-linux-gnu so I added "-I/usr/include/x86_64-linux-gnu" to the compilation command.
The result now is :
In file included from /usr/include/features.h:389:0,
from /usr/include/stdio.h:28,
from PS2000Acon.c:43:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:7:27: erreur fatale: gnu/stubs-32.h : Aucun fichier ou dossier de ce type
compilation terminée.


- And now I am stuck because I got only "stubs.h" and "stubs-64.h" in the /usr/include/x86_64-linux-gnu/gnu directory and I can't find it anywhere else.

By the way, is it planned to release a 64bits version of the Linux driver for 2207?
FBL
Newbie
 
Posts: 0
Joined: Sun Jul 07, 2013 5:09 am

Re: Problem when compiling PS2000con.c

Postby Martyn » Wed Jul 10, 2013 6:48 am

You may need to install gcc-multilib to get past these errors
Code: Select all
sudo apt-get install gcc-multilib

We are currently working to restructure our build processes so that we can produce 32bit/64bit Windows/Linux at the same time.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2287
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problem when compiling PS2000con.c

Postby FBL » Thu Jul 11, 2013 12:30 am

You may need to install gcc-multilib to get past these errors

Ok, it works now! Compiling "PS2000Acon.c" without any error and running it ok.

We are currently working to restructure our build processes so that we can produce 32bit/64bit Windows/Linux at the same time.

That would be great and will make easier the updates.

Many thanks to you for your very helpful support.
I have enough to work on for a while now.
FBL
Newbie
 
Posts: 0
Joined: Sun Jul 07, 2013 5:09 am


Return to Linux

Who is online

Users browsing this forum: No registered users and 0 guests