Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menuconfig Access violation with Python 3.12 (IDFGH-12177) #13232

Closed
3 tasks done
Addenri opened this issue Feb 22, 2024 · 10 comments
Closed
3 tasks done

menuconfig Access violation with Python 3.12 (IDFGH-12177) #13232

Addenri opened this issue Feb 22, 2024 · 10 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@Addenri
Copy link

Addenri commented Feb 22, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.2

Operating System used.

Windows

How did you build your project?

CLion IDE

If you are using Windows, please specify command line type.

PowerShell

What is the expected behavior?

run menuconfig and setup project

What is the actual behavior?

get "Access violation" error while trying build "menuconfig"

Steps to reproduce.

  1. install git, Python 3.12
  2. clone git repo ESP-IDF (branch master or v5.2)
  3. run install script (install.ps1)
  4. export environment variables (export.ps1)
  5. copy example project
  6. run "idf.py menuconfig" in project's directory

Build or installation Logs.

Executing action: menuconfig
Running ninja in directory C:\Users\Andrii\esp\hello_world\build
Executing "ninja menuconfig"...
[0/1] Re-running CMake...-- ccache will be used for faster recompilation
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file C:/Users/Andrii/esp/hello_world/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
-- App "hello_world" version: 1
-- Adding linker script C:/Users/Andrii/esp/hello_world/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script C:/Users/Andrii/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_bootloader_format esp_coex esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_h
ttp_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs f
reertos hal heap http_parser idf_test ieee802154 json log lwip main mbedtls mqtt newlib nvs_flash nvs_sec_provider openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: C:/Users/Andrii/esp/esp-idf/components/app_trace C:/Users/Andrii/esp/esp-idf/components/app_update C:/Users/Andrii/esp/esp-idf/components/bootloader C:/Users/Andrii/esp/esp-idf/components/bootloader_support C:/Users/Andrii/esp/esp-idf/components/bt C:/Users/Andrii/esp/esp-idf/components/cmock C:/Users/Andrii/esp/esp-idf/components/console C:/Users/Andrii/esp/esp-idf/components/cxx C:/Users/Andrii/esp/esp-idf/components/driver C:/Users/Andri
i/esp/esp-idf/components/efuse C:/Users/Andrii/esp/esp-idf/components/esp-tls C:/Users/Andrii/esp/esp-idf/components/esp_adc C:/Users/Andrii/esp/esp-idf/components/esp_app_format C:/Users/Andrii/esp/esp-idf/components/esp_bootloader
_format C:/Users/Andrii/esp/esp-idf/components/esp_coex C:/Users/Andrii/esp/esp-idf/components/esp_common C:/Users/Andrii/esp/esp-idf/components/esp_eth C:/Users/Andrii/esp/esp-idf/components/esp_event C:/Users/Andrii/esp/esp-idf/co
mponents/esp_gdbstub C:/Users/Andrii/esp/esp-idf/components/esp_hid C:/Users/Andrii/esp/esp-idf/components/esp_http_client C:/Users/Andrii/esp/esp-idf/components/esp_http_server C:/Users/Andrii/esp/esp-idf/components/esp_https_ota C
:/Users/Andrii/esp/esp-idf/components/esp_https_server C:/Users/Andrii/esp/esp-idf/components/esp_hw_support C:/Users/Andrii/esp/esp-idf/components/esp_lcd C:/Users/Andrii/esp/esp-idf/components/esp_local_ctrl C:/Users/Andrii/esp/es
p-idf/components/esp_mm C:/Users/Andrii/esp/esp-idf/components/esp_netif C:/Users/Andrii/esp/esp-idf/components/esp_netif_stack C:/Users/Andrii/esp/esp-idf/components/esp_partition C:/Users/Andrii/esp/esp-idf/components/esp_phy C:/U
sers/Andrii/esp/esp-idf/components/esp_pm C:/Users/Andrii/esp/esp-idf/components/esp_psram C:/Users/Andrii/esp/esp-idf/components/esp_ringbuf C:/Users/Andrii/esp/esp-idf/components/esp_rom C:/Users/Andrii/esp/esp-idf/components/esp_
system C:/Users/Andrii/esp/esp-idf/components/esp_timer C:/Users/Andrii/esp/esp-idf/components/esp_wifi C:/Users/Andrii/esp/esp-idf/components/espcoredump C:/Users/Andrii/esp/esp-idf/components/esptool_py C:/Users/Andrii/esp/esp-idf
/components/fatfs C:/Users/Andrii/esp/esp-idf/components/freertos C:/Users/Andrii/esp/esp-idf/components/hal C:/Users/Andrii/esp/esp-idf/components/heap C:/Users/Andrii/esp/esp-idf/components/http_parser C:/Users/Andrii/esp/esp-idf/
components/idf_test C:/Users/Andrii/esp/esp-idf/components/ieee802154 C:/Users/Andrii/esp/esp-idf/components/json C:/Users/Andrii/esp/esp-idf/components/log C:/Users/Andrii/esp/esp-idf/components/lwip C:/Users/Andrii/esp/hello_world
/main C:/Users/Andrii/esp/esp-idf/components/mbedtls C:/Users/Andrii/esp/esp-idf/components/mqtt C:/Users/Andrii/esp/esp-idf/components/newlib C:/Users/Andrii/esp/esp-idf/components/nvs_flash C:/Users/Andrii/esp/esp-idf/components/n
vs_sec_provider C:/Users/Andrii/esp/esp-idf/components/openthread C:/Users/Andrii/esp/esp-idf/components/partition_table C:/Users/Andrii/esp/esp-idf/components/perfmon C:/Users/Andrii/esp/esp-idf/components/protobuf-c C:/Users/Andri
i/esp/esp-idf/components/protocomm C:/Users/Andrii/esp/esp-idf/components/pthread C:/Users/Andrii/esp/esp-idf/components/sdmmc C:/Users/Andrii/esp/esp-idf/components/soc C:/Users/Andrii/esp/esp-idf/components/spi_flash C:/Users/Andr
ii/esp/esp-idf/components/spiffs C:/Users/Andrii/esp/esp-idf/components/tcp_transport C:/Users/Andrii/esp/esp-idf/components/ulp C:/Users/Andrii/esp/esp-idf/components/unity C:/Users/Andrii/esp/esp-idf/components/usb C:/Users/Andrii
/esp/esp-idf/components/vfs C:/Users/Andrii/esp/esp-idf/components/wear_levelling C:/Users/Andrii/esp/esp-idf/components/wifi_provisioning C:/Users/Andrii/esp/esp-idf/components/wpa_supplicant C:/Users/Andrii/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Andrii/esp/hello_world/build

