Skip to content

Building on Ubuntu is not working #10

@redtux

Description

@redtux

👋🏼 Hi, thank you for these scripts! 👍🏼

On Ubuntu focal 20.04.2 LTS I am having the issues described below with rapidxml, config4cpp and libcrypto++ when trying to build the huawei_band_tool.

Requirements

All packages required for compilation have been installed.

sudo apt install g++ libcurl4-gnutls-dev librapidxml-dev libcrypto++-dev libsdl2-net-dev

Here are the installed versions.

  • g++ 9.3.0-17ubuntu1~20.04
  • libcurl4-gnutls-dev 7.68.0-1ubuntu2.5
  • librapidxml-dev 1.13-2
  • libcrypto++-dev 5.6.4-9build1
  • libsdl2-net-dev 2.0.1+dfsg1-4

rapidxml

Typing make install inside Huawei_Tool/src as described in the readme (which should point to ./compile.sh btw) results in the following error:

g++ -std=c++0x -O3 -I. -Wall -Wextra -Werror=format -DWORK_IN_PROGRESS -c -o at_tcp.o at_tcp.cpp
In file included from huawei_tools.h:22,
                 from at_tcp.cpp:22:
tools.h:34:10: fatal error: rapidxml.hpp: No such file or directory
   34 | #include <rapidxml.hpp>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:87: at_tcp.o] Error 1

This is due to a wrong include path for rapidxml. Changing line 34 in tools.h and line 26 in web.cpp to #include <rapidxml/rapidxml.hpp> fixes this issue.

config4cpp

The next error is because of missing header files for config4cpp.

g++ -std=c++0x -O3 -I. -Wall -Wextra -Werror=format -DWORK_IN_PROGRESS -c -o main.o main.cpp
In file included from main.cpp:20:
huawei_tools.h:167:2: warning: #warning min max range ignore [-Wcpp]
  167 | #warning min max range ignore
      |  ^~~~~~~
huawei_tools.h:288:6: warning: #warning WEB [-Wcpp]
  288 |     #warning WEB
      |      ^~~~~~~
main.cpp:28:10: fatal error: config4cpp/Configuration.h: No such file or directory
   28 | #include <config4cpp/Configuration.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:87: main.o] Error 1

Copying include/config4cpp from https://github.com/config4star/config4cpp solves this issue.

crypto++

./compile.sh (or make install respectively) still throws some errors concerning CryptoPP.

tools.cpp: In function 'std::string& sha256(const string&, std::string&)':
tools.cpp:243:15: error: 'byte' is not a member of 'CryptoPP'; did you mean 'byte'?
  243 |     CryptoPP::byte digest[CryptoPP::SHA256::DIGESTSIZE];
      |               ^~~~
In file included from /usr/include/cryptopp/cryptlib.h:86,
                 from tools.cpp:25:
/usr/include/cryptopp/config.h:203:23: note: 'byte' declared here
  203 | typedef unsigned char byte;  // put in global namespace to avoid ambiguity with other byte typedefs
      |                       ^~~~
tools.cpp:244:26: error: 'digest' was not declared in this scope
  244 |     hash.CalculateDigest(digest, (CryptoPP::byte*)msg.c_str(), msg.length());
      |                          ^~~~~~
tools.cpp:244:45: error: 'byte' is not a member of 'CryptoPP'; did you mean 'byte'?
  244 |     hash.CalculateDigest(digest, (CryptoPP::byte*)msg.c_str(), msg.length());
      |                                             ^~~~
In file included from /usr/include/cryptopp/cryptlib.h:86,
                 from tools.cpp:25:
/usr/include/cryptopp/config.h:203:23: note: 'byte' declared here
  203 | typedef unsigned char byte;  // put in global namespace to avoid ambiguity with other byte typedefs
      |                       ^~~~
tools.cpp:244:50: error: expected primary-expression before ')' token
  244 |     hash.CalculateDigest(digest, (CryptoPP::byte*)msg.c_str(), msg.length());
      |                                                  ^
tools.cpp: At global scope:
tools.cpp:486:73: warning: optimization attribute on 'void* memcpy(void*, const void*, size_t)' follows definition but the attribute does
n't match [-Wattributes]
  486 | void *memcpy(void *__restrict dest, const void *__restrict src, size_t n)
      |                                                                         ^
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/c++config.h:524,
                 from /usr/include/c++/9/bits/stl_algobase.h:59,
                 from /usr/include/c++/9/vector:60,
                 from tools.h:22,
                 from tools.cpp:19:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:31:1: note: previous definition of 'void* memcpy(void*, const void*, size_t)' here
   31 | __NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
      | ^~~~~
make: *** [Makefile:87: tools.o] Error 1
make: *** Waiting for unfinished jobs....

Unfortunately, going through https://www.cryptopp.com/wiki/Std::byte did not help me much in better understanding the issue… 😸

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions