simsong / bulk_extractor

This is the development tree. Production downloads are at:
https://github.com/simsong/bulk_extractor/releases
Other
1.07k stars 185 forks source link

Mingw cross compiling for Win64 executable - Errors with multiple .cpp files causing an Error 2 with make #334

Closed tomnewman86 closed 2 years ago

tomnewman86 commented 2 years ago

Hello,

I've been running into an issue with 3 different .ccp scanning/processing modules when trying to compile the win64 executable. The errors appear to be related to a syntax error with C++. I have had the issue with scan_aes.cpp, scan_ccns2.cpp and one other that I'm currently trying to recreate and will update this once I'm done:

depbase=`echo scan_aes.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
x86_64-w64-mingw32-g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../src -I..  -I../../src/be13_api -DUNICODE -D_UNICODE -D__MSVCRT_VERSION__=0x0601 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -g  --static  -DUTC_OFFSET=+0000  -g -static-libstdc++  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -Wno-format  --static -static-libgcc -static-libstdc++ -pthread -Wall -MD -Wpointer-arith -Wshadow -Wwrite-strings -Wcast-align -Wredundant-decls -Wdisabled-optimization -Wfloat-equal -Wmultichar -Wmissing-noreturn -Woverloaded-virtual -Wsign-promo -funit-at-a-time -O3 -MT scan_aes.o -MD -MP -MF $depbase.Tpo -c -o scan_aes.o ../../src/scan_aes.cpp &&\
mv -f $depbase.Tpo $depbase.Po
../../src/scan_aes.cpp: In function 'void scan_aes(scanner_params&)':
../../src/scan_aes.cpp:451:19: error: 'u_char' does not name a type; did you mean 'putchar'?
  451 |             const u_char val = buf[pos];
      |                   ^~~~~~
      |                   putchar
../../src/scan_aes.cpp:452:20: error: 'val' was not declared in this scope
  452 |             counts[val]++;
      |                    ^~~
../../src/scan_aes.cpp:465:23: error: 'u_char' does not name a type; did you mean 'putchar'?
  465 |                 const u_char val = buf[pos+AES128_KEY_SCHEDULE_SIZE];
      |                       ^~~~~~
      |                       putchar
../../src/scan_aes.cpp:466:24: error: 'val' was not declared in this scope
  466 |                 counts[val]++;
      |                        ^~~
make[3]: *** [Makefile:1379: scan_aes.o] Error 1
make[3]: Leaving directory '/home/bulk_extractor/win64/src'
make[2]: *** [Makefile:417: all-recursive] Error 1
make[2]: Leaving directory '/home/bulk_extractor/win64'
make[1]: *** [Makefile:358: all] Error 2
make[1]: Leaving directory '/home/bulk_extractor/win64'
make: *** [Makefile:873: win64/bulk_extractor64.exe] Error 2

I am in no way a C++ developer but managed to "resolve" this error by simply commenting out this section of code (I realise this is in no way a resolution). It then completed and moved on from scan_aes.cpp only to find a very similar error in scan_ccns2.cpp.

CONFIGUE_FEDORA31.bash has run successfully and completed and issued the instruction to run either:

  1. cd ..; make win64
  2. cd ..; make windist
  3. make

Neither option 2 or 3 work (no rule to make target) so it is option 1 I am getting this issues with.

I'd be interested to hear your views or a solution.

Many thanks.

simsong commented 2 years ago

Thanks. I will make a new release this weekend and be sure that we have a win64 exe.


Sent from my phone.

On Jan 27, 2022, at 9:56 AM, Unallocated Space @.***> wrote:

 Hello,

I've been running into an issue with 3 different .ccp scanning/processing modules when trying to compile the win64 executable. The errors appear to be related to a syntax error with C++. I have had the issue with scan_aes.cpp, scan_ccns2.cpp and one other that I'm currently trying to recreate and will update this once I'm done:

depbase=echo scan_aes.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';\ x86_64-w64-mingw32-g++ -std=c++17 -DHAVE_CONFIG_H -I. -I../../src -I.. -I../../src/be13_api -DUNICODE -D_UNICODE -D__MSVCRT_VERSION__=0x0601 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -g --static -DUTC_OFFSET=+0000 -g -static-libstdc++ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -Wno-format --static -static-libgcc -static-libstdc++ -pthread -Wall -MD -Wpointer-arith -Wshadow -Wwrite-strings -Wcast-align -Wredundant-decls -Wdisabled-optimization -Wfloat-equal -Wmultichar -Wmissing-noreturn -Woverloaded-virtual -Wsign-promo -funit-at-a-time -O3 -MT scan_aes.o -MD -MP -MF $depbase.Tpo -c -o scan_aes.o ../../src/scan_aes.cpp &&\ mv -f $depbase.Tpo $depbase.Po ../../src/scan_aes.cpp: In function 'void scan_aes(scanner_params&)': ../../src/scan_aes.cpp:451:19: error: 'u_char' does not name a type; did you mean 'putchar'? 451 | const u_char val = buf[pos]; | ^~ | putchar ../../src/scan_aes.cpp:452:20: error: 'val' was not declared in this scope 452 | counts[val]++; | ^~~ ../../src/scan_aes.cpp:465:23: error: 'u_char' does not name a type; did you mean 'putchar'? 465 | const u_char val = buf[pos+AES128_KEY_SCHEDULE_SIZE]; | ^~ | putchar ../../src/scan_aes.cpp:466:24: error: 'val' was not declared in this scope 466 | counts[val]++; | ^~~ make[3]: [Makefile:1379: scan_aes.o] Error 1 make[3]: Leaving directory '/home/bulk_extractor/win64/src' make[2]: [Makefile:417: all-recursive] Error 1 make[2]: Leaving directory '/home/bulk_extractor/win64' make[1]: [Makefile:358: all] Error 2 make[1]: Leaving directory '/home/bulk_extractor/win64' make: [Makefile:873: win64/bulk_extractor64.exe] Error 2 I am in no way a C++ developer but managed to "resolve" this error by simply commenting out this section of code (I realise this is in no way a resolution). It then completed and moved on from scan_aes.cpp only to find a very similar error in scan_ccns2.cpp.

CONFIGUE_FEDORA31.bash has run successfully and completed and issued the instruction to run either:

cd ..; make win64 cd ..; make windist make Neither option 2 or 3 (no rule to make target) so it is option 1 I am getting this issues with.

I'd be interested to hear your views or a solution.

Many thanks.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.

simsong commented 2 years ago

(And this is my fault for using u_char as a datatype rather than the C++17 approved data type.)