[0/1] cmd.exe /C "cd /D C:\Users\Andrii\esp\hello_world\build && C:\Users\Andrii\.espressif\python_env\idf5.2_py3....IN=gcc --env IDF_ENV_FPGA= --env IDF_INIT_VERSION=5.2.0 --output config C:/Users/Andrii/esp/hello_world/sdkconfig"C:/Users/Andrii/esp/esp-idf/Kconfig:15: warning: IDF_ENV_FPGA has 'option env="IDF_ENV_FPGA"', but the environment variable IDF_ENV_FPGA is not set
Loaded configuration 'C:/Users/Andrii/esp/hello_world/sdkconfig'
Access violation

FAILED: CMakeFiles/menuconfig C:/Users/Andrii/esp/hello_world/build/CMakeFiles/menuconfig
cmd.exe /C "cd /D C:\Users\Andrii\esp\hello_world\build && C:\Users\Andrii\.espressif\python_env\idf5.2_py3.12_env\Scripts\python.exe C:/Users/Andrii/esp/esp-idf/tools/kconfig_new/prepare_kconfig_files.py --list-separator=semicolon 
--env-file C:/Users/Andrii/esp/hello_world/build/config.env && C:\Users\Andrii\.espressif\python_env\idf5.2_py3.12_env\Scripts\python.exe -m kconfgen --list-separator=semicolon --kconfig C:/Users/Andrii/esp/esp-idf/Kconfig --sdkconf
ig-rename C:/Users/Andrii/esp/esp-idf/sdkconfig.rename --config C:/Users/Andrii/esp/hello_world/sdkconfig --env-file C:/Users/Andrii/esp/hello_world/build/config.env --env IDF_TARGET=esp32 --env IDF_TOOLCHAIN=gcc --env IDF_ENV_FPGA=
 --env IDF_INIT_VERSION=5.2.0 --dont-write-deprecated --output config C:/Users/Andrii/esp/hello_world/sdkconfig && C:\Users\Andrii\.espressif\python_env\idf5.2_py3.12_env\Scripts\python.exe C:/Users/Andrii/esp/esp-idf/tools/check_te
rm.py && C:\Users\Andrii\.espressif\tools\cmake\3.24.0\bin\cmake.exe -E env COMPONENT_KCONFIGS_SOURCE_FILE=C:/Users/Andrii/esp/hello_world/build/kconfigs.in COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE=C:/Users/Andrii/esp/hello_world/bu
ild/kconfigs_projbuild.in KCONFIG_CONFIG=C:/Users/Andrii/esp/hello_world/sdkconfig IDF_TARGET=esp32 IDF_TOOLCHAIN=gcc IDF_ENV_FPGA= IDF_INIT_VERSION=5.2.0 C:/Users/Andrii/.espressif/python_env/idf5.2_py3.12_env/Scripts/python.exe -m
 menuconfig C:/Users/Andrii/esp/esp-idf/Kconfig && C:\Users\Andrii\.espressif\python_env\idf5.2_py3.12_env\Scripts\python.exe -m kconfgen --list-separator=semicolon --kconfig C:/Users/Andrii/esp/esp-idf/Kconfig --sdkconfig-rename C:
