hasherezade / bearparser

Portable Executable parsing library (from PE-bear)

Home Page:https://hasherezade.github.io/bearparser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"ExeFactory.cpp" doesn't compile with Clang under Termux when running "build_qt5.sh"

visagemsc opened this issue · comments

(Originally found in PE-Bear, thought it should go here)

Was building PE-Bear and all went well until make reached "ExeFactory.cpp" and Clang spat out a massive warning/error message.

Clang error message:

In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:4:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_undoc.h:5:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
    5 | #include "../win_hdrs/pshpack4.h" // ensure that 4 byte packing (the default) is used
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack4.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(4)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:40:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
   40 | #include "../win_hdrs/pshpack4.h"                   // 4 byte packing is the default
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack4.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(4)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:41:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
   41 | #include "../win_hdrs/pshpack2.h"                   // 16 bit headers are 2 byte packed
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack2.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(2)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:152:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
  152 | #include "../win_hdrs/poppack.h"                    // Back to 4 byte packing
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/poppack.h:34:9: note: previous '#pragma pack' directive that modifies alignment is here
   34 | #pragma pack()
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:455:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
  455 | #include "../win_hdrs/pshpack2.h"                       // Symbols, relocs, and linenumbers are 2 byte packed
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack2.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(2)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:632:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
  632 | #include "../win_hdrs/poppack.h"
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/poppack.h:34:9: note: previous '#pragma pack' directive that modifies alignment is here
   34 | #pragma pack()
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1120:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1120 | #include "../win_hdrs/pshpack8.h"                       // Use align 8 for the 64-bit IAT.
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack8.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(8)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1132:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1132 | #include "../win_hdrs/poppack.h"                        // Back to 4 byte packing
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/poppack.h:34:9: note: previous '#pragma pack' directive that modifies alignment is here
   34 | #pragma pack()
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1348:11: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1348 |  #include "../win_hdrs/pshpack4.h"                       // Use align 4
      |           ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack4.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(4)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1461:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1461 | #include "../win_hdrs/poppack.h"                        // Back to the previous packing
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/poppack.h:34:9: note: previous '#pragma pack' directive that modifies alignment is here
   34 | #pragma pack()
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1731:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1731 | #include "../win_hdrs/pshpack4.h"                   // 4 byte packing (DWORD alligned)
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack4.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(4)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1804:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1804 | #include "../win_hdrs/poppack.h"                // Back to the initial value
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/poppack.h:34:9: note: previous '#pragma pack' directive that modifies alignment is here
   34 | #pragma pack()
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1806:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1806 | #include "../win_hdrs/pshpack2.h"                   // 2 byte packing (WORD alligned)
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/pshpack2.h:30:9: note: previous '#pragma pack' directive that modifies alignment is here
   30 | #pragma pack(2)
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:4:
In file included from /data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DosHdrWrapper.h:6:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/pe_formats.h:1897:10: warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
 1897 | #include "../win_hdrs/poppack.h"                // Back to the initial value
      |          ^
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/../win_hdrs/poppack.h:34:9: note: previous '#pragma pack' directive that modifies alignment is here
   34 | #pragma pack()
      |         ^
In file included from /data/data/com.termux/files/home/bearparser/parser/ExeFactory.cpp:3:
/data/data/com.termux/files/home/bearparser/parser/include/bearparser/pe/DOSExe.h:56:22: error: expected unqualified-id
   56 |         const size_t PAGE_SIZE = 0x200;
      |                      ^
/data/data/com.termux/files/usr/include/sys/user.h:38:19: note: expanded from macro 'PAGE_SIZE'
   38 | #define PAGE_SIZE 4096
      |                   ^
14 warnings and 1 error generated.

Output of clang -v:

clang version 17.0.5
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin

Steps to reproduce:

1. Install all necessary packages

pkg in build-essentials \
clang \
cmake \
git \
qt5-qmake qt5-qtbase qt5-qtbase-cross-tools qt5-qtbase-gtk-platformtheme qt5-qtdeclarative qt5-qtdeclarative-cross-tools qt5-qtgraphicaleffects qt5-qtlocation qt5-qtmultimedia qt5-qtquickcontrols qt5-qtquickcontrols2 qt5-qtscript qt5-qtsensors qt5-qtserialport qt5-qtsvg qt5-qttools qt5-qttools-cross-tools qt5-qtwebchannel qt5-qtwebengine qt5-qtwebkit qt5-qtwebsockets qt5-qtx11extras qt5-qtxmlpatterns qt5ct

2. Clone bearparser:

git clone https://github.com/hasherezade/bearparser --depth=1

3. Run ./build_qt5.sh:

cd bearparser && ./build_qt5.sh

hi @visagemsc ! thanks for reporting, I will check it and try to fix it soon.

@visagemsc - the error should be fixed now, please check it out and let me know. Regarding the warnings, I will take care of this later.

That did fix the ExeFactory.cpp error, though there's another error in PEFile.cpp, regarding page size again. Here's the entire logfile of the build, which also has certain deprecation errors from CMake.

~ $ cmake --version
cmake version 3.27.8

CMake suite maintained and supported by Kitware (kitware.com/cmake).

@visagemsc - I fixed the second error, please let me know if it builds now.

Built and ran very well. Thank you.