Open TsuITOAR opened 1 year ago
Something that's not entirely clear from your readme is whether the NI_VISA library is required, or will libvisa work as well?
I ask this because when trying to use async_write
using libvisa and i get:
= note: /build/private/cargo-target/release/deps/libvisa_rs-de0f39bbca939597.rlib(visa_rs-de0f39bbca939597.visa_rs.bcfb2d0a6785fd0b-cgu.02.rcgu.o): In function `visa_rs::async_
io::AsyncIoHandler::new':
visa_rs.bcfb2d0a6785fd0b-cgu.02:(.text._ZN7visa_rs8async_io14AsyncIoHandler3new17h212d79d7ae1c5689E+0x221): undefined reference to `viInstallHandler'
/build/private/cargo-target/release/deps/libvisa_rs-de0f39bbca939597.rlib(visa_rs-de0f39bbca939597.visa_rs.bcfb2d0a6785fd0b-cgu.02.rcgu.o): In function `<visa_rs::async
_io::AsyncIoHandler as core::ops::drop::Drop>::drop':
visa_rs.bcfb2d0a6785fd0b-cgu.02:(.text._ZN75_$LT$visa_rs..async_io..AsyncIoHandler$u20$as$u20$core..ops..drop..Drop$GT$4drop17h84ef7ecf876e51e3E+0xe4): undefined reference to `viTerminate'
visa_rs.bcfb2d0a6785fd0b-cgu.02:(.text._ZN75_$LT$visa_rs..async_io..AsyncIoHandler$u20$as$u20$core..ops..drop..Drop$GT$4drop17h84ef7ecf876e51e3E+0x1dc): undefined reference to `viUninstallHandler'
/build/private/cargo-target/release/deps/libvisa_rs-de0f39bbca939597.rlib(visa_rs-de0f39bbca939597.visa_rs.bcfb2d0a6785fd0b-cgu.05.rcgu.o): In function `visa_rs::instru
ment::Instrument::visa_write_async':
visa_rs.bcfb2d0a6785fd0b-cgu.05:(.text._ZN7visa_rs10instrument10Instrument16visa_write_async17h4a91cc3f7856106eE+0x24): undefined reference to `viWriteAsync'
collect2: error: ld returned 1 exit status
Appreciate you're feedback on this.
~Dustin
Something that's not entirely clear from your readme is whether the NI_VISA library is required, or will libvisa work as well?
I ask this because when trying to use
async_write
using libvisa and i get:= note: /build/private/cargo-target/release/deps/libvisa_rs-de0f39bbca939597.rlib(visa_rs-de0f39bbca939597.visa_rs.bcfb2d0a6785fd0b-cgu.02.rcgu.o): In function `visa_rs::async_ io::AsyncIoHandler::new': visa_rs.bcfb2d0a6785fd0b-cgu.02:(.text._ZN7visa_rs8async_io14AsyncIoHandler3new17h212d79d7ae1c5689E+0x221): undefined reference to `viInstallHandler' /build/private/cargo-target/release/deps/libvisa_rs-de0f39bbca939597.rlib(visa_rs-de0f39bbca939597.visa_rs.bcfb2d0a6785fd0b-cgu.02.rcgu.o): In function `<visa_rs::async _io::AsyncIoHandler as core::ops::drop::Drop>::drop': visa_rs.bcfb2d0a6785fd0b-cgu.02:(.text._ZN75_$LT$visa_rs..async_io..AsyncIoHandler$u20$as$u20$core..ops..drop..Drop$GT$4drop17h84ef7ecf876e51e3E+0xe4): undefined reference to `viTerminate' visa_rs.bcfb2d0a6785fd0b-cgu.02:(.text._ZN75_$LT$visa_rs..async_io..AsyncIoHandler$u20$as$u20$core..ops..drop..Drop$GT$4drop17h84ef7ecf876e51e3E+0x1dc): undefined reference to `viUninstallHandler' /build/private/cargo-target/release/deps/libvisa_rs-de0f39bbca939597.rlib(visa_rs-de0f39bbca939597.visa_rs.bcfb2d0a6785fd0b-cgu.05.rcgu.o): In function `visa_rs::instru ment::Instrument::visa_write_async': visa_rs.bcfb2d0a6785fd0b-cgu.05:(.text._ZN7visa_rs10instrument10Instrument16visa_write_async17h4a91cc3f7856106eE+0x24): undefined reference to `viWriteAsync' collect2: error: ld returned 1 exit status
Appreciate you're feedback on this. ~Dustin
Hi, in principle any visa library should work if it follows the specifications.
It seems that libvisa uses the specification distributed in 06-18-2012, while I generate the prebindings in visa-sys based on distribution in 10-30-2020, maybe that's the problem. You can try rebinding by setting env var INCLUDE_PATH_VAR
and open its bindgen
feature (check the build.rs of visa-sys).
EDIT: NI-visa use the visa version 5.8 while libvisa using 5.1, there should be no version problem since NI VISA works fine.
BTW, do all methods fail or just this one?
I have only tried async_write
and write_all
(from the example). write_all
compiles and links correctly.
I should also note that I have to create a symlink of libvisa -> libvisa64 for linking to work since that name is hard coded, it would be nice if this was a env_var or flag as part of the build.
I have found rsvisa, i could also try and see if that provides the bindings.
Interestingly those functions do exist in the visa.h
file that the source (libvisa-dev) provides. I'm curious why those methods don't end up in the compiled .so
.
This crate wraps two async operations, async_read and async_write, they rely on Callback added to EventIoCompletion event that VISA is listening to.
There are several aspects that need to be aware of and should be improved:
The cause of the first problem is not clear, it might be related with running multiple VISA program synchronously, use
cargo t --jobs 1
can usually pass all tests, without it, a function of the tests will not quit sometimes. Another is associated with the Waker mechanism of Rust future system.They might be solved by adding another Waker that wakes the futures after some time no matter what. I'm not familiar with low level async programing design and not sure if there are better solutions, any help would be grateful.