/Users/Andrii/esp/esp-idf/sdkconfig.rename --config C:/Users/Andrii/esp/hello_world/sdkconfig --env-file C:/Users/Andrii/esp/hello_world/build/config.env --env IDF_TARGET=esp32 --env IDF_TOOLCHAIN=gcc --env IDF_ENV_FPGA= --env IDF_INIT_VERSION=5.2.0 --output config C:/Users/Andrii/esp/hello_world/sdkconfig"
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

More Information.

Reproduced on Windows 10 and 11 with Python 3.12.2. Can't reproduce with older Python versions, but need to keep it updated. Can be reproduced not only with "hello_world" example, same as others.

@Addenri Addenri added the Type: Bug bugs in IDF label Feb 22, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 22, 2024
@github-actions github-actions bot changed the title menuconfig Access violation with Python 3.12 menuconfig Access violation with Python 3.12 (IDFGH-12177) Feb 22, 2024
@dobairoland
Copy link
Collaborator

Related: #12519

@Honza0297
Copy link
Collaborator

Hello @Addenri, thank you for the report!
I was able to reproduce your issue with ESP-IDF 5.2 and Python 3.12.2.
Quick workaround is to remove Python 3.12 from PATH and use older version (3.11.7 is working).
I will dig deeper into the problem and come up with better solution next week.

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development Status: In Progress Work is in progress and removed Status: Opened Issue is new Status: Selected for Development Issue is selected for development labels Feb 26, 2024
@Honza0297
Copy link
Collaborator

Honza0297 commented Feb 26, 2024

After a bit of poking things around, I found the culprit, windows curses, used by kconfiglib/menuconfig: zephyrproject-rtos/windows-curses#48
̶U̶n̶f̶o̶r̶t̶u̶n̶a̶t̶e̶l̶y̶,̶ ̶t̶h̶e̶r̶e̶ ̶i̶s̶ ̶n̶o̶t̶h̶i̶n̶g̶ ̶w̶e̶ ̶c̶a̶n̶ ̶d̶o̶ ̶n̶o̶w̶ ̶a̶s̶ ̶n̶e̶i̶t̶h̶e̶r̶ ̶k̶c̶o̶n̶f̶i̶g̶l̶i̶b̶ ̶n̶o̶r̶ ̶w̶i̶n̶d̶o̶w̶s̶-̶c̶u̶r̶s̶e̶s̶ ̶a̶r̶e̶ ̶p̶a̶c̶k̶a̶g̶e̶s̶ ̶m̶a̶i̶n̶t̶a̶i̶n̶e̶d̶ ̶b̶y̶ ̶u̶s̶.̶ I would suggest sticking to older versions of Python (=<3.11) for now. I'll prepare a monkey-patch to make it working with Python 3.12 in the future days.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: In Progress Work is in progress labels Mar 8, 2024
espressif-bot pushed a commit to espressif/esp-idf-kconfig that referenced this issue Mar 12, 2024
@Honza0297
Copy link
Collaborator

Now, it should work in versions 5.2 and below, where the fix is present directly in ESP-IDF.
Master branch needs the latest version of esp-idf-kconfig in order to work properly for now. It can be installed as a local package from the linked git repository.
This issue will be closed shortly.
@Addenri Thanks again for reporting and feel free to reopen if the problem prevails.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Mar 15, 2024
@dobairoland
Copy link
Collaborator

Master branch needs the latest version of esp-idf-kconfig in order to work properly for now. It can be installed as a local package from the linked git repository.

It is enough to re-run the install scripts now and it will install esp-idf-kconfig>=2.2.0 which contains the fix.

@ARNik
Copy link

ARNik commented Mar 22, 2024

Quick workaround is to remove Python 3.12 from PATH and use older version (3.11.7 is working).

Hello!
How can I implement this workaround? Now install scripts (even old versions) use 3.12 Python as default. And menuconfig works in this isolated invironment. It does not depend on python version installed in the system.
Do I need to make changes in install scripts somewere?

There is no reliases that fix this bug ether. I tried v5.2.1 / v5.1.3 / v5.0.6 / v4.4.7. They all have the same behevior.

I belive everybody hwo have old toolchain installation (prior to 3.12 python) have no problems with menuconfig. But people hwo thy to install toolchain now have.

@Honza0297
Copy link
Collaborator

Hello @ARNik !
Have you installed your ESP-IDF via the installer or from github repository?

@ARNik
Copy link

ARNik commented Mar 25, 2024

Hello @ARNik ! Have you installed your ESP-IDF via the installer or from github repository?

I cloned the repo and checked out different versions using "git worktree". Then I tryed install.bat script from different esp-idf versions deleting .espressif folder in between.

@dobairoland
Copy link
Collaborator

You can see the linked fixes were published a week ago so they couldn't make into any of the releases released earlier. You can use the release branches (release/v5.*) until the next release. Or if you insist on using a tagged version then downgrade your system Python to 3.11.

@ARNik
Copy link

ARNik commented Mar 25, 2024

You can use the release branches (release/v5.*) until the next release.

Yes, I can. But I think something is completely wrong that I can't build none of the previous releases.

DarkZeros pushed a commit to DarkZeros/esp-idf that referenced this issue May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

5 participants