kopia lustrzana https://github.com/Hamlib/Hamlib
Document fixing MinGW warnings and linker error
This commit has been left as documentation should these files be moved to /doc or some such. However, never of these files are built or distributed. ---------------- From example.c the following warning was generated by MinGW: CC example.o example.c: In function ‘main’: example.c:93:32: warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘rmode_t’ {aka ‘long long unsigned int’} [-Wformat=] 93 | printf("Current mode = 0x%lX = %s, width = %ld\n", mode, rig_strrmode(mode), | ~~^ ~~~~ | | | | long unsigned int rmode_t {aka long long unsigned int} | %llX The 'l' was added as suggested to the format specifier but that resulted in the following warning from Linux: CC example.o ../../hamlib/tests/example.c:93:57: warning: format specifies type 'unsigned long long' but the argument has type 'rmode_t' (aka 'unsigned long') [-Wformat] printf("Current mode = 0x%llX = %s, width = %ld\n", mode, rig_strrmode(mode), ~~~~ ^~~~ %lX CC rigctl-dumpcaps.o 1 warning generated. So casting `mode` to `unsigned long long` quelled both warnings! From testsecurity.c came this warning: CC testsecurity-testsecurity.o In file included from ../include/hamlib/rig.h:49, from ../src/misc.h:26, from testsecurity.c:29: /usr/share/mingw-w64/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp] 15 | #warning Please include winsock2.h before windows.h | ^~~~~~~ Apparently winsock2.h being included through misc.h didn't work. Finally, the Mingw linker gave the following error: CCLD testsecurity.exe /usr/bin/x86_64-w64-mingw32-ld: testsecurity-testsecurity.o: in function `main': /home/nate/builds/hamlib-4.7~git/tests/testsecurity.c:97:(.text.startup+0x87): undefined reference to `AESStringCrypt' /usr/bin/x86_64-w64-mingw32-ld: /home/nate/builds/hamlib-4.7~git/tests/testsecurity.c:116:(.text.startup+0x128): undefined reference to `AESStringDecrypt' collect2: error: ld returned 1 exit status Specifcally add the libsecurity.la file path as a specific library. Even though the libhamlib.la seems to have the AESStringCrypt symbol already.pull/1860/head
rodzic
73a967e569
commit
3fa91c8771
|
@ -57,7 +57,9 @@ rigctlsync_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_builddir)/security
|
|||
if HAVE_LIBUSB
|
||||
rigtestlibusb_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(LIBUSB_CFLAGS)
|
||||
endif
|
||||
testsecurity_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_srcdir)/security
|
||||
|
||||
# Document building testsecurity
|
||||
### testsecurity_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_srcdir)/security
|
||||
|
||||
rigctl_LDADD = $(PTHREAD_LIBS) $(READLINE_LIBS) $(LDADD)
|
||||
rigctld_LDADD = $(NET_LIBS) $(PTHREAD_LIBS) $(LDADD) $(READLINE_LIBS)
|
||||
|
@ -73,6 +75,9 @@ if HAVE_LIBUSB
|
|||
rigtestlibusb_LDADD = $(LIBUSB_LIBS)
|
||||
endif
|
||||
|
||||
# Document linking testsecurity
|
||||
### testsecurity_LDADD = $(PTHREAD_LIBS) $(LDADD) $(top_builddir)/security/libsecurity.la
|
||||
|
||||
# Linker options
|
||||
rigctl_LDFLAGS = $(WINEXELDFLAGS)
|
||||
rigswr_LDFLAGS = $(WINEXELDFLAGS)
|
||||
|
@ -90,6 +95,8 @@ if HAVE_LIBUSB
|
|||
rigtestlibusb_LDFLAGS = $(WINEXELDFLAGS)
|
||||
endif
|
||||
|
||||
# Document linking testsecurity with MinGW
|
||||
### testsecurity_LDFLAGS = $(WINEXELDFLAGS)
|
||||
|
||||
if HTML_MATRIX
|
||||
EXTRA_PROGRAMS = rigmatrix
|
||||
|
|
|
@ -90,7 +90,7 @@ int main()
|
|||
|
||||
if (status != RIG_OK) { printf("Get mode failed?? Err=%s\n", rigerror(status)); }
|
||||
|
||||
printf("Current mode = 0x%lX = %s, width = %ld\n", mode, rig_strrmode(mode),
|
||||
printf("Current mode = 0x%llX = %s, width = %ld\n", (unsigned long long)mode, rig_strrmode(mode),
|
||||
width);
|
||||
|
||||
/* rig power output */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
//#include <Wincrypt.h>
|
||||
#else
|
||||
|
|
Ładowanie…
Reference in New Issue