arcbtc / LNURLPoS

Offline lightning PoS
GNU General Public License v3.0
205 stars 34 forks source link

'QRCode' was not declared in this scope? #1

Closed HamishMacEwan closed 2 years ago

HamishMacEwan commented 2 years ago

Hi,

I've checked that I followed the instructions and I have Googled for this error, but none of the results seem conclusive or apply.

It's my first time with the Arduino IDE, but it seems to have found and I've installed the libraries required, and though I'm still waiting for the hardware, thought I'd get about preparing for its arrival by verifying, by compilation, the set up.

javaw_APOakbDu48

If there's any additional information required, please advise.

arcbtc commented 2 years ago

Thanks Hamish! You need to copy the libraries into your arduino core libraries folder. Open File>Examples>Basic>Blink Go to Sketch>Show sketch foler Now you have your Arduino install folder, go down a few levels image Then place the projects libraries in the core libraries folder: image

Should be gravy now!

HamishMacEwan commented 2 years ago

Thanks very much for the instructions. It has led to a long and frustrating encounter with Windows 10 permissions.

The directory for the installation as derived from your guidance above is:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.51.0_x86__mdqgnx93n4wtt\libraries

All attempts to copy the files there have been met with refusal and my permissions foo has not been very successful, though I do now "own" the WindowsApps folder, to no useful effect.

Currently I have the additional libraries in a more accessible folder and for all but the QRCode library that appears to be working:

Using library SPI at version 2.0.0 in folder: C:\Users\User\OneDrive\Documents - Old\ArduinoData\packages\esp32\hardware\esp32\2.0.0\libraries\SPI 

Using library TFT_eSPI at version 2.2.20 in folder: C:\Users\User\OneDrive\Documents - Old\Arduino\libraries\TFT_eSPI 

Using library FS at version 2.0.0 in folder: C:\Users\User\OneDrive\Documents - Old\ArduinoData\packages\esp32\hardware\esp32\2.0.0\libraries\FS 

Using library SPIFFS at version 2.0.0 in folder: C:\Users\User\OneDrive\Documents - Old\ArduinoData\packages\esp32\hardware\esp32\2.0.0\libraries\SPIFFS 

Using library Keypad at version 3.1.1 in folder: C:\Users\User\OneDrive\Documents - Old\Arduino\libraries\Keypad 

Using library uBitcoin at version 0.1.2 in folder: C:\Users\User\OneDrive\Documents - Old\Arduino\libraries\uBitcoin 

There is a collision at: explorer_2ZRcJtRtTK

That is another qrcode.h at C:\Users\User\OneDrive\Documents - Old\ArduinoData\packages\esp32\hardware\esp32\2.0.0\tools\sdk\esp32\include\qrcode\include which is fulfilling the #include though not usefully.

Is there are way to specify exactly the order of paths to search or include a path in the #include syntax?

babysnakeum commented 2 years ago

FYI I'm observing the same issue on mac, even after copying the libraries into arduinos core libraries folder.

EDIT: After properly dropping Arduino app into Applications folder and putting the required libraries into ~/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/ it seems to work fine 👍

HamishMacEwan commented 2 years ago
Arduino: 1.8.16 (Windows 10), Board: "TTGO LoRa32-OLED V1, 80MHz, 921600, None"

c:/users/user/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r1/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0/tools/sdk/esp32/lib\libwpa_supplicant.a(crypto_mbedtls.c.obj): in function `hmac_sha256':

/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/wpa_supplicant/src/crypto/crypto_mbedtls.c:254: multiple definition of `hmac_sha256'; libraries\uBitcoin\utility\trezor\hmac.c.o:C:\Program Files (x86)\arduino-1.8.16\libraries\uBitcoin\src\utility\trezor/hmac.c:67: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board TTGO LoRa32-OLED V1.

Different error, so one thing is solved.

citizenanalog commented 2 years ago

I'm getting the same 'QRCode' was not declared in this scope.

Ubuntu 20

citizenanalog commented 2 years ago
Arduino: 1.8.16 (Windows 10), Board: "TTGO LoRa32-OLED V1, 80MHz, 921600, None"

c:/users/user/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r1/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0/tools/sdk/esp32/lib\libwpa_supplicant.a(crypto_mbedtls.c.obj): in function `hmac_sha256':

/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/wpa_supplicant/src/crypto/crypto_mbedtls.c:254: multiple definition of `hmac_sha256'; libraries\uBitcoin\utility\trezor\hmac.c.o:C:\Program Files (x86)\arduino-1.8.16\libraries\uBitcoin\src\utility\trezor/hmac.c:67: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board TTGO LoRa32-OLED V1.

Different error, so one thing is solved.

If I comment out all the QRcode stuff I get this error too...

ShelbyApp commented 2 years ago

I've put the QRCode library in every libraries folder that exists and still have this problem.

I can even click Sketch->Include Library->QRCode which includes and still get the problem

I can access the QRCode example through the Arduino software and that won't compile either (Same error)

Seems like there is a bigger problem going on?

citizenanalog commented 2 years ago

I've put the QRCode library in every libraries folder that exists and still have this problem.

I can even click Sketch->Include Library->QRCode which includes and still get the problem

I can access the QRCode example through the Arduino software and that won't compile either (Same error)

Seems like there is a bigger problem going on?

I had to switch to MacOS and had to add the libraries manually but eventually got it to work. Still no luck on Ubuntu.

ShelbyApp commented 2 years ago

QRCode Solved: There is already a QR Code library which does not include the same references 1) Rename QRCode Folder: QRCode2 2) Rename QRCode.h QRCode2.h, rename QRCode.c QRCode2.c 3) Change reference to "QRCode2.h" in main file 4) Don't forget to go into QRCode2.c and change its reference to QRCode2.h

Second hmac error: Still not sure how to fix this, however, I am finding it odd the error is pointing to the creators folder, so there must be some weird reference as I do not have a 'ficeto' folder. Should provide some insight however I am not sure what insight that is :)

/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/wpa_supplicant/src/crypto/crypto_mbedtls.c:254: multiple definition of `hmac_sha256';

ShelbyApp commented 2 years ago

DING DING DING

If you go to utilities/trezor/hmac.c

There are 2 definitions of the following, if you delete 1 then it should work.

** It looks like one is for confidential addresses and the other for basic

void hmac_sha256(const uint8_t key, const uint32_t keylen, const uint8_t msg, const uint32_t msglen, uint8_t *hmac) { static CONFIDENTIAL HMAC_SHA256_CTX hctx; hmac_sha256_Init(&hctx, key, keylen); hmac_sha256_Update(&hctx, msg, msglen); hmac_sha256_Final(&hctx, hmac); }

void hmac_sha512(const uint8_t key, const uint32_t keylen, const uint8_t msg, const uint32_t msglen, uint8_t *hmac) { HMAC_SHA512_CTX hctx; hmac_sha512_Init(&hctx, key, keylen); hmac_sha512_Update(&hctx, msg, msglen); hmac_sha512_Final(&hctx, hmac); }

IMG_0467

claytantor commented 2 years ago

So I created a PR that should solve these build problems, at least this is what I had to do to get it to build...

https://github.com/arcbtc/LNURLPoS/pull/12

trbouma commented 2 years ago

DING DING DING

If you go to utilities/trezor/hmac.c

There are 2 definitions of the following, if you delete 1 then it should work.

** It looks like one is for confidential addresses and the other for basic

void hmac_sha256(const uint8_t key, const uint32_t keylen, const uint8_t msg, const uint32_t msglen, uint8_t *hmac) { static CONFIDENTIAL HMAC_SHA256_CTX hctx; hmac_sha256_Init(&hctx, key, keylen); hmac_sha256_Update(&hctx, msg, msglen); hmac_sha256_Final(&hctx, hmac); }

void hmac_sha512(const uint8_t key, const uint32_t keylen, const uint8_t msg, const uint32_t msglen, uint8_t *hmac) { HMAC_SHA512_CTX hctx; hmac_sha512_Init(&hctx, key, keylen); hmac_sha512_Update(&hctx, msg, msglen); hmac_sha512_Final(&hctx, hmac); }

IMG_0467

Hi I successfully got to this point then encountered this error below. I am running Ubuntu 20

Arduino: 1.8.18 (Linux), Board: "TTGO LoRa32-OLED V1, 80MHz, 921600, None"

Traceback (most recent call last): File "/home/trbouma/.arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool.py", line 38, in import serial ImportError: No module named serial exit status 1 Error compiling for board TTGO LoRa32-OLED V1.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.