AppImageLauncher icon indicating copy to clipboard operation
AppImageLauncher copied to clipboard

Error during compilation

Open Sachin-Bhat opened this issue 1 year ago • 8 comments

Pre-submit checks

  • [X] I checked for similar issues beforehand, but could not find any, not even closed ones. I could not add my bug report to any existing issue.
  • [X] I am going to take the time to to fill in all the required details. I know that the bug report will be dismissed otherwise.

Describe the bug

Get the following error while compiling, particularly running make:

In file included from /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:9: /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:25: error: 'uint8_t' was not declared in this scope 19 | std::vector<uint8_t> md5(std::istream& data); | ^~~~~~~ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:1:1: note: 'uint8_t' is defined in header ''; did you forget to '#include '? +++ |+#include 1 | #pragma once /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:32: error: template argument 1 is invalid 19 | std::vector<uint8_t> md5(std::istream& data); | ^ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:32: error: template argument 2 is invalid /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:25: error: 'uint8_t' was not declared in this scope 26 | std::vector<uint8_t> md5(const std::string& data); | ^~~~~~~ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:25: note: 'uint8_t' is defined in header ''; did you forget to '#include '? /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:32: error: template argument 1 is invalid 26 | std::vector<uint8_t> md5(const std::string& data); | ^ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:32: error: template argument 2 is invalid /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:43: error: 'uint8_t' was not declared in this scope 33 | std::string toHex(std::vector<uint8_t> digest); | ^~~~~~~ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:43: note: 'uint8_t' is defined in header ''; did you forget to '#include '? /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:50: error: template argument 1 is invalid 33 | std::string toHex(std::vector<uint8_t> digest); | ^ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:50: error: template argument 2 is invalid /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:19:34: error: ambiguating new declaration of 'std::vector appimage::utils::hashlib::md5(std::istream&)' 19 | std::vector<uint8_t> md5(std::istream& data) { | ^~~ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:34: note: old declaration 'int appimage::utils::hashlib::md5(std::istream&)' 19 | std::vector<uint8_t> md5(std::istream& data); | ^~~ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:42:34: error: ambiguating new declaration of 'std::vector appimage::utils::hashlib::md5(const std::string&)' 42 | std::vector<uint8_t> md5(const std::string& data) { | ^~~ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:34: note: old declaration 'int appimage::utils::hashlib::md5(const std::string&)' 26 | std::vector<uint8_t> md5(const std::string& data); | ^~~ /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp: In function 'std::vector appimage::utils::hashlib::md5(const std::string&)': /home/sachin/Downloads/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:44:27: error: could not convert 'appimage::utils::hashlib::md5(ss.std::__cxx11::basic_stringstream::.std::basic_iostream::)' from 'int' to 'std::vector' 44 | return md5(ss); | ~~~^~~~ | | | int make[2]: *** [lib/libappimage/src/libappimage/utils/CMakeFiles/appimage_utils.dir/build.make:104: lib/libappimage/src/libappimage/utils/CMakeFiles/appimage_utils.dir/hashlib.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:2462: lib/libappimage/src/libappimage/utils/CMakeFiles/appimage_utils.dir/all] Error 2 make: *** [Makefile:156: all] Error 2

Expected behavior

A smmooth compilation

Steps to reproduce the issue

  1. Clone the repository with the stable branch
  2. Follow BUILD.md
  3. At the process of make libappimage libappimageupdate libappimageupdate-qt and at the make command you should see this error
  4. The sudo make install also gives the same error

Screenshots

No response

Distribution and desktop environment

Distribution: Void Linux Kernel: 6.6.16_1 DE: Xfce 4.18

Installed AppImageLauncher version

Latest Release Build v2.2.0 Sep 29, 2020 commit: 0f91801

List of AppImages you tried

No response

Additional context

No response

Sachin-Bhat avatar Feb 11 '24 18:02 Sachin-Bhat

I got a slightly different error message on Void Linux, that suggested adding cstdint

modifying AppImageLauncher-2.2.0/lib/libappimage/src/libappimage/utils/hashlib.cpp in the build process to include cstdint fixed the compilation issues for me

#include <cstdint>

