LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa on Linux

OK, so I'm testing CVI on Linux.
Works fine with console progs and UIR progs, but I have a problem when I try
to compile a visa program:
cvicc EzUsbVisa.prj
..../cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x28): In function
`OutErrMsg':
: undefined reference to `viStatusDesc'
..../cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x154): Infunction
`UsbHandler':
: undefined reference to `viGetAttribute'
..../cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x180): Infunction
`UsbHandler':
: undefined reference to `viGetAttribute'
..../cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x193): Infunction
`UsbHandler':
: undefined reference to `viClose'
..../cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x308): Infunction
`ConnectUSB':
: undefined reference to `viDisableEvent'

Linker problem ?

I installed VISA during the installation process, is there a way to check
that the installation is correct ? There's no visa code in the list of
samples in /usr/local/natinst/cvi80/samples

I'm using a RedHat derivative with a vanilla kernel 2.6.20.7
There was an error during installation of NiDAQmx, but since I don't
currently need it I'm doing without.

Thanks
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 1 of 8
(6,619 Views)
Something's definetly not right with VISA. I'll add a few more elements and
questions:

- This page
(http://digital.ni.com/public.nsf/allkb/C9858CB0446896A786256BB800503692)
troubleshoots another issue, including VISA:

* Where should the VXIPNPPATH variable be defined ? I can easily do it in
my .bashrc, but I suspect it should be better at a system level, no ?
* libvisa.so and libvisa.so.7 seem correct, but what is ld_library_path ? I
have no such executable (is that what they mean by 'query' ?) on my system,
even though a variable with the same name is optional but should be avoided
(just google for it).
* running visaconf as a user or root returns "aborted" with $?=134
* I've tried adding LD_LIBRARY_PATH and VXIPNPPATH to my bashrc and no
change.

- The Instrument Control in Linux Tutorial
(http://zone.ni.com/devzone/cda/tut/p/id/2816) talks about visaconf and
visaic. If I try to run NIvisaic, I get the exact same error messages.

A search on NIvisaic, visaic, visaconf, aborted, 134 or similar combinations
does not yield anything.


SO, after this I decided to try a reinstall, downloaded NI-VISA-4.1.0.iso
and ran ./INSTALL. All went well except the NI-KAL post-install script:
....
Uninstalling NI-KAL (nikal): done
/bin/rm -rf objects
Updating NI-KAL:
NI-KAL update failed.

/bin/cp nikal.c objects/nikal.c
/bin/cp nikal.h objects/nikal.h
make -C /lib/modules/2.6.20.7/source
SUBDIRS=/usr/local/natinst/nikal/src/objects modules
make[1]: Entering directory `/usr/src/linux-2.6.20.7'
CC [M] /usr/local/natinst/nikal/src/objects/nikal.o
/usr/local/natinst/nikal/src/objects/nikal.c:34:26: linux/config.h: No such
file or directory
include/linux/pci.h: In function `nNIKAL100_registerPCIDriver':
/usr/local/natinst/nikal/src/objects/nikal.c:2667: warning: ignoring return
value of `pci_register_driver', declared with attribute warn_unused_result
/usr/local/natinst/nikal/src/objects/nikal.c: In function
`nNIKAL100_buildControlURB':
/usr/local/natinst/nikal/src/objects/nikal.c:3422: warning: passing arg 7 of
`usb_fill_control_urb' from incompatible pointer type
/usr/local/natinst/nikal/src/objects/nikal.c: In function
`nNIKAL100_buildBulkURB':
/usr/local/natinst/nikal/src/objects/nikal.c:3447: warning: passing arg 6 of
`usb_fill_bulk_urb' from incompatible pointer type
/usr/local/natinst/nikal/src/objects/nikal.c: In function
`nNIKAL100_buildInterruptURB':
/usr/local/natinst/nikal/src/objects/nikal.c:3498: warning: assignment from
incompatible pointer type
/usr/local/natinst/nikal/src/objects/nikal.c: In function
`nNIKAL100_buildIsochronousURB':
/usr/local/natinst/nikal/src/objects/nikal.c:3539: warning: assignment from
incompatible pointer type
/usr/local/natinst/nikal/src/objects/nikal.c:3644:48: macro "INIT_WORK"
passed 3 arguments, but takes just2
/usr/local/natinst/nikal/src/objects/nikal.c: In function
`nNIKAL100_usbClearHaltAsync':
/usr/local/natinst/nikal/src/objects/nikal.c:3643: error: `INIT_WORK'
undeclared (first use in this function)
/usr/local/natinst/nikal/src/objects/nikal.c:3643: error: (Each undeclared
identifier is reported only once
/usr/local/natinst/nikal/src/objects/nikal.c:3643: error: for each function
it appears in.)
/usr/local/natinst/nikal/src/objects/nikal.c: In function
`nNIKAL100_reserveInterrupt':
/usr/local/natinst/nikal/src/objects/nikal.c:3946: warning: passing arg 2 of
`request_irq' from incompatible pointer type
/usr/local/natinst/nikal/src/objects/nikal.c: At top level:
/usr/local/natinst/nikal/src/objects/nikal.c:3577: warning:
'nNIKAL100_usbClearHaltSynchronous' defined but not used
make[2]: *** [/usr/local/natinst/nikal/src/objects/nikal.o] Error 1
make[1]: *** [_module_/usr/local/natinst/nikal/src/objects] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.20.7'
make: *** [objects/nikal.ko] Error 2

ERROR: make of nikal kernel module failed, not installing kernel module.
updateNIDrivers
0 Kudos
Message 2 of 8
(6,598 Views)
Hi Guillaume,
 
There is a lot of information given here, so it's hard to find the main problem to troubleshoot.  First, you said you are using a Red Hat derivative.  Is there a particular version of RedHat that you are using here?  Also, have you tried installing NI-KAL separately to see if that gets the installation any further?  You can download NI-KAL by going to our drivers and updates page and searching for "Other Software>>NI-KAL".  You can also click here to access the search results.  Once we get NI-KAL to successfully install, that's a good first step.  As this page states, we do support Red Hat, but if your derivative is too different from the original, then you may run into problems.
 
Please try these suggestions and let me know how it works.  Have a great day!
Chris R.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 8
(6,551 Views)
Hello Chris,
Thanks for the answer, sorry I was a little long in posting back as I was on
vacation. I hope someone still sees this thread...

I'm using Scientific Linux 4.4, which is based very closely on Enterprise
Linux, with only a few minor additions or changes. The kernel is a vanilla
2.6.20.7 without any .config change (I'll do that once things work or when
it's necessary). KDE is 3.3.1-6.RHEL4, gcc 3.4.6

So I assumed it was a kernel compilation issue and I reverted to the
original Red Hat kernel (2.6.9). And Visa installed fine... When installing
my own kernel, I didn't actually follow the specific Red Hat procedure
(up2date kernel-devel or similar), but just downloaded the tar file from
kernel.org and compiled from that. I'll see some other time about how to
compile it according to RH guidelines.

For now it seems to work.
Thanks.
--
Guillaume Dargaud
http://www.gdargaud.net/
"The only thing standing between me and total happiness is reality." -
Douglas Porter.


0 Kudos
Message 4 of 8
(6,490 Views)
OK, I'm not completely out.
I can plug my usb device and see it with /dev/bus/usb/devices

But if I run visaconf, I don't see it.

If I run driverwizard, the USB option is greyed out.

And if I try to compile a program that uses VISA calls, I get linking
errors:

$ cvicc EzUsbVisa.prj
Building EzUsbVisa.prj...
/informatique/dargaud/Informatique/nEDM/VisaDriver/cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x28):
In function `OutErrMsg':
: undefined reference to `viStatusDesc'
/informatique/dargaud/Informatique/nEDM/VisaDriver/cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x154):
In function `UsbHandler':
: undefined reference to `viGetAttribute'
/informatique/dargaud/Informatique/nEDM/VisaDriver/cvibuild.EzUsbVisa/EzUsbVisaCtrl.niobj(.text+0x180):
In function `UsbHandler':
: undefined reference to `viGetAttribute'
....
collect2: ld returned 1 exit status
Build failed.


$ locate libvisa
/usr/local/lib/libvisa.so
/usr/local/vxipnp/linux/bin/libvisa.so.7
/usr/local/vxipnp/linux/bin/libvisa.so


$ env | grep -i ld
LD_LIBRARY_PATH=/utils/ROOT/lib:/usr/local/vxipnp/linux/bin
DYLD_LIBRARY_PATH=/utils/ROOT/lib

That same program compiles fine on Windows. Is there some missing library ?
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 5 of 8
(6,485 Views)
Add -lvisa to the end of the cvicc command line.  Because CVI does not compile or link your program on Linux we can't detect which libraries you are using, so we only link to the core CVI libraries. If you always use a particular set of libraries you can add them to the default link list by editing the file /usr/local/natinst/cvi80/bin/compile.ecc and adding the basename of the library to the line that starts with USE_LIBRY. If you add libraries to the link list any machine the target binary is deployed to must have *all* of the libraries specified in the link.

-Michael
NI
0 Kudos
Message 6 of 8
(6,476 Views)
> Add -lvisa to the end of the cvicc command line.

Thanks, that's pretty obvious in retrospect.

Now as to Visa not seing my USB device (either in my prog or in visaconfig
or driverwizard) while I see it in /proc/bus/usb/devices
I feel like there's a step missing.
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 7 of 8
(6,456 Views)
Finally I used libusb instead of visa. Compilation with cvi is simple:
cvicc -lusb -debug Prog
and even allows for interactive debugging in KDevelop. Great. Now Windows is
only necessary for creation of the PRJ file and the UIR file.

And compatibility with Windows may not even be lost as I've seen that libusb
can also work on Windows (haven't tried it though).
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 8 of 8
(6,366 Views)