ROBINTsrl / LeptonVid

Lepton 3 SPI / GPIO streaming console application
BSD 2-Clause "Simplified" License
6 stars 2 forks source link

Usage of windows.h in the SDK #3

Open MichalKochman opened 1 year ago

MichalKochman commented 1 year ago

Hi, The code does not compile on the rasbpian since there is a windows header used.

$ ./make.sh 
gcc -fpermissive -Dlinux=1 -c  -v  -g -o "Debug/FLIR_I2C.o" -I/cygdrive/c/WinAVR-20090313/avr/include  "FLIR_I2C.c"
Using built-in specs.
COLLECT_GCC=gcc
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20210110 (Debian 10.2.1-6) 
COLLECT_GCC_OPTIONS='-fpermissive' '-D' 'linux=1' '-c' '-v' '-g' '-o' 'Debug/FLIR_I2C.o' '-I' '/cygdrive/c/WinAVR-20090313/avr/include' '-mlittle-endian' '-mabi=lp64'
 /usr/lib/gcc/aarch64-linux-gnu/10/cc1 -quiet -v -I /cygdrive/c/WinAVR-20090313/avr/include -imultiarch aarch64-linux-gnu -D linux=1 FLIR_I2C.c -quiet -dumpbase FLIR_I2C.c -mlittle-endian -mabi=lp64 -auxbase-strip Debug/FLIR_I2C.o -g -version -fpermissive -fasynchronous-unwind-tables -o /tmp/ccDCfqTb.s
cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
GNU C17 (Debian 10.2.1-6) version 10.2.1 20210110 (aarch64-linux-gnu)
    compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.0, isl version isl-0.23-GMP

GGC heuristics: --param ggc-min-expand=58 --param ggc-min-heapsize=52672
ignoring nonexistent directory "/usr/local/include/aarch64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/10/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/include"
ignoring nonexistent directory "/cygdrive/c/WinAVR-20090313/avr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/aarch64-linux-gnu/10/include
 /usr/local/include
 /usr/include/aarch64-linux-gnu
 /usr/include
End of search list.
GNU C17 (Debian 10.2.1-6) version 10.2.1 20210110 (aarch64-linux-gnu)
    compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.0, isl version isl-0.23-GMP

GGC heuristics: --param ggc-min-expand=58 --param ggc-min-heapsize=52672
Compiler executable checksum: 09f7dee817ee0ac81dbfe2e711a5f862
In file included from FLIR_I2C.c:62:
ftd2xx.h:58:10: fatal error: windows.h: No such file or directory
   58 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.