rasmussibbern88 avatar Mar 05 '24 23:03 rasmussibbern88

PRs welcome.

TheAssassin avatar Apr 25 '24 01:04 TheAssassin

I have a similar error when attempting to build this on Ubuntu 24.04 LTS:

In file included from ~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:9:
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:25: error: ‘uint8_t’ was not declared in this scope
   19 |             std::vector<uint8_t> md5(std::istream& data);
      |                         ^~~~~~~
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:1:1: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
  +++ |+#include <cstdint>
    1 | #pragma once
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:32: error: template argument 1 is invalid
   19 |             std::vector<uint8_t> md5(std::istream& data);
      |                                ^
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:32: error: template argument 2 is invalid
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:25: error: ‘uint8_t’ was not declared in this scope
   26 |             std::vector<uint8_t> md5(const std::string& data);
      |                         ^~~~~~~
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:25: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:32: error: template argument 1 is invalid
   26 |             std::vector<uint8_t> md5(const std::string& data);
      |                                ^
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:32: error: template argument 2 is invalid
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:43: error: ‘uint8_t’ was not declared in this scope
   33 |             std::string toHex(std::vector<uint8_t> digest);
      |                                           ^~~~~~~
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:43: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:50: error: template argument 1 is invalid
   33 |             std::string toHex(std::vector<uint8_t> digest);
      |                                                  ^
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:33:50: error: template argument 2 is invalid
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:19:34: error: ambiguating new declaration of ‘std::vector<unsigned char> appimage::utils::hashlib::md5(std::istream&)’
   19 |             std::vector<uint8_t> md5(std::istream& data) {
      |                                  ^~~
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:19:34: note: old declaration ‘int appimage::utils::hashlib::md5(std::istream&)’
   19 |             std::vector<uint8_t> md5(std::istream& data);
      |                                  ^~~
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:42:34: error: ambiguating new declaration of ‘std::vector<unsigned char> appimage::utils::hashlib::md5(const std::string&)’
   42 |             std::vector<uint8_t> md5(const std::string& data) {
      |                                  ^~~
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h:26:34: note: old declaration ‘int appimage::utils::hashlib::md5(const std::string&)’
   26 |             std::vector<uint8_t> md5(const std::string& data);
      |                                  ^~~
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp: In function ‘std::vector<unsigned char> appimage::utils::hashlib::md5(const std::string&)’:
~/AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.cpp:44:27: error: could not convert ‘appimage::utils::hashlib::md5(ss.std::__cxx11::basic_stringstream<char>::<anonymous>.std::basic_iostream<char>::<anonymous>)’ from ‘int’ to ‘std::vector<unsigned char>’
   44 |                 return md5(ss);
      |                        ~~~^~~~
      |                           |
      |                           int
make[2]: *** [lib/libappimage/src/libappimage/utils/CMakeFiles/appimage_utils.dir/build.make:104: lib/libappimage/src/libappimage/utils/CMakeFiles/appimage_utils.dir/hashlib.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2084: lib/libappimage/src/libappimage/utils/CMakeFiles/appimage_utils.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

ricperry avatar May 04 '24 17:05 ricperry

I added the line #include <cstdint> in the system includes at the top of hashlib.cpp, but now I'm getting this error:

[ 49%] Linking CXX shared library libappimage.so
/usr/bin/ld: desktop_integration/CMakeFiles/appimage_desktop_integration.dir/integrator/Integrator.cpp.o:(.rodata+0xa0): multiple definition of `_ZGRN15StringSanitizer13asciiLetters_E_'; utils/CMakeFiles/appimage_utils.dir/StringSanitizer.cpp.o:(.rodata+0x20): first defined here
/usr/bin/ld: desktop_integration/CMakeFiles/appimage_desktop_integration.dir/integrator/Integrator.cpp.o:(.rodata+0xd8): multiple definition of `_ZGRN15StringSanitizer12asciiDigits_E_'; utils/CMakeFiles/appimage_utils.dir/StringSanitizer.cpp.o:(.rodata+0x58): first defined here
/usr/bin/ld: desktop_integration/CMakeFiles/appimage_desktop_integration.dir/integrator/Integrator.cpp.o:(.rodata+0xe2): multiple definition of `_ZGRN15StringSanitizer14pathSafeChars_E_'; utils/CMakeFiles/appimage_utils.dir/StringSanitizer.cpp.o:(.rodata+0x62): first defined here
/usr/bin/ld: desktop_integration/CMakeFiles/appimage_desktop_integration.dir/integrator/DesktopEntryEditor.cpp.o:(.rodata+0x20): multiple definition of `_ZGRN15StringSanitizer13asciiLetters_E_'; utils/CMakeFiles/appimage_utils.dir/StringSanitizer.cpp.o:(.rodata+0x20): first defined here
/usr/bin/ld: desktop_integration/CMakeFiles/appimage_desktop_integration.dir/integrator/DesktopEntryEditor.cpp.o:(.rodata+0x58): multiple definition of `_ZGRN15StringSanitizer12asciiDigits_E_'; utils/CMakeFiles/appimage_utils.dir/StringSanitizer.cpp.o:(.rodata+0x58): first defined here
/usr/bin/ld: desktop_integration/CMakeFiles/appimage_desktop_integration.dir/integrator/DesktopEntryEditor.cpp.o:(.rodata+0x62): multiple definition of `_ZGRN15StringSanitizer14pathSafeChars_E_'; utils/CMakeFiles/appimage_utils.dir/StringSanitizer.cpp.o:(.rodata+0x62): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libappimage/src/libappimage/CMakeFiles/libappimage.dir/build.make:194: lib/libappimage/src/libappimage/libappimage.so.1.0.3] Error 1
make[1]: *** [CMakeFiles/Makefile2:2028: lib/libappimage/src/libappimage/CMakeFiles/libappimage.dir/all] Error 2
make: *** [Makefile:156: all] Error 2


ricperry avatar May 04 '24 17:05 ricperry

I added the line #include <cstdint> in the system includes at the top of hashlib.cpp, but now I'm getting this error:

Same issue here, #147 appears to be related

Anonymous941 avatar May 13 '24 15:05 Anonymous941

I'm getting the same errors trying to build it on Gentoo.

robinhood2014 avatar Sep 19 '24 02:09 robinhood2014

Probably because #662 has not been merged yet. Since #662 does not link to an issue that it really tries to resolve, would you mind building that branch and checking whether it fixes your problem? I need a successful test before I consider merging that PR.

TheAssassin avatar Sep 19 '24 18:09 TheAssassin

Since #662 does not link to an issue that it really tries to resolve,

@TheAssassin: I initially put that info in the commit message for 9768162. Also, just commented here to clarify. Sorry for the confusion!

trinitronx avatar Oct 11 '24 02:10 trinitronx

On Ubuntu 24.04 and Linux Mint 22 you need to add #include <stdint.h> to AppImageLauncher/lib/libappimage/src/libappimage/utils/hashlib.h.

But I get a different error in the end:

/usr/bin/ld: ../../lib/AppImageUpdate/lib/libappimage/src/libappimage/libappimage.so.1.0.3: undefined reference to `appimage::desktop_integration::Thumbnailer::normalThumbnailsPrefix'
/usr/bin/ld: ../../lib/AppImageUpdate/lib/libappimage/src/libappimage/libappimage.so.1.0.3: undefined reference to `appimage::desktop_integration::Thumbnailer::largeThumbnailPrefix'
collect2: error: ld returned 1 exit status
make[2]: *** [src/daemon/CMakeFiles/appimagelauncherd.dir/build.make:178: src/daemon/appimagelauncherd] Error 1
make[1]: *** [CMakeFiles/Makefile2:3739: src/daemon/CMakeFiles/appimagelauncherd.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

meow464 avatar Dec 22 '24 19:12 meow464

Cannot reproduce on the dev branch (with a newer libappimage release, that is). Closing for the mean time. PRs and new issues welcome.

TheAssassin avatar Feb 10 '25 22:02 TheAssassin

Yes, the problem mysteriously went away for me. Obviously not going to regression test it, just assuming it was fixed in some commit

Anonymous941 avatar Feb 12 '25 22:02 Anonymous941