VK2BEA / HP8753-Companion

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

Compilation fails on Debain 5.10.0-11-amd64 using gcc version 10.2.1 #6

Closed baigar closed 11 months ago

baigar commented 11 months ago

Wanted to re-visit the code to see whether it works with my HP8753D now since I checked last time. Extracted ZIP archive refused to compile after autogen, comfigure and make. 1st complains in compilation was...

noteDataWidgets.c: In function ‘CB_BtnS2P’: noteDataWidgets.c:98:46: error: implicit declaration of function ‘g_string_free_and_steal’; did you mean ‘g_string_free_to_bytes’? [-Werror=implicit-function-declaration] 98 | gpointer ignored attribute((unused)) = g_string_free_and_steal (sFilename); | ^~~~~~~ | g_string_free_to_bytes noteDataWidgets.c:98:46: error: initialization of ‘gpointer’ {aka ‘void *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion] cc1: all warnings being treated as errors make[1]: *** [Makefile:754: hp8753-noteDataWidgets.o] Error 1

Changed as suggested by the compiler - Now I get the following messages in compiling plotScreen.c:

plotScreen.c:112:3: error: a label can only be part of a statement and a declaration is not a statement 112 | guchar secondHPGLcmd = g_malloc0( strlen( sHPGL ) ); | ^~ plotScreen.c:115:3: error: expected expression before ‘int’ 115 | int nArgs = sscanf(sHPGL+2, "%hd , %hd %[^\0200]", &posn.x, &posn.y, secondHPGLcmd); | ^~~ plotScreen.c:125:7: error: ‘nArgs’ undeclared (first use in this function) 125 | if( nArgs == 3 ) { | ^~~~~ plotScreen.c:125:7: note: each undeclared identifier is reported only once for each function it appears in plotScreen.c:134:3: error: a label can only be part of a statement and a declaration is not a statement 134 | int strLength = strlen( sHPGL+2 ); | ^~~ plotScreen.c: In function ‘plotScreen’: plotScreen.c:329:6: error: a label can only be part of a statement and a declaration is not a statement 329 | gint ptsInLine = ((guint16 *)(pGlobal->HP8753.plotHPGL+HPGLserialCount)); | ^~~~ plotScreen.c:397:6: error: a label can only be part of a statement and a declaration is not a statement 397 | cairo_matrix_t matrix = {0}; | ^~~~~~ make: *** [Makefile:796: hp8753-plotScreen.o] Error 1

VK2BEA commented 11 months ago

Ah .. g_string_free_and_steal was added in glib 2.75.3. I guess Debian is using an older library. I'll try to add an #ifdef to work around this problem until Debian catches up.

baigar commented 11 months ago

Ah .. g_string_free_and_steal was added in glib 2.75.3. I guess Debian is using an older library. I'll try to add an #ifdef to work around this problem until Debian catches up.

Happy to test any time...

VK2BEA commented 11 months ago

OK, give it another whiz. I added a check for glib versions earlier than 2.76. (https://docs.gtk.org/glib/method.String.free_and_steal.html) I also see from you bug report that the compiler didn't like declarations inside the switch statements. This is valid for gcc, so this error is a bit of a mystery. I added a change for that (move the declarations outside the switch).

https://github.com/VK2BEA/HP8753-Companion/commit/3b855a40f14ad31c4340acda0d648fcdcabcb753#diff-dc9bb87feabb8bc06b29a306f090e4d403419a6d43232db088b6e32d2f3da4cc

baigar commented 11 months ago

OK, give it another whiz. I added a check for glib versions earlier than 2.76. (https://docs.gtk.org

Just tested - the problems with the declarations within switch are gone, but in the new #ifdef you added to noteDataWidgets, I am ending in the IF clause still getting an error with g_string_free_and_steal - when replaced by g_string_free_to_bytes it works. In the build/help/Makefile there remaines a "@YELP_HELP_RULES@" in line 461 which leads during an error in compilation. Removing that, compilation runs smoothly and I get a working executable ;-)

VK2BEA commented 11 months ago

ahhhh ... I added a check for GLIBC not GLIB 🙀 .. I fixed that. I think the other error is a lack of "yelp-tools". I added a check in configure.ac. Please install "yelp-tools" and see if that error goes away.

baigar commented 11 months ago

Next iteration: All compilation works perfecly now. The configure script does not recognize the yelp tools correctly and complains even with latest Debia-version installed, "yelp-tools is already the newest version (3.38.0-1)" (but no yelp, libyelp installed yet).

VK2BEA commented 11 months ago

getting there I guess! OK I should have looked for the program yelp-build rather than the package in configure. I updated it.

Let me know if there are any problems with HP8753D. I had to do some hackey things to get all the needed data from the HP8753C. This involved interpreting the "learn string", the format of which changes between software versions. The D has added HPIB command(s) that would give me some of the required data (OUTPCHAN for example). So if I use that on the D, there is one less hack. Also let me know if there is anything that you would find useful, that I left off. (because I didn't it useful)

baigar commented 11 months ago

Compile now runs smooth directly after cloning the project. Thanks for the efforts! Will do testing on the hardware soon (I am the guy who had no good luck in the past with a D will give it another attempt)... Thanks for your work with the "companion".