lxi-tools / lxi-tools

Open source LXI tools
https://lxi-tools.github.io
BSD 3-Clause "New" or "Revised" License
485 stars 56 forks source link

lxi-gui not getting built #30

Closed SheetLightning closed 2 years ago

SheetLightning commented 3 years ago

I downloaded the tar archive and tried to compile. The configure script ran fine and identified that lxi-lib needed installing which I did. The configure then completed with no issues. I then ran make.

Make did produce some warnings as can be seen in the output below, but did complete. The lxi command line tools has been compiled and seems to work fine, but not lxi-gui.

If I navigate to ./src/gui/lxi-gui and run make in there, I get the following:

$ make
run-tool=qmake -qt=5 -makefile -o Makefile.qmake lxi-gui.pro \
    QT_INCDIR="//usr/local/include" \
    QT_LIBDIR="//usr/local/lib" \
    SNAPCRAFT="" \

/bin/bash: run-tool=qmake: command not found
Makefile:464: recipe for target 'Makefile.qmake' failed
make: [Makefile.qmake] Error 127 (ignored)
make -f Makefile.qmake  all
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
make[1]: Makefile.qmake: No such file or directory
make[1]: *** No rule to make target 'Makefile.qmake'. Stop.
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:471: recipe for target 'all-local' failed
make: *** [all-local] Error 2

Qmake is installed. After running make a couple more times I got:

$ make
/usr/lib/x86_64-linux-gnu/qt4/bin/uic mainwindow.ui -o ui_mainwindow.h
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
In file included from main.cpp:1:0:
mainwindow.h:6:10: fatal error: QtCharts/QChartView: No such file or directory
 #include <QtCharts/QChartView>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:231: recipe for target 'main.o' failed
make: *** [main.o] Error 1

When I run 'qmake' I get:

$ qmake
Project MESSAGE: Warning: unknown QT: charts

So it seems that QT Charts is missing, but where do i install it from? I couln't find it in the Mint repository nor do i find anything useful online? Not sure what the problem with qmake is either as it is definitely installed on the system?

Output of configure:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for readline in -lreadline... yes
checking for lxi_connect in -llxi... yes
checking for lua... no
checking for lua... yes
checking for lua... yes
checking for lua... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/gui/lxi-gui/Makefile
config.status: creating man/Makefile
config.status: creating src/include/config.h
config.status: src/include/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

Output of make:

$ make
Making all in src
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
  CC       libapp_a-options.o
  CC       libapp_a-discover.o
discover.c: In function ‘discover’:
discover.c:66:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.broadcast = &broadcast;
                    ^
discover.c:67:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.device = &device;
                 ^
discover.c:68:18: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.service = &service;
                  ^
  CC       libapp_a-scpi.o
  CC       libapp_a-screenshot.o
  CC       libapp_a-benchmark.o
  CC       libapp_a-run.o
  CC       libapp_a-lxilua.o
lxilua.c: In function ‘connect’:
lxilua.c:51:26: warning: passing argument 1 of ‘lxi_connect’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     device = lxi_connect(address, 0, NULL, option.timeout, VXI11);
                          ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:59:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_connect(char *address, int port, char *name, int timeout, lxi_protocol_t protocol);
     ^~~~~~~~~~~
lxilua.c: In function ‘scpi’:
lxilua.c:83:31: warning: passing argument 2 of ‘lxi_send’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     length = lxi_send(device, command, strlen(command), option.timeout);
                               ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:60:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_send(int device, char *message, int length, int timeout);
     ^~~~~~~~
lxilua.c: In function ‘scpi_raw’:
lxilua.c:132:31: warning: passing argument 2 of ‘lxi_send’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     length = lxi_send(device, command, strlen(command), option.timeout);
                               ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:60:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_send(int device, char *message, int length, int timeout);
     ^~~~~~~~
  CC       plugins/libapp_a-screenshot_keysight-dmm.o
  CC       plugins/libapp_a-screenshot_keysight-ivx.o
  CC       plugins/libapp_a-screenshot_rigol-1000z.o
  CC       plugins/libapp_a-screenshot_rigol-2000.o
  CC       plugins/libapp_a-screenshot_rigol-dg4000.o
  CC       plugins/libapp_a-screenshot_rigol-dm3068.o
  CC       plugins/libapp_a-screenshot_rigol-dp800.o
  CC       plugins/libapp_a-screenshot_rigol-dsa.o
  CC       plugins/libapp_a-screenshot_rohde-schwarz-hmo-rtb.o
  CC       plugins/libapp_a-screenshot_siglent-sdm3000.o
  CC       plugins/libapp_a-screenshot_siglent-sdg.o
  CC       plugins/libapp_a-screenshot_siglent-sds.o
  CC       plugins/libapp_a-screenshot_siglent-ssa3000x.o
  CC       plugins/libapp_a-screenshot_tektronix.o
  AR       libapp.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       main.o
  CCLD     lxi
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
Making all in man
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21'
johnc@agabus ~/src/lxi-tools/lxi-tools-1.21 $ 
SheetLightning commented 3 years ago

With a bit of help I made some progress.

It seems that to compile the gui one needs to run configure with the --enable-lxi-gui flag

./configure --enable-lxi-gui

Configure then reports that it needs QtChart. I was informed that the library to install is libqt5charts5-dev. After installing that, configure succeeds and make then attempts to compile the gui. However, it then fails with errors which seem to relate to the previous warnings.

$ make
Making all in src
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
  CC       libapp_a-options.o
  CC       libapp_a-discover.o
discover.c: In function ‘discover’:
discover.c:66:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.broadcast = &broadcast;
                    ^
discover.c:67:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.device = &device;
                 ^
discover.c:68:18: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     info.service = &service;
                  ^
  CC       libapp_a-scpi.o
  CC       libapp_a-screenshot.o
  CC       libapp_a-benchmark.o
  CC       libapp_a-run.o
  CC       libapp_a-lxilua.o
lxilua.c: In function ‘connect’:
lxilua.c:51:26: warning: passing argument 1 of ‘lxi_connect’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     device = lxi_connect(address, 0, NULL, option.timeout, VXI11);
                          ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:59:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_connect(char *address, int port, char *name, int timeout, lxi_protocol_t protocol);
     ^~~~~~~~~~~
lxilua.c: In function ‘scpi’:
lxilua.c:83:31: warning: passing argument 2 of ‘lxi_send’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     length = lxi_send(device, command, strlen(command), option.timeout);
                               ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:60:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_send(int device, char *message, int length, int timeout);
     ^~~~~~~~
lxilua.c: In function ‘scpi_raw’:
lxilua.c:132:31: warning: passing argument 2 of ‘lxi_send’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     length = lxi_send(device, command, strlen(command), option.timeout);
                               ^~~~~~~
In file included from lxilua.c:36:0:
/usr/include/lxi.h:60:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int lxi_send(int device, char *message, int length, int timeout);
     ^~~~~~~~
  CC       plugins/libapp_a-screenshot_keysight-dmm.o
  CC       plugins/libapp_a-screenshot_keysight-ivx.o
  CC       plugins/libapp_a-screenshot_rigol-1000z.o
  CC       plugins/libapp_a-screenshot_rigol-2000.o
  CC       plugins/libapp_a-screenshot_rigol-dg4000.o
  CC       plugins/libapp_a-screenshot_rigol-dm3068.o
  CC       plugins/libapp_a-screenshot_rigol-dp800.o
  CC       plugins/libapp_a-screenshot_rigol-dsa.o
  CC       plugins/libapp_a-screenshot_rohde-schwarz-hmo-rtb.o
  CC       plugins/libapp_a-screenshot_siglent-sdm3000.o
  CC       plugins/libapp_a-screenshot_siglent-sdg.o
  CC       plugins/libapp_a-screenshot_siglent-sds.o
  CC       plugins/libapp_a-screenshot_siglent-ssa3000x.o
  CC       plugins/libapp_a-screenshot_tektronix.o
  AR       libapp.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       main.o
  CCLD     lxi
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src'
Making all in man
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/man'
Making all in src/gui/lxi-gui
make[1]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
qtchooser -run-tool=qmake -qt=5 -makefile -o Makefile.qmake lxi-gui.pro \
    QT_INCDIR="//usr/local/include" \
    QT_LIBDIR="//usr/local/lib" \
    SNAPCRAFT="" \

Info: creating stash file /home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui/.qmake.stash
make -f Makefile.qmake  all
make[2]: Entering directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCharts -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o main.cpp
main.cpp: In function ‘void lxi_setup()’:
main.cpp:32:26: error: invalid conversion from ‘void (*)(const char*, const char*)’ to ‘void (*)(char*, char*)’ [-fpermissive]
     lxi_info.broadcast = &broadcast;
                          ^~~~~~~~~~
main.cpp:33:23: error: invalid conversion from ‘void (*)(const char*, const char*)’ to ‘void (*)(char*, char*)’ [-fpermissive]
     lxi_info.device = &device;
                       ^~~~~~~
Makefile.qmake:426: recipe for target 'main.o' failed
make[2]: *** [main.o] Error 1
make[2]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:471: recipe for target 'all-local' failed
make[1]: *** [all-local] Error 2
make[1]: Leaving directory '/home/johnc/src/lxi-tools/lxi-tools-1.21/src/gui/lxi-gui'
Makefile:409: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
SheetLightning commented 3 years ago

Made some further progress and finally got lxi-gui to compile. It seems that the problem was the older liblxi-1.8 library installed on my system from the Ubuntu repository. Once the current version of the library was downloaded from the lxi-tools Github, compiled and installed, the compilation of the lxi-gui program finally completed with just a couple of warnings. There were a couple of issues along the way. Firstly, I needed to add the following to lxi-gui.pro:

QT += widgets

This was necessary so that the compiler could find QtAction. After the compile process had finished, I also had to run:

sudo ldconfig

This was to allow the system to find the liblxi.so.1 library, otherwise the following error occurred:

$ lxi-gui
lxi-gui: error while loading shared libraries: liblxi.so.1: cannot open shared object file: No such file or directory

After running the ldconfig command, the lxi-gui program now works and I can communicate with my Rigol DS1054Z.

Thank you for making these tools available.

lundmar commented 2 years ago

I don't recommend using old Ubuntu distributions, for many reasons. Doing so you will face problems like the ones you had.

Anyway, big changes are coming in the upcoming release. lxi-gui has been fully rewritten in GTK4 to give it a more modern application UI. Also, autotools has been replaced with meson.