VK2BEA / HP8753-Companion

Facilitate and enhance the functionality of the HP8753 Vector Network Analyzer
Apache License 2.0
15 stars 4 forks source link

Compilation fails on Ubuntu 18.04 LTS #7

Open uworgl opened 8 months ago

uworgl commented 8 months ago

I have here a HP8753D including Test Set up to 6GHz and want to use the tool in order to improve the equipment capabilities. I have an Agilent 82357B running on Ubuntu 18.04 LTS. The control of the 8753 is possible using simple Python scripts so far.

System: Kubuntu 18.04 LTS Kernel: 5.4.0-150-generic GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 GPIB Driver: Linux-GPIB 4.3.6

byacc, bison, flex, automake, autoconf, libtool, etc..... all this stuff is installed.

../configure: output does not show any error or warnings

output of 'make all':

vzwerkel@vchen-EliteBook-G2:~/nwa/HP8753-Companion/build$ make all Making all in src make[1]: Verzeichnis „/home/vzwerkel/nwa/HP8753-Companion/build/src“ wird betreten CC hp8753-GPIBcommsThread.o ../../src/GPIBcommsThread.c: In function ‘threadGPIB’: ../../src/GPIBcommsThread.c:941:17: error: a label can only be part of a statement and a declaration is not a statement gint OUTPFORMsize = 0; ^~~~ ../../src/GPIBcommsThread.c:942:17: error: expected expression before ‘guint16’ guint16 OUTPFORMheaderAndSize[2]; ^~~ ../../src/GPIBcommsThread.c:950:49: error: ‘OUTPFORMheaderAndSize’ undeclared (first use in this function); did you mean ‘OUTPFORMsize’? GPIBasyncRead(descGPIB_HP8753, &OUTPFORMheaderAndSize, HEADER_SIZE, &GPIBstatus, ^~~~~ OUTPFORMsize ../../src/GPIBcommsThread.c:950:49: note: each undeclared identifier is reported only once for each function it appears in Makefile:656: recipe for target 'hp8753-GPIBcommsThread.o' failed make[1]: [hp8753-GPIBcommsThread.o] Error 1 make[1]: Verzeichnis „/home/vzwerkel/nwa/HP8753-Companion/build/src“ wird verlassen Makefile:418: recipe for target 'all-recursive' failed make: [all-recursive] Error 1

VK2BEA commented 8 months ago

Ah, yes I has a variable in the case statement. The gcc version on Debian (gcc ver 7.5.0) seems to have a problem with that whereas Fedora (gcc ver 13.2.1) allows it. I encapsulated it in brackets so it should compile now. Please try again.

uworgl commented 8 months ago

...much better now, but:

vzwerkel@vchen-EliteBook-G2:~/nwa/HP8753-Companion/build$ make all Making all in src make[1]: Verzeichnis „/home/vzwerkel/nwa/HP8753-Companion/build/src“ wird betreten CC hp8753-databaseSaveAndRestore.o CC hp8753-GTKplotMarkers.o CC hp8753-GTKwidgetCallbacks.o CC hp8753-HP8753_S2P.o CC hp8753-HPicon.o CC hp8753-noteCalKitWidgetCallbacks.o CC hp8753-noteOptionsWidgetCallbacks.o CC hp8753-plotPolar.o CC hp8753-printWidgetCallbacks.o CC hp8753-utility.o CC hp8753-GPIBcommsThread.o CC hp8753-GTKrenameDialogWidgets.o CC hp8753-hp8753.o CC hp8753-HP8753setupAndCal.o CC hp8753-HPlogo.o CC hp8753-noteDataWidgets.o CC hp8753-noteColor.o CC hp8753-parseCalibrationKit.o CC hp8753-plotScreen.o CC hp8753-resource.o CC hp8753-GTKplot.o CC hp8753-GTKutility.o CC hp8753-HP8753comms.o CC hp8753-HP_FORM1toFORM3.o CC hp8753-messageEvent.o ../../src/messageEvent.c: In function ‘messageEventDispatch’: ../../src/messageEvent.c:167:13: error: a label can only be part of a statement and a declaration is not a statement GtkWidget *wBoxPlotType = g_hash_table_lookup(pGlobal->widgetHashTable, ^~~~~ Makefile:852: recipe for target 'hp8753-messageEvent.o' failed make[1]: [hp8753-messageEvent.o] Error 1 make[1]: Verzeichnis „/home/vzwerkel/nwa/HP8753-Companion/build/src“ wird verlassen Makefile:418: recipe for target 'all-recursive' failed make: [all-recursive] Error 1

VK2BEA commented 8 months ago

OK, please try again... hopefully that was the last of them 8-)

uworgl commented 8 months ago

much better again! :-) now compilation is running - no more errors sudo make install doesn't say something like 'Warning' or 'Error', the hp8753 program appears in /usr/local /bin

but: When trying to run the program, a message 'Trace/Breakpoint triggered' appears. The path is set and thus the same message appears when trying to run it without 'sudo'.