Edit: I am just stupid. Some instalation of official lepton SDK seems to be needed (https://github.com/groupgets/LeptonModule). Will continue to explore (still not compiled)

weirdgyn commented 1 year ago

... the source code you're referring to (FLIR_I2C.c) is part of the FLIR SDK of which I'm not a maintainer, you should check official FLIR repositories and get/check it from there.

Anyway the portion of the source code you're getting troubles with is this (from FLIR_I2C.c):

/ TCP IP Socket Includes /

if defined(WINDOWSS) || defined(WIN32)

define WIN32_LEAN_AND_MEAN

include

include

include

pragma comment (lib, "Ws2_32.lib")

pragma comment (lib, "Mswsock.lib")

pragma comment (lib, "AdvApi32.lib")

endif

As you can see the include directive to windows.h file is correctly encased inside an ifdef directive that checks for windows defines. You should better ask why your compilation env complies such lines...

Best regards, Mike

Il giorno mer 30 ago 2023 alle ore 22:49 MichalKochman < @.***> ha scritto:

Hi, The code does not compile on the rasbpian since there is a windows header used.

$ ./make.sh gcc -fpermissive -Dlinux=1 -c -v -g -o "Debug/FLIR_I2C.o" -I/cygdrive/c/WinAVR-20090313/avr/include "FLIR_I2C.c" Using built-in specs. COLLECT_GCC=gcc Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.1 20210110 (Debian 10.2.1-6) COLLECT_GCC_OPTIONS='-fpermissive' '-D' 'linux=1' '-c' '-v' '-g' '-o' 'Debug/FLIR_I2C.o' '-I' '/cygdrive/c/WinAVR-20090313/avr/include' '-mlittle-endian' '-mabi=lp64' /usr/lib/gcc/aarch64-linux-gnu/10/cc1 -quiet -v -I /cygdrive/c/WinAVR-20090313/avr/include -imultiarch aarch64-linux-gnu -D linux=1 FLIR_I2C.c -quiet -dumpbase FLIR_I2C.c -mlittle-endian -mabi=lp64 -auxbase-strip Debug/FLIR_I2C.o -g -version -fpermissive -fasynchronous-unwind-tables -o /tmp/ccDCfqTb.s cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C GNU C17 (Debian 10.2.1-6) version 10.2.1 20210110 (aarch64-linux-gnu) compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.0, isl version isl-0.23-GMP

GGC heuristics: --param ggc-min-expand=58 --param ggc-min-heapsize=52672 ignoring nonexistent directory "/usr/local/include/aarch64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/10/include-fixed" ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/include" ignoring nonexistent directory "/cygdrive/c/WinAVR-20090313/avr/include"

include "..." search starts here:

include <...> search starts here:

/usr/lib/gcc/aarch64-linux-gnu/10/include /usr/local/include /usr/include/aarch64-linux-gnu /usr/include End of search list. GNU C17 (Debian 10.2.1-6) version 10.2.1 20210110 (aarch64-linux-gnu) compiled by GNU C version 10.2.1 20210110, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.0, isl version isl-0.23-GMP

GGC heuristics: --param ggc-min-expand=58 --param ggc-min-heapsize=52672 Compiler executable checksum: 09f7dee817ee0ac81dbfe2e711a5f862 In file included from FLIR_I2C.c:62: ftd2xx.h:58:10: fatal error: windows.h: No such file or directory 58 | #include | ^~~ compilation terminated.

— Reply to this email directly, view it on GitHub https://github.com/ROBINTsrl/LeptonVid/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOP54V2GSSNSFVETLZBTXLXX6RNXANCNFSM6AAAAAA4FCSLCQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

bye by(t)e[s]... WeirdGyn!

MichalKochman commented 1 year ago

Well, what I am asking is why is there the "SDK_OEM" included in this repository? Becouse the problematic line is line 58 in https://github.com/ROBINTsrl/LeptonVid/blob/master/LeptonSDKEmb32OEM/ftd2xx.h

weirdgyn commented 1 year ago

At the time I published the repository it was not too simple to collect SDK files from FLIR since it required registration. I don't know if this is still required. You can check and see if a fresh new SDK has the same problem...

Anyway such a file should not be compiled and probably it can be safely removed from the folder since AFAIK it's not referenced in any of the other files... I cannot understand why in your env it gets compiled (on mine did not and I was compiling it on Linux hence I would have the same error as you)...

Of course if you want/need to fix it.. enclose such include with proper

ifdef #endif directives... then share your improvement.

Bye for now

Il giorno sab 2 set 2023 alle ore 22:36 MichalKochman < @.***> ha scritto:

Well, what I am asking is why is there the "SDK_OEM" included in this repository? Becouse the problematic line is line 58 in https://github.com/ROBINTsrl/LeptonVid/blob/master/LeptonSDKEmb32OEM/ftd2xx.h

— Reply to this email directly, view it on GitHub https://github.com/ROBINTsrl/LeptonVid/issues/3#issuecomment-1703935548, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOP54QNN4AKVWW752BSAS3XYOKDPANCNFSM6AAAAAA4FCSLCQ . You are receiving this because you commented.Message ID: @.***>

--

bye by(t)e[s]... WeirdGyn!