lxi-tools / liblxi Goto Github PK
View Code? Open in Web Editor NEWOpen source LXI library
Home Page: https://lxi-tools.github.io
License: Other
Open source LXI library
Home Page: https://lxi-tools.github.io
License: Other
I want to use liblxi to develop a LXI device.
Can we use liblxi generate a LXI device,which can find with NI MAX?
And can you give an example?
(Sorry for my poor English)
Thanks.
When running ./autogen.sh on Centos 7, it fails with the error:
src/Makefile.am:2: error: library used but 'RANLIB' is undefined
src/Makefile.am:2: The usual way to define 'RANLIB' is to add 'AC_PROG_RANLIB'
src/Makefile.am:2: to 'configure.ac' and run 'autoconf' again.
autoreconf: automake failed with exit status: 1
After adding AC_PROG_RANLIB to configure.ac as recommended, then autoreconf finishes. It still fails on other dependencies when I configure, without proper errors, but it does complete the autoconf part.
Hello. I'm pushing the 1.20 release into Debian. Building the tree as is results in unresolved symbols, so I'm applying this patch to the Debian build:
https://salsa.debian.org/science-team/liblxi/-/commit/8aa1ef47f94c9dd7ba8b31ce286603251dad5f19
The symbols in question are in that commit message. This probably should be merged upstream, yes?
Thanks
libtirpc is kind of outdated and not well maintained. It uses a lot of Solaris and herritage non-posix code making it difficult to use outside of Linux.
There are several better maintained C RPC libraries out in the wild now. Any thoughts about switching to one?
Could the readme please include build-from-source (e.g. git-checkout) instructions?
for example I get
$ autoconf
$ automake
configure.ac:6: error: required file './ar-lib' not found
configure.ac:6: 'automake --add-missing' can install 'ar-lib'
configure.ac:6: error: required file './compile' not found
configure.ac:6: 'automake --add-missing' can install 'compile'
configure.ac:9: error: required file './config.guess' not found
configure.ac:9: 'automake --add-missing' can install 'config.guess'
configure.ac:9: error: required file './config.sub' not found
configure.ac:9: 'automake --add-missing' can install 'config.sub'
configure.ac:4: error: required file './install-sh' not found
configure.ac:4: 'automake --add-missing' can install 'install-sh'
configure.ac:9: error: required file './ltmain.sh' not found
configure.ac:4: error: required file './missing' not found
configure.ac:4: 'automake --add-missing' can install 'missing'
configure.ac:3: error: required file 'src/include/config.h.in' not found
src/Makefile.am: error: required file './depcomp' not found
src/Makefile.am: 'automake --add-missing' can install 'depcomp'
and
$ ./configure
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
some error-message suggested running
$ aclocal
that runs without errors but doesn't help with the above.
The doc however mentions that avahi is optional.
Hi,
while packaging this for Gentoo, I noticed a compiler warning with 1.18:
[4/8] x86_64-pc-linux-gnu-gcc -Isrc/liblxi.so.1.0.0.p -Isrc -I../liblxi-1.18/src -I/usr/include/tirpc -I/usr/include/libxml2 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -DHAVE_AVAHI -march=native -O2 -pipe -fPIC -pthread -D_REENTRANT -Wno-unused-variable -Wno-unused-parameter -Wno-unused-result -fvisibility=hidden -D_GNU_SOURCE -MD -MQ src/liblxi.so.1.0.0.p/vxi11core_clnt.c.o -MF src/liblxi.so.1.0.0.p/vxi11core_clnt.c.o.d -o src/liblxi.so.1.0.0.p/vxi11core_clnt.c.o -c ../liblxi-1.18/src/vxi11core_clnt.c
In file included from /usr/include/tirpc/rpc/rpc.h:49,
from ../liblxi-1.18/src/vxi11core.h:9,
from ../liblxi-1.18/src/vxi11core_clnt.c:7:
../liblxi-1.18/src/vxi11core_clnt.c: In function ‘destroy_intr_chan_1’:
../liblxi-1.18/src/vxi11core_clnt.c:151:17: warning: cast between incompatible function types from ‘bool_t (*)(void)’ {aka ‘int (*)(void)’} to ‘bool_t (*)(XDR *, ...)’ {aka ‘int (*)(struct __rpc_xdr *, ...)’} [-Wcast-function-type]
151 | (xdrproc_t) xdr_void, (caddr_t) argp,
| ^
/usr/include/tirpc/rpc/clnt.h:166:45: note: in definition of macro ‘clnt_call’
166 | ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
|
Could you look into that and fix it?
I'm trying to build the sample code with:
gcc -Wall -o test src/cpx400sp.cc -llxi
However, I'm getting an undefined reference error:
/tmp/ccJEXbhQ.o: In function `main':
cpx400sp.cc:(.text+0x40): undefined reference to `lxi_init()'
collect2: error: ld returned 1 exit status
I installed liblxi-dev
on my Ubuntu 18.04 system with apt and the library files end up in /usr/lib/x86_64-linux-gnu
(liblxi.so, liblxi.so.1, liblxi.so.1.0.0). Any ideas what is going wrong here?
As per https://fedoraproject.org/wiki/Changes/SunRPCRemoval, the /usr/include/rpc/rpc.h
is moved to /usr/include/tirpc/rpc/rpc.h
(upstream change) which breaks liblxi ./configure
, because it does not detect this file.
Have you considered python bindings? Would be very handy IMO and maybe a good alternative to what I am currently using: vxi-11
https://github.com/python-ivi/python-vxi11
I could give it a try using the boost-python library if/when I have some free time!
Is it possible to add iOS architecture to use this VXI11 API ?
Any plan to add CMake support to this project? I would like to use this library in the future for embedded builds within a CMake project. Something like:
FetchContent_Declare(
liblxi
GIT_REPOSITORY https://github.com/lxi-tools/liblxi
GIT_TAG v2.1
)
FetchContent_MakeAvailable(liblxi)
include_directories(${LIBLXI_INCLUDE})
target_link_libraries(liblxi-static)
...
I'm not familiar with meson
but I'm sure a number of others would appreciate CMake support. Thanks for the library!
Hi,
as from github, require "lxit" returns just true. It should return a table, so it possible differentiate between different packages.
Otherwise lua may call "connect" from socket and not from lxit. With the change below it is possible use statement as followed:
lxit = require 'lxit'
connection=lxit.connect(..)
lxit.scpi(connection,"*IDN?")
..
``
static const luaL_Reg lxilib[] = {
{ "connect", connect_l},
{ "disconnect", disconnect},
{ "scpi", scpi },
{ "scpi_raw", scpi_raw},
{ "sleep", sleep_},
{ "msleep", msleep},
{ "clock_new", clock_new},
{ "clock_read", clock_read},
{ "clock_reset", clock_reset},
{ "clock_free", clock_free},
{NULL, NULL}
};
//int lua_register_lxi(lua_State *L)
int luaopen_lxit(lua_State *L)
{
luaL_newlib(L, lxilib);
load_log_script(L);
return 1;
}
``
regards
Roman
vxi11.c:201:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vxi11.c:206:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vxi11.c:223:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
I'd be keen to follow this through and help in anyway I can. But i'll need some help...
My prime objective is to get a working version of liblxi on my M1 Macbook Pro and build a ruby wrapper for my own lab tests, but happy to contribute and detail the results. I've tried installing from source but I'm getting errors. I'm not familiar with meson and after ignoring the warning, downloaded the latest source release and tried to build it. I'm getting an error when I run meson setup build
:
❯ meson setup build
The Meson build system
Version: 1.1.0
Source dir: /Users/rob/Downloads/liblxi-1.18
Build dir: /Users/rob/Downloads/liblxi-1.18/build
Build type: native build
Project name: liblxi
Project version: 1.18
C compiler for the host machine: cc (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
C linker for the host machine: cc ld64 857.1
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: /opt/homebrew/bin/pkg-config (0.29.2)
Found CMake: /opt/homebrew/bin/cmake (3.24.2)
Run-time dependency avahi-client found: NO (tried pkgconfig, framework and cmake)
Run-time dependency libxml-2.0 found: YES 2.9.4
Run-time dependency threads found: YES
Has header "avahi-client/client.h" : NO
Run-time dependency libtirpc found: NO (tried pkgconfig, framework and cmake)
src/meson.build:22:12: ERROR: Dependency "libtirpc" not found, tried pkgconfig, framework and cmake
I then tried:
❯ brew install libtirpc
libtirpc: Linux is required for this software.
Error: libtirpc: An unsatisfied requirement failed this build.
So tried installing it from source but make check
gave a bunch of errors about
'call to undeclared function mutex_lock'
It looks like has others may have come close to success a few years ago #14, but I'm not sure if they ever got it working.
Any help or direction would be greatly appreciated.
Looking for some insights on building the tools on Ubuntu 20.04.
When running the ./configure on /liblxi it ends with:
. . .
checking rpc/rpc.h presence... yes
checking for rpc/rpc.h... yes
checking for rpcgen... /usr/bin/rpcgen
checking for avahi_client_new in -lavahi-client... no
configure: error: Missing avahi-client library
Tried to add the dependency:
asdf@black:~/lxi-tools/liblxi-1.13$ sudo snap install avahi-client
snap "avahi-client" is already installed, see 'snap help refresh'
So not sure what it needs or how to install it - any suggestions?
Looking to add a few more instruments to the capability list once I can build & debug.
I am trying to send Waveform Data to a Rigol DG1062Z Signal Generator on Ubuntu 23.10 (liblxi installed with apt install) in VXI11 Mode and can't send more than 1500 Byte at a Time. If I try to do so, the lxi_send C function returns 0. It seems like the TCP implementation doesn't correctly handle reaching the Maximum transmission unit.
With this Test Program
#include <stdio.h>
#include <string.h>
#include "lxi.h"
int main()
{
char response[65536];
int device, length, timeout = 1000;
char const *command = "*IDN?";
// Initialize LXI library
lxi_init();
// Connect to LXI device
device = lxi_connect("192.168.3.168", 0, "inst0", timeout, VXI11);
// Send SCPI command
int returnValue = lxi_send(device, command, strlen(command), timeout);
printf("%d\n", returnValue);
// Wait for response
lxi_receive(device, response, sizeof(response), timeout);
printf("%s\n", response);
char const *command2 = ":SOURCE1:DATA VOLATILE,-0.001,0.4006,0.6602,0.6736,0.4281,0.0104,-0.4239,-0.7081,-0.7287,-0.4706,-0.0254,0.4408,0.7494,0.778,0.5088,0.0378,-0.4589,-0.7913,-0.8285,-0.5499,-0.0556,0.4694,0.8245,0.8708,0.5849,0.0703,-0.4801,-0.8563,-0.9121,-0.6212,-0.0898,0.4825,0.8777,0.943,0.6497,0.1055,-0.4846,-0.8963,-0.9712,-0.6779,-0.1253,0.4782,0.9034,0.9876,0.697,0.1404,-0.4717,-0.9071,-1.0,-0.7146,-0.1588,0.4569,0.8989,1.0,0.7223,0.1717,-0.4424,-0.8875,-0.9957,-0.7278,-0.1871,0.4204,0.8647,0.9791,0.7231,0.1964,-0.3997,-0.8395,-0.9588,-0.7162,-0.2075,0.3724,0.8041,0.9271,0.6994,0.2121,-0.3475,-0.7677,-0.8929,-0.6812,-0.2182,0.3174,0.723,0.849,0.6539,0.2177,-0.2907,-0.6791,-0.8047,-0.6265,-0.2188,0.2601,0.629,0.7528,0.5917,0.2136,-0.2341,-0.582,-0.703,-0.5585,-0.2104,0.2051,0.5309,0.6482,0.5198,0.2015,-0.1818,-0.4851,-0.598,-0.4848,-0.1955,0.1563,0.4374,0.5455,0.4465,0.1846,-0.1371,-0.3968,-0.5002,-0.4142,-0.1777,0.1162,0.3562,0.455,0.3808,0.1671,-0.1018,-0.3243,-0.4192,-0.3554,-0.1617,0.0858,0.2936,0.3855,0.3307,0.1538,-0.0763,-0.2726,-0.3628,-0.3159,-0.1522,0.0649,0.2534,0.3436,0.3033,0.1493,-0.0595,-0.2443,-0.3363,-0.3016,-0.1537,0.0516,0.2371,0.3331,0.3031,0.1577,-0.049,-0.2396,-0.3419,-0.3159,-0.1698,0.0432,0.2434,0.3544,0.332,0.1818,-0.042,-0.256,-0.3782,-0.3592,-0.2023,0.0367,0.2688,0.4046,0.389,0.2228,-0.0352,-0.289,-0.4409,-0.4288,-0.2515,0.0288,0.3078,0.478,0.4698,0.2797,-0.0255,-0.3325,-0.523,-0.5191,-0.3154,0.0168,0.3541,0.5664,0.5676,0.3497,-0.0108,-0.3798,-0.6153,-0.6222,-0.3903";
// Send SCPI command
returnValue = lxi_send(device, command2, strlen(command2), timeout);
printf("%d\n", returnValue);
// Disconnect
lxi_disconnect(device);
}
I get the the following Output, and nothing is received on the generator (if i shorten the string by one value to 1497 Bytes, it works).
5
Rigol Technologies,DG1062Z,DG1ZA00000000,03.01.12
0
Process finished with exit code 0
If you want me to test any changes, I am happy to help.
Hello,
I've compiled and built the liblxi and lxi-tools, and they both are working. Now I'm trying to write my own code using the library. The first thing I did was try to compile the liblxi/test/scpi.c file. Whenever I attempt compilation I get undefined reference errors:
/tmp/ccIEtpsP.o: In function main': scpi.c:(.text+0x30): undefined reference to
lxi_init'
scpi.c:(.text+0x52): undefined reference to lxi_connect' scpi.c:(.text+0x87): undefined reference to
lxi_send'
scpi.c:(.text+0xa8): undefined reference to lxi_receive' scpi.c:(.text+0xc4): undefined reference to
lxi_disconnect'
collect2: error: ld returned 1 exit status
Any ideas on what I'm doing wrong?
Also, how does one run the GUI?
When attempting to compile on openSUSE Tumbleweed (rolling development release), compilation fails at tcp.c:85 as gethostbyname() is no longer available. The replacement function is getaddrinfo().
Adding to the comments at the end of #36, I’ve now got time to spend on this task.
The example is running and printers and airplay devices respond as described.
With regards to implantation, It would seem at a high level mdns (and Avahi) is used for, obviously, instrument discovery, but also service discovery ie. when another computer/instrument publishes an LXI service the backend would catch it and call the service callback. Could this service discovery potentially be a long running background task or is it just fired up when need?
I haven’t written C code in 15 years (and I wasn’t that good at it back then), I found the The Avahi implementation is a bit contrived, could you give me a high level explanation of the backend operation and how you would like it implemented?
On first pass of the code, it would appear mdns is only used when called by the lxi_discovery functions and the discovery type is set to mdns. Is this correct or is it called in other parts of the library?
Given the initial testing, I’m reasonably confident, once I get my head around this all and with your help, getting a PR together should be fairly straight forward.
Hi,
after a successful compilation on Raspbian Stretch, it is not possible to run the lxi-tools due to an "illegal instruction" error.
How to debug this issue?
Best regards,
Manuel
pthread_timedjoin_np
isn't very portable, and is a convenience function not available on stricter POSIX platforms.
Any chance of refactoring this to an alternative more standard design?
I saw https://stackoverflow.com/questions/11551188/alternative-to-pthread-timedjoin-np , seems like a common complaint.
how can i install lib-tools on windwos7?
Hi,
this is vxi-11 client code right?
do you have any vxi-11 server code?
Thanks
For previous releases, there was a .asc
file to verify the release and the integrity using gpg
. Any chance for liblxi-1.14.tar.xz
, too?
autoreconf fails due to missing AM_PROG_CC_C_O
Succeeds after adding to configure.am
Currently it just links to avahi when available.
FreeBSD package should have an option "AVAHI". There should be a reliable way to disable it. Currently, there's only a way to enable it reliably.
The FreeBSD package will wait until you add such option.
I've cloned the repo and ran the meson setup which told me avahi-client and avahi-client header were not present.
I installed the libavahi-client-dev as recommended here: #21 (comment)
❯ sudo apt install libavahi-client-dev libavahi-common-dev
Meson setup then returned the following:
❯ meson setup build --wipe
The Meson build system
Version: 1.1.0
Source dir: /home/rob/Code/clang/liblxi
Build dir: /home/rob/Code/clang/liblxi/build
Build type: native build
Project name: liblxi
Project version: 1.21
C compiler for the host machine: cc (gcc 12.2.0 "cc (Ubuntu 12.2.0-17ubuntu1) 12.2.0")
C linker for the host machine: cc ld.bfd 2.40
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /home/linuxbrew/.linuxbrew/bin/pkg-config (0.29.2)
Found CMake: /usr/bin/cmake (3.25.1)
Run-time dependency avahi-client found: NO (tried pkgconfig and cmake)
Run-time dependency libxml-2.0 found: YES 2.11.4
Run-time dependency threads found: YES
Has header "avahi-client/client.h" : YES
Run-time dependency libtirpc found: YES 1.3.2
Configuring lxi_connect.3 using configuration
Configuring lxi_disconnect.3 using configuration
Configuring lxi_discover.3 using configuration
Configuring lxi_discover_if.3 using configuration
Configuring lxi_init.3 using configuration
Configuring lxi_receive.3 using configuration
Configuring lxi_send.3 using configuration
Build targets in project: 1
Found ninja-1.11.1 at /home/linuxbrew/.linuxbrew/bin/ninja
This left me a little confused as meson seemed to find the header but wasn't able to identify the library.
Upon building the test file, I was presented with numerous reference errors related to avahi functions. Here's the command I used and the result:
❯ gcc -I/home/linuxbrew/.linuxbrew/include test/search.c -L/home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu -llxi -o search
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_service_resolver_free'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_client_new'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_bytes'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_simple_poll_loop'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_service_browser_get_client'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_client_free'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_bool'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_address_snprint'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_int'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_strerror'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_simple_poll_quit'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_elapse_time'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_service_browser_new'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_string'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `clnt_create'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_void'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_service_resolver_get_client'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_simple_poll_get'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_enum'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_u_char'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_u_int'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_service_resolver_new'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_simple_poll_new'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_simple_poll_free'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_client_errno'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `avahi_service_browser_free'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_u_short'
/usr/bin/ld: /home/linuxbrew/.linuxbrew/lib/x86_64-linux-gnu/liblxi.so: undefined reference to `xdr_char'
collect2: error: ld returned 1 exit status
I suspect these error will resolve if the avahi-client is present, so whats the recommendation for installing the avahi-client correctly?
Do you see a chance to publish the mail adress of the public key of key 101BAC1C15B216DBE07A3EEA2BDB4A0944FA00B1, being used for signing liblxi release tarballs, at keys.openpgp.org? This would allow Fedora to switch from the current binary GnuPG output blob (manually created) to the ASCII format provided there. Unfortunately keys.openpgp.org strips all user IDs unless the owner of the corresponding email address has allowed them to be published, thus keys.openpgp.org can't be used for the ASCII format right now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.