flipperdevices / flipperzero-ufbt

Compact tool for building and debugging applications for Flipper Zero.
https://pypi.org/project/ufbt/
GNU General Public License v3.0
587 stars 38 forks source link

ufbt fails to build app on M2 MacBook Air (Sonoma 14.3.1) #39

Open joef001 opened 8 months ago

joef001 commented 8 months ago

Hi, I am working on a M2 MacBook Air with MacOS Sonoma 14.3.1 and set up ufbt following the instructions in the README. VSCode was configured with ufbt vscode_dist. From what I can gather, ufbt is configures correctly:

22:24:35.026 [I] uFBT version    0.2.5
22:24:35.026 [I] State dir       /Users/fb/.ufbt
22:24:35.026 [I] Download dir    /Users/fb/.ufbt/download
22:24:35.026 [I] SDK dir         /Users/fb/.ufbt/current
22:24:35.026 [I] Toolchain dir   /Users/fb/.ufbt/toolchain
22:24:35.026 [I] Target          f7
22:24:35.026 [I] Mode            channel
22:24:35.026 [I] Version         0.99.1
22:24:35.026 [I] Details         {'hw_target': 'f7', 'mode': 'channel', 'channel': 'release', 'json_index': 'https://update.flipperzero.one/firmware/directory.json', 'version': '0.99.1'}`

I created a new boilerplate app with ufbt create APPID=flipper_app. Trying to build the app fails with the following output:

scons: Entering directory `/Users/fb/.ufbt/current/scripts/ufbt'
        LINK    /Users/fb/.ufbt/build/flipper_app_d.elf
        CDB     /Users/fb/Documents/Projekte/flipper_app/.vscode/compile_commands.json
/Users/fb/.ufbt/toolchain/arm64-darwin/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld:/Users/fb/Documents/Projekte/flipper_app/flipper_app.code-workspace: file format not recognized; treating as linker script
/Users/fb/.ufbt/toolchain/arm64-darwin/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld:/Users/fb/Documents/Projekte/flipper_app/flipper_app.code-workspace:1: syntax error
collect2: error: ld returned 1 exit status
scons: *** [/Users/fb/.ufbt/build/flipper_app_d.elf] Error 1

It appears, that the linker does not find what it needs. The elf file does not seem to be created. The build folder only contains:

Can someone point me in the right direction to resolve this issue? Searching the web does not give me any meaningful hints. Thanks a lot.

hedger commented 7 months ago

Please run ufbt -c in that folder, then re-run ufbt VERBOSE=1 and attach command output here. Also could you please share the project files that were generated on your system?

joef001 commented 7 months ago

Hi, thanks for the reply. The output was:

❯ ufbt VERBOSE=1
scons: Entering directory `/Users/fb/.ufbt/current/scripts/ufbt'
python3 /Users/fb/.ufbt/current/scripts/assets.py icons /Users/fb/Documents/Projekte/flipper_app/images /Users/fb/.ufbt/build/flipper_app --filename flipper_app_icons
        CDB     /Users/fb/Documents/Projekte/flipper_app/.vscode/compile_commands.json
arm-none-eabi-gcc -o /Users/fb/.ufbt/build/flipper_app/flipper_app.o -c -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -Wall -Wextra -Werror -Wno-error=deprecated-declarations -Wno-address-of-packed-member -Wredundant-decls -Wdouble-promotion -fdata-sections -ffunction-sections -fsingle-precision-constant -fno-math-errno -g -Os -mword-relocations -mlong-calls -fno-common -nostdlib -D_GNU_SOURCE -DFW_CFG_default -D"M_MEMORY_FULL(x)=abort()" -DSTM32WB -DSTM32WB55xx -DUSE_FULL_ASSERT -DUSE_FULL_LL_DRIVER -DMBEDTLS_CONFIG_FILE=\"mbedtls_cfg.h\" -DPB_ENABLE_MALLOC -DFW_ORIGIN_Official -DFURI_NDEBUG -DNDEBUG -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/furi -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/applications/services -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/furi_hal_include -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/f7/ble_glue -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/f7/furi_hal -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/f7/inc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/mlib -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/cmsis_core -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/stm32wb_cmsis/Include -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/stm32wb_hal/Inc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/stm32wb_copro/wpan -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/drivers -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/mbedtls/include -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/toolbox -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/libusb_stm32/inc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/drivers -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/flipper_format -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/one_wire -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/ibutton -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/infrared/encoder_decoder -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/infrared/worker -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/subghz -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/nfc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/digital_signal -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/pulse_reader -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/signal_reader -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/lfrfid -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/flipper_application -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/music_worker -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/mjs -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/nanopb -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/ble_profile -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/bit_lib -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/datetime -DFAP_VERSION=\"0.1\" -I/Users/fb/.ufbt/build/flipper_app -I/Users/fb/Documents/Projekte/flipper_app /Users/fb/Documents/Projekte/flipper_app/flipper_app.c
arm-none-eabi-gcc -o /Users/fb/.ufbt/build/flipper_app/flipper_app_icons.o -c -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -Wall -Wextra -Werror -Wno-error=deprecated-declarations -Wno-address-of-packed-member -Wredundant-decls -Wdouble-promotion -fdata-sections -ffunction-sections -fsingle-precision-constant -fno-math-errno -g -Os -mword-relocations -mlong-calls -fno-common -nostdlib -D_GNU_SOURCE -DFW_CFG_default -D"M_MEMORY_FULL(x)=abort()" -DSTM32WB -DSTM32WB55xx -DUSE_FULL_ASSERT -DUSE_FULL_LL_DRIVER -DMBEDTLS_CONFIG_FILE=\"mbedtls_cfg.h\" -DPB_ENABLE_MALLOC -DFW_ORIGIN_Official -DFURI_NDEBUG -DNDEBUG -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/furi -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/applications/services -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/furi_hal_include -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/f7/ble_glue -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/f7/furi_hal -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/f7/inc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/mlib -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/cmsis_core -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/stm32wb_cmsis/Include -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/stm32wb_hal/Inc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/stm32wb_copro/wpan -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/drivers -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/mbedtls/include -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/toolbox -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/libusb_stm32/inc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/drivers -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/flipper_format -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/one_wire -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/ibutton -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/infrared/encoder_decoder -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/infrared/worker -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/subghz -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/nfc -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/digital_signal -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/pulse_reader -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/signal_reader -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/lfrfid -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/flipper_application -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/music_worker -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/mjs -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/nanopb -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/ble_profile -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/bit_lib -I/Users/fb/.ufbt/current/sdk_headers/f7_sdk/lib/datetime -DFAP_VERSION=\"0.1\" -I/Users/fb/.ufbt/build/flipper_app -I/Users/fb/Documents/Projekte/flipper_app /Users/fb/.ufbt/build/flipper_app/flipper_app_icons.c
Using tempfile /var/folders/63/v5g4fwcx5zq349z9jw4sg4n40000gn/T/tmpcn22ppxw.lnk for command line:
arm-none-eabi-gcc -o /Users/fb/.ufbt/build/flipper_app_d.elf -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -mthumb -Wl,--no-warn-rwx-segment -Wl,--wrap,fflush -Wl,--wrap,fflush_unlocked -Wl,--wrap,_fflush_r -Wl,--wrap,_fflush_unlocked_r -Wl,--wrap,printf -Wl,--wrap,printf_unlocked -Wl,--wrap,_printf_r -Wl,--wrap,_printf_unlocked_r -Wl,--wrap,putc -Wl,--wrap,putc_unlocked -Wl,--wrap,_putc_r -Wl,--wrap,_putc_unlocked_r -Wl,--wrap,putchar -Wl,--wrap,putchar_unlocked -Wl,--wrap,_putchar_r -Wl,--wrap,_putchar_unlocked_r -Wl,--wrap,puts -Wl,--wrap,puts_unlocked -Wl,--wrap,_puts_r -Wl,--wrap,_puts_unlocked_r -Wl,--wrap,snprintf -Wl,--wrap,snprintf_unlocked -Wl,--wrap,_snprintf_r -Wl,--wrap,_snprintf_unlocked_r -Wl,--wrap,vsnprintf -Wl,--wrap,vsnprintf_unlocked -Wl,--wrap,_vsnprintf_r -Wl,--wrap,_vsnprintf_unlocked_r -Wl,--wrap,__assert -Wl,--wrap,__assert_unlocked -Wl,--wrap,___assert_r -Wl,--wrap,___assert_unlocked_r -Wl,--wrap,__assert_func -Wl,--wrap,__assert_func_unlocked -Wl,--wrap,___assert_func_r -Wl,--wrap,___assert_func_unlocked_r -Wl,--wrap,setbuf -Wl,--wrap,setbuf_unlocked -Wl,--wrap,_setbuf_r -Wl,--wrap,_setbuf_unlocked_r -Wl,--wrap,setvbuf -Wl,--wrap,setvbuf_unlocked -Wl,--wrap,_setvbuf_r -Wl,--wrap,_setvbuf_unlocked_r -Wl,--wrap,fprintf -Wl,--wrap,fprintf_unlocked -Wl,--wrap,_fprintf_r -Wl,--wrap,_fprintf_unlocked_r -Wl,--wrap,vfprintf -Wl,--wrap,vfprintf_unlocked -Wl,--wrap,_vfprintf_r -Wl,--wrap,_vfprintf_unlocked_r -Wl,--wrap,vprintf -Wl,--wrap,vprintf_unlocked -Wl,--wrap,_vprintf_r -Wl,--wrap,_vprintf_unlocked_r -Wl,--wrap,fputc -Wl,--wrap,fputc_unlocked -Wl,--wrap,_fputc_r -Wl,--wrap,_fputc_unlocked_r -Wl,--wrap,fputs -Wl,--wrap,fputs_unlocked -Wl,--wrap,_fputs_r -Wl,--wrap,_fputs_unlocked_r -Wl,--wrap,sprintf -Wl,--wrap,sprintf_unlocked -Wl,--wrap,_sprintf_r -Wl,--wrap,_sprintf_unlocked_r -Wl,--wrap,asprintf -Wl,--wrap,asprintf_unlocked -Wl,--wrap,_asprintf_r -Wl,--wrap,_asprintf_unlocked_r -Wl,--wrap,vasprintf -Wl,--wrap,vasprintf_unlocked -Wl,--wrap,_vasprintf_r -Wl,--wrap,_vasprintf_unlocked_r -Wl,--wrap,asiprintf -Wl,--wrap,asiprintf_unlocked -Wl,--wrap,_asiprintf_r -Wl,--wrap,_asiprintf_unlocked_r -Wl,--wrap,asniprintf -Wl,--wrap,asniprintf_unlocked -Wl,--wrap,_asniprintf_r -Wl,--wrap,_asniprintf_unlocked_r -Wl,--wrap,asnprintf -Wl,--wrap,asnprintf_unlocked -Wl,--wrap,_asnprintf_r -Wl,--wrap,_asnprintf_unlocked_r -Wl,--wrap,diprintf -Wl,--wrap,diprintf_unlocked -Wl,--wrap,_diprintf_r -Wl,--wrap,_diprintf_unlocked_r -Wl,--wrap,fiprintf -Wl,--wrap,fiprintf_unlocked -Wl,--wrap,_fiprintf_r -Wl,--wrap,_fiprintf_unlocked_r -Wl,--wrap,iprintf -Wl,--wrap,iprintf_unlocked -Wl,--wrap,_iprintf_r -Wl,--wrap,_iprintf_unlocked_r -Wl,--wrap,siprintf -Wl,--wrap,siprintf_unlocked -Wl,--wrap,_siprintf_r -Wl,--wrap,_siprintf_unlocked_r -Wl,--wrap,sniprintf -Wl,--wrap,sniprintf_unlocked -Wl,--wrap,_sniprintf_r -Wl,--wrap,_sniprintf_unlocked_r -Wl,--wrap,vasiprintf -Wl,--wrap,vasiprintf_unlocked -Wl,--wrap,_vasiprintf_r -Wl,--wrap,_vasiprintf_unlocked_r -Wl,--wrap,vasniprintf -Wl,--wrap,vasniprintf_unlocked -Wl,--wrap,_vasniprintf_r -Wl,--wrap,_vasniprintf_unlocked_r -Wl,--wrap,vasnprintf -Wl,--wrap,vasnprintf_unlocked -Wl,--wrap,_vasnprintf_r -Wl,--wrap,_vasnprintf_unlocked_r -Wl,--wrap,vdiprintf -Wl,--wrap,vdiprintf_unlocked -Wl,--wrap,_vdiprintf_r -Wl,--wrap,_vdiprintf_unlocked_r -Wl,--wrap,vfiprintf -Wl,--wrap,vfiprintf_unlocked -Wl,--wrap,_vfiprintf_r -Wl,--wrap,_vfiprintf_unlocked_r -Wl,--wrap,viprintf -Wl,--wrap,viprintf_unlocked -Wl,--wrap,_viprintf_r -Wl,--wrap,_viprintf_unlocked_r -Wl,--wrap,vsiprintf -Wl,--wrap,vsiprintf_unlocked -Wl,--wrap,_vsiprintf_r -Wl,--wrap,_vsiprintf_unlocked_r -Wl,--wrap,vsniprintf -Wl,--wrap,vsniprintf_unlocked -Wl,--wrap,_vsniprintf_r -Wl,--wrap,_vsniprintf_unlocked_r -specs=nano.specs -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_calloc_r -Wl,--wrap,_realloc_r -n -Xlinker -Map=/Users/fb/.ufbt/build/flipper_app_d.elf.map -T/Users/fb/.ufbt/current/sdk_headers/f7_sdk/targets/f7/application_ext.ld -Ur -Wl,-Ur -nostartfiles -mlong-calls -fno-common -nostdlib -Wl,--no-export-dynamic -fvisibility=hidden -Wl,-eflipper_app_app /Users/fb/.ufbt/build/flipper_app/flipper_app_icons.o /Users/fb/.ufbt/build/flipper_app/flipper_app.o /Users/fb/Documents/Projekte/flipper_app/flipper_app.code-workspace -L/Users/fb/.ufbt/current/lib -lm -lgcc -lstdc++ -lsupc++
arm-none-eabi-gcc @/var/folders/63/v5g4fwcx5zq349z9jw4sg4n40000gn/T/tmpcn22ppxw.lnk
/Users/fb/.ufbt/toolchain/arm64-darwin/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld:/Users/fb/Documents/Projekte/flipper_app/flipper_app.code-workspace: file format not recognized; treating as linker script
/Users/fb/.ufbt/toolchain/arm64-darwin/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld:/Users/fb/Documents/Projekte/flipper_app/flipper_app.code-workspace:1: syntax error
collect2: error: ld returned 1 exit status
scons: *** [/Users/fb/.ufbt/build/flipper_app_d.elf] Error 1

In the meantime, I found out the reason why it does not work. This error only happens if the project folder contains a .code-workspace file. Maybe this helps in resolving this bug.

hedger commented 7 months ago

Can confirm, the issue comes from default source collection regexp *.c*.

hedger commented 7 months ago

You can also specify sources=["*.c*, "!flipper_app.code-workspace"] in your application.fam, that should work.

luisadrianpuga commented 4 months ago

Try restarting your app from the start using the template command. then do the VSCode step in the usage instructions. Restart VSCode and it should work now.

thegamerx1 commented 1 month ago

I have the same issue but with python activate.csh

/home/darkii/.ufbt/toolchain/x86_64-linux/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld:/data/code/flippy_app/venv/bin/activate.csh: file format not recognized; treating as linker script
/home/darkii/.ufbt/toolchain/x86_64-linux/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld:/data/code/flippy_app/venv/bin/activate.csh:7: syntax error
collect2: error: ld returned 1 exit status
hedger commented 1 month ago

@thegamerx1 please specify sources=["*.c"] in your app's manifest. That will be changed to default in a future version.