akopachov / flipper-zero_authenticator

Software-based TOTP/HOTP authenticator for Flipper Zero device.
GNU General Public License v3.0
544 stars 25 forks source link

[BUG] Build fails for Official Firmware v 0.99.1 #229

Closed dengesCU closed 3 months ago

dengesCU commented 5 months ago

Describe the bug I am trying to build totp.fap for the latest official firmware 0.99.1 and it fails with the error message

To Reproduce Steps to reproduce the behavior:

  1. I cloned https://github.com/flipperdevices/flipperzero-firmware.git and placed the totp folder in the applications_user folder.
  2. Running ./fbt fap_totp gives an error and the resulting totp.fap file does not work
  3. See error
    LoadAppManifest, line 130, in file "/home/user/Documents/flipper/flipperzero-firmware/scripts/fbt_tools/fbt_apps.py"
    CC  applications_user/totp/ui/scenes/authenticate/totp_scene_authenticate.c
    CC  applications_user/totp/ui/scenes/standby/standby.c
    SDKCHK  targets/f7/api_symbols.csv
    LINK    build/f7-firmware-D/.extapps/totp_d.elf
    API version 58.0 is up to date
    APPMETA build/f7-firmware-D/.extapps/totp.fap
    APPFILE build/f7-firmware-D/.extapps/totp.fap
    FAP build/f7-firmware-D/.extapps/totp.fap
    FASTFAP build/f7-firmware-D/.extapps/totp.fap
    APPCHK  build/f7-firmware-D/.extapps/totp.fap
    scons: *** [build/f7-firmware-D/.extapps/totp.impsyms] build/f7-firmware-D/.extapps/totp.fap: app may not be runnable. Symbols not resolved using firmware's API: {'I_WarningDolphinFlip_45x42'}

** FBT ERRORS ** build/f7-firmware-D/.extapps/totp.impsyms: build/f7-firmware-D/.extapps/totp.fap: app may not be runnable. Symbols not resolved using firmware's API: {'I_WarningDolphinFlip_45x42'}

Preliminary fix The files totp/ui/scenes/authenticate/totp_scene_authenticate.c and totp/ui/scenes/standby/standby.c use the API symbol I_WarningDolphinFlip_45x42 which apparently is not defined.

Commenting out the sections in the two files makes the program compile again and now I also get working 2FA codes.

The git diff is :

-#if __has_include(<assets_icons.h>)
-            dialog_message_set_icon(message, &I_WarningDolphinFlip_45x42, 83, 22);
-#else
+//#if __has_include(<assets_icons.h>)
+//            dialog_message_set_icon(message, &I_WarningDolphinFlip_45x42, 83, 22);
+//#else
             dialog_message_set_icon(message, &I_DolphinCommon_56x48, 72, 17);
-#endif
+//#endif
             dialog_message_show(plugin_state->dialogs_app, message);
             dialog_message_free(message);
         }
diff --git a/totp/ui/scenes/standby/standby.c b/totp/ui/scenes/standby/standby.c
index 6ac4d65..eed7792 100644
--- a/totp/ui/scenes/standby/standby.c
+++ b/totp/ui/scenes/standby/standby.c
@@ -6,11 +6,11 @@
 #include "../../constants.h"

 void totp_scene_standby_render(Canvas* const canvas) {
-#if __has_include(<assets_icons.h>)
-    canvas_draw_icon(canvas, SCREEN_WIDTH - 50, SCREEN_HEIGHT - 44, &I_WarningDolphinFlip_45x42);
-#else
+//#if __has_include(<assets_icons.h>)
+//    canvas_draw_icon(canvas, SCREEN_WIDTH - 50, SCREEN_HEIGHT - 44, &I_WarningDolphinFlip_45x42);
+//#else
     canvas_draw_icon(canvas, SCREEN_WIDTH - 56, SCREEN_HEIGHT - 48, &I_DolphinCommon_56x48);
-#endif
+//#endif

Expected behavior totp.fap file that works on official firmware

Device information (please complete the following information):

akopachov commented 5 months ago

Looks like uFBT builds it just fine. I guess you need to build firmware\SDK (or so) first and then build Authenticator.

dengesCU commented 5 months ago

Thanks for the quick reply, I'll look into uFBT for building it in the future. The fap file from the nightly build also works on my flipper. So problem solved :)

Just in case, this is how the build error is reproducible for me (with clean repos):

git clone --recursive https://github.com/flipperdevices/flipperzero-firmware.git
git clone https://github.com/akopachov/flipper-zero_authenticator.git
cd flipperzero-firmware
git checkout release
ln -s ../../flipper-zero_authenticator/totp applications_user/totp
./fbt fap_totp

PS: Since I still don't know how to build correctly using fbt but it clearly works for you with uFBT, I'll leave the issue open, but please feel free to close it. Thanks again for the help and of course for the great app

akopachov commented 5 months ago

Glad you like it!

Also, thank you for providing the steps to reproduce.