vzwerkel@vchen-EliteBook-G2:~/nwa/HP8753-Companion/build$ sudo hp8753 Trace/Breakpoint ausgelöst (The message copied from the screen is in German language....)

Do you have any break points set or what might be the reason for this?

VK2BEA commented 8 months ago

No, that sort of sounds like a glib issue (..from a quick Google search). I presume you have installed all the required packages listed on the README. There's not much to go on ...

uworgl commented 8 months ago

I have checked the availability of all libraries again. - All available in /usr/lib and usr/lib/x86_64-linux-gnu The libgpib is in /usr/local/lib The yelp_tools are installed The font is installed

From this point of view everything seems to be ok.

In addition I have started the program using strace. vzwerkel@vchen-EliteBook-G2:~/nwa/HP8753-Companion/build$ strace -o companion.log hp8753 companion.log

Reviewing the log file at a glance did not show something unusual, except the +++ killed by SIGTRAP (core dumped) +++ before exiting the program execution.....

Any idea?

I will be out of my office for a business trip until Saturday. Thus my next reply here may take until the upcoming weekend. :-)

VK2BEA commented 8 months ago

Sounds like you don't even get a GUI screen. We need to narrow down where the problem is occurring. Please compile with debugging and run with gdb.. $ ../configure --enable-debug $ make $ cd src; gdb ./hp8753 $ gdb> r

Also let me know what version of glib you are using. It may be an issue with compatibility (although one would think the compile would fail if there was a problem). I'm using glib2-2.78.3

uworgl commented 8 months ago

This is the glib version in use: vzwerkel@vchen-EliteBook-G2:/usr/local/bin$ ldd --version ldd (Ubuntu GLIBC 2.27-3ubuntu1.6) 2.27

all the rest I will do by the upcoming weekend..... :-)

uworgl commented 8 months ago

Hi Michael, I am back from my business trip and tried running with gdb as adviced.....

This is the output:

(gdb) r Starting program: /home/vzwerkel/nwa/HP8753-Companion/build/src/hp8753 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffe8bce700 (LWP 5668)] [New Thread 0x7fffe3fff700 (LWP 5669)]

Thread 1 "hp8753" received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff4e93fc1 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (gdb)

And yes, there is no graphics at all. The problem occurs still in the command line......

VK2BEA commented 8 months ago

Your glib version is quite old and this means that some functions need to be treated differently. Before glib2.32 a thread initialization step was required.

Please add the conditional lines below to the on_startup() routine in the hp8753.c file ... There may well be other issues related to the old glib2 but lets see if this helps. Michael

static void
on_startup (GApplication *app, gpointer udata)
{
    tGlobal *pGlobal = (tGlobal *)udata;
    gboolean bAbort = FALSE;

#if !GLIB_CHECK_VERSION(2, 32, 0)
    g_thread_init(NULL);
#endif

also, if you have problems compiling you may need to add -lgthread-2.0 -pthread to the hp8753_LDFLAGS line in src/Makefile.am file: hp8753_LDFLAGS = -lgpib -lm -lgs -rdynamic -lgthread-2.0 -pthread

then do a make clean; make in the build directory

uworgl commented 8 months ago

I have moved everything to the newest Kubuntu 22.04 LTS today in order to get rid of the 'old' glib stuff. The reason I started using the old Kubuntu 18.04 was the running GPIB installation. Today I could solve small traps while installation of the Linux GPIB Package on the newer Kubuntu:

After compiling the HP8753-Companion with the latest git content you provided recently everything works now!!

Thanks a lot for the great effort!

I will start using the tool and will let you know about the results.

VK2BEA commented 8 months ago

OK, sounds good. I'd have liked to know if the 'fix' I posted worked. I will add it into the code in any case.

Let me know if you have any problems or suggestions. Michael

uworgl commented 8 months ago

ok, I can do your proposed fix on the Kubuntu 18.04 computer by next Wednesday, because I am on another business trip Monday and Tuesday....

I will let you know the result!

VK2BEA commented 8 months ago

OK, thanks, I'd like to make the code as robust and tolerant as I can even for older systems. (I've been in a work environment where I've been forced to use old RHEL, so I know sometimes you don't have the luxury of using the newest builds)
BTW, the changes you had to make to the linux-gpib build (listed above)... where they using the build instructions on the linux-gpib Sourceforge site or the script I posted here for the Raspberry PI?

uworgl commented 8 months ago

I have made both changes as described. No warnings, no errors occurred when running 'make' and 'sudo make install'. When starting /usr/local/bin/hp8753 still no graphics appears and the execution stops with the SIGTRAP error.

uworgl commented 8 months ago

Here is the output of 'strace -o companion_2.log'....

companion_2.log

uworgl commented 8 months ago

Regarding the GPIB stuff:

I have used the description how to install Linux GPIB drivers from: https://tomverbeure.github.io/2023/01/29/Installing-Linux-GPIB-Drivers-for-the-Agilent-82357B.html

Additionally I had to do this: LINUX GPIB_required_installations_setups.md

This all is similar to the script you provided. Unfortunately I did not check this file before..... :-)