espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.5k stars 7.39k forks source link

esptool.py in 2.0.0 seems to require macOS 10.15 minimum, fails on 10.13 #5639

Closed obdevel closed 2 years ago

obdevel commented 3 years ago

Hardware:

Board: ESP32 Dev Module Core Installation version: 2.0.0 IDE name: Arduino IDE 1.8.15 Flash Frequency: 40Mhz PSRAM enabled: no Upload Speed: 460800 Computer OS: macOS 10.13.6

esptool.py seems to be built for macOS 10.15 minimum, so it fails on 10.13.x


  Referenced from: /var/folders/03/s3pv8qk91w78m4_st_nbxl5m0000gn/T/_MEIOL3T85/libintl.8.dylib (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libSystem.B.dylib
 in /var/folders/03/s3pv8qk91w78m4_st_nbxl5m0000gn/T/_MEIOL3T85/libintl.8.dylib```
Jason2866 commented 3 years ago

This will probably not solved since github actions runners oldest version which can be used is macos-10.15

techstudio-design commented 2 years ago

Board: ESP32-C3 Dev Module Core Installation version: 2.0.0 IDE name: Arduino IDE 1.8.13 Computer OS: macOS 10.13.6 (macOS High Sierra)

[81708] Error loading Python lib '/var/folders/h3/6wvqkv3x6j37h0nb9hv5wbx80000gp/T/_MEIcVHzRQ/libpython3.8.dylib': dlopen: dlopen(/var/folders/h3/6wvqkv3x6j37h0nb9hv5wbx80000gp/T/_MEIcVHzRQ/libpython3.8.dylib, 10): Symbol not found: ____chkstk_darwin
  Referenced from: /var/folders/h3/6wvqkv3x6j37h0nb9hv5wbx80000gp/T/_MEIcVHzRQ/libintl.8.dylib (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libSystem.B.dylib
 in /var/folders/h3/6wvqkv3x6j37h0nb9hv5wbx80000gp/T/_MEIcVHzRQ/libintl.8.dylib
exit status 255
/Applications/Arduino.app/Contents/Java/arduino-builder returned 255
Error compiling for board ESP32C3 Dev Module.

I just upgraded the Core to 2.0.0, and had the same issue.

The reason that I upgraded from 1.0.6 to 2.0.0 because I had a new C3 board.

However this issue is not only for C3, it basically block all the mac users from using ESP32 boards if the user is having an older mac machines from upgrading to 2.0.0. For other ESP32 boards, I can reverted back to 1.0.6 Core and everything works fine. But for C3, it only supported by Core 2.0.0, and I can't use C3 unless I upgrade to a new mac?

Is there anyway that allows user to recompile the lib or using earlier version of python and macOS?

obdevel commented 2 years ago

My workaround was to create a Linux VM on my Mac (I use VMware Fusion) and use that for ESP32 and ESP8266 compilation and uploading. I can share the source folder between the two environments, so I can code and edit in macOS and just swipe to the VM for compilation and uploading. Not so bad.

The reason I have not upgraded macOS on my system is the amount of free disk space required by the upgrade process. I would have to remove and reinstall all applications, backup and restore all my data, etc. Not worth the hassle or risk ... yet.

esptool has its own repo (https://github.com/espressif/esptool) with instructions for working with the code. Maybe you could raise an issue there ?

I will investigate too and try recompiling for 10.13, when I get some time.

VojtechBartoska commented 2 years ago

This will probably not solved since github actions runners oldest version which can be used is macos-10.15

@Jason2866 is right. Arduino ESP32 used automatically built esptools by Github Actions running on MacOS 10.15.

It means there is not any workaround to support 10.13 version. The fastest solution is to update your OS.

I'm closing the issue, thanks for your contribution!

zfields commented 2 years ago

The fastest solution is to update your OS.

Apple won't let me update my Macbook Pro, because it's too old. I'm stuck at High Sierra. :disappointed:

You may not have meant it this way, but what you said comes off as, "Buy a new machine, or you're too poor to use our hardware."

It would be nice if you could offer any helpful suggestion or workaround, since it is clear you are not intending to fix the issue.

dpharris commented 2 years ago

You could try using vmware or virtualbox to load Linux, and use that, or bootup into a Linux environment.

David

On Thu., Jan. 27, 2022, 19:34 Zachary J. Fields, @.***> wrote:

The fastest solution is to update your OS.

Apple won't let me update my Macbook Pro, because it's too old. I'm stuck at High Sierra. 😞

You may not have meant it this way, but what you said comes off as, "Buy a new machine, or you're too poor to use our hardware."

It would be nice if you could offer any helpful suggestion or workaround, since it is clear you are not intending to fix the issue.

— Reply to this email directly, view it on GitHub https://github.com/espressif/arduino-esp32/issues/5639#issuecomment-1023855135, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEDQST3ZTTIL5JP6FD7M7LUYIFGBANCNFSM5DSQQ2FA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

zfields commented 2 years ago

I figured out my answer...

It turns out, esptool is a stand alone compiled python "script". Fortunately, the repository is open-source so you can clone it, package it yourself and replace the esptool "binary".

Arduino ESP32 used automatically built esptools by Github Actions running on MacOS 10.15.

Here is how they are building it in their CI: https://github.com/espressif/esptool/blob/master/.github/workflows/build_esptool.yml

Here are the steps required to build it on your own machine:

NOTE: If you already have Python3 installed, then skip to step 4

  1. [Re]Install Homebrew*

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  2. [Re]Install Python PIP

    brew reinstall python
  3. Add new Python installation to PATH (update to current version of Python3)

    export PATH="/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin:$PATH"
  4. Install pyinstaller (use version 4.3 to avoid code signing problems)

    pip install -Iv pyinstaller==4.3
  5. Install pyserial for packaging in the esptool "binary"

    pip install pyserial
  6. Clone esptool repository at version 3.1

    git clone https://github.com/espressif/esptool.git -b v3.1
  7. Step into the repository, make a build directory

    cd esptool && mkdir esptool_py && cd esptool_py
  8. Create the replacement esptool "binary"

    pyinstaller --onefile ../esptool.py
  9. Copy aside and replace the broken "binary"

    mv /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool_broken
    cp dist/esptool /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/

* If you are having permissions issues when using brew install I would suggest reinstalling Homebrew over itself if you have High-Sierra; it basically "fixes it". Myself and several others had numerous problems with stale Homebrew installations on High-Sierra.

techstudio-design commented 2 years ago

@zfields Thanks for this solution. It certain better than the suggestion of buy a new Mac (upgrade MacOS) or using a VM.

technoblogy commented 2 years ago

I'm having the same problem, trying to use esp32 2.0.2 on a Mac running High Sierra (10.13.6). I'm reluctant to go through the process of installing Homebrew.

If someone made available a version of esptool compiled under High Sierra, would that solve the problem for users with older Macs?

Jason2866 commented 2 years ago

A different solution would be using Platformio (with VSC). There is no need for a compiled esptool since Platformio uses the python version.

zfields commented 2 years ago

FWIW, you should not trust me, or anyone else who provides you a binary from the internet, but here you go: https://www.dropbox.com/s/y09fcrt27sjzub8/esptool?dl=0

I created/compiled this using Python 3.9 on High-Sierra (10.13), so you will likely need to satisfy both of those requirements in order for this to work. If it doesn't work, then just follow the steps above. They are relatively painless and guarantee that you will create a binary compatible with your system.

Jason2866 commented 2 years ago

It is a good idea to use esptool.py v3.2 with Arduino core 2.0.2 and pyserial has to be >=v3.5

technoblogy commented 2 years ago

@zfields Thank you so much - it works, and you saved me a lot of hassle. Suggestion: perhaps Espressif could provide an official version as a service to users who don't have the latest Macs.

Note for anyone else doing this: I got "permission denied" and had to do sudo chmod 777 esptool

obdevel commented 2 years ago

Thanks from me (the OP) too. Saves having to spin up a Linux VM. Works just fine on macOS 10.13.6 with core v 2.0.0, with the chmod +x fix.

marchingband commented 2 years ago

@zfields you are my hero <3

technoblogy commented 2 years ago

I managed to get this working with 2.0.0 on my High Sierra Mac by replacing esptool 3.1.0 with one kindly provided by @zfields, but after upgrading to 2.0.3-RC1 it seems to have stopped working again. I get:

exec: "python3": executable file not found in $PATH
zfields commented 2 years ago

When you upgrade it replaces the contents of the directory. Have you tried replacing esptool after upgrading?

technoblogy commented 2 years ago

Thanks for your comment. Yes, I copied across the one you provided. I noticed that the folder name has changed from 3.1.0 to 3.3.0.

zfields commented 2 years ago

Ughhh... I know a recompile following the steps above would work, but I'm not sure it's necessary. Unfortunately, I don't have time to look at it at the moment.

technoblogy commented 2 years ago

No problem; I'm grateful for the response anyway.

It's a pity that espressif can't do it, to help people like me who don't have the latest hardware.

marchingband commented 2 years ago

I am willing to worship the person who repeats this process for us poor souls wanting to use 2.0.3+ on our old macbooks. I have an esp32s3 right here and can't believe this is happening :'-( @zfields do you want to be my hero again?

marchingband commented 2 years ago

Ok I made my own, which works with macos 10.13, this is esptool version 3.3.2 I moved it into the 3.3.0 folder as per the instructions above. I got a python version error, but found that launching Arduino from the command line fixes that, and I can now compile for S3. As stated above, don't trust random files online but if you're crazy like me meh why not. Hope this helps someone! https://github.com/marchingband/util/blob/main/esptool

technoblogy commented 2 years ago

@marchingband thank you for helping us MacOS 10.13 users!

I got a python version error

I assume you mean that when using the Arduino IDE you get:

exec: "python3": executable file not found in $PATH

Here's my solution to that.

I confirmed that python3 is actually installed on my Mac by typing this in the Terminal, which gives the full path to it:

david$ which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3

Edit the platform.txt file in: /Users/david/Library/Arduino15/packages/esp32/hardware/esp32/2.0.5

Find the line:

tools.gen_esp32part.cmd=python3 "{runtime.platform.path}/tools/gen_esp32part.py"

Change python3 to the full path given in the "which python3" command earlier. In my case it becomes:

tools.gen_esp32part.cmd=/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 "{runtime.platform.path}/tools/gen_esp32part.py"

Then everything worked fine!

marchingband commented 2 years ago

That's amazing 😀 thank you for reporting back 🤍 us vintage Mac users gotta stick together!

marchingband commented 2 years ago

I can confirm that (with the updated link above) this esptool works for Arduino-esp32 versions 2.3 to 2.5, and using @technoblogy 's patch to platform.txt, works as it should from the IDE.

ROCKLOTUS commented 1 year ago

I figured out my answer...

It turns out, esptool is a stand alone compiled python "script". Fortunately, the repository is open-source so you can clone it, package it yourself and replace the esptool "binary".

Arduino ESP32 used automatically built esptools by Github Actions running on MacOS 10.15.

Here is how they are building it in their CI: https://github.com/espressif/esptool/blob/master/.github/workflows/build_esptool.yml

Here are the steps required to build it on your own machine:

NOTE: If you already have Python3 installed, then skip to step 4

  1. [Re]Install Homebrew*
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  2. [Re]Install Python PIP
    brew reinstall python
  3. Add new Python installation to PATH (update to current version of Python3)
    export PATH="/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin:$PATH"
  4. Install pyinstaller (use version 4.3 to avoid code signing problems)
    pip install -Iv pyinstaller==4.3
  5. Install pyserial for packaging in the esptool "binary"
    pip install pyserial
  6. Clone esptool repository at version 3.1
    git clone https://github.com/espressif/esptool.git -b v3.1
  7. Step into the repository, make a build directory
    cd esptool && mkdir esptool_py && cd esptool_py
  8. Create the replacement esptool "binary"
    pyinstaller --onefile ../esptool.py
  9. Copy aside and replace the broken "binary"
    mv /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/esptool_broken
    cp dist/esptool /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/

* If you are having permissions issues when using brew install I would suggest reinstalling Homebrew over itself if you have High-Sierra; it basically "fixes it". Myself and several others had numerous problems with stale Homebrew installations on High-Sierra.

Thanks for your answer, but I fail for follow error message: Pyserial is not installed for /Users/rock/Documents/Code/ESP32/esptool-master/esptool_py/dist/esptool/./esptool. Check the README for installation instructions. Traceback (most recent call last):

Then I try another method, I found esptool.py work well, so I make a soft link to this file and copy to the destination folder, it works ln -s esptool.py esptool cp esptool /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/3.1.0/

Then back to the Arduino software and setting Upload Speed:"115200" JTAG Adapter:"ESP USB Bridge" Flash Mode:"DIO"

finally, Arduino IDE 2.1.0 works well.

mgesteiro commented 1 year ago

I've updated the procedure to reflect last changes from the ESP32 framework (v2.0.9) which includes esptool v4.5.1. These commands should be executed from within a terminal:

  1. Create a working directory and move inside: mkdir esptoolupdate cd esptoolupdate
  2. Download and uncompress the corresponding package (into the previous folder): wget https://github.com/espressif/esptool/archive/refs/tags/v4.5.1.tar.gz tar xvf v4.5.1.tar.gz
  3. You should already have python3 available in your computer (if not, install it using macports, brew or your preferred method). Now we create a virtual environment with just the necessary requirements just for this task: python3 -m venv ve source ve/bin/activate pip install -U pip pyserial pyinstaller
  4. Time to create the new program/binary: cd esptool-4.5.1 pyinstaller --distpath ./esptool-macos -F --icon=ci/espressif.ico --add-data="./esptool/targets/stub_flasher/*.json:/esptool/targets/stub_flasher/" esptool.py
  5. Check that everything worked: deactivate ./esptool-macos/esptool
  6. Replace the bad one with the newly created: cp esptool-macos/esptool ~/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/
  7. You can close the terminal now, remove the working folder, restart your Arduino IDE and ENJOY 😊

NOTE: this procedure has been tested in a real computer with MacOS Mojave (v10.14.6) and Python 3.11 installed via Macports (in my experience, brew is a pita with our older systems and macports provided a better general behaviour).

ziggy90127 commented 1 year ago

For Mojave 10.14.6, I made some alterations for my situation (you might have to change "4.5.1" to whatever version you have)(I installed python3.11 and pip-3.11 with macports):

pip-3.11 install pyinstaller pip-3.11 install pyserial git clone https://github.com/espressif/esptool.git cd esptool && mkdir esptool_py && cd esptool_py python3.11 -m PyInstaller --onefile ../esptool.py mv /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool_broken cp dist/esptool /Users/${USER}/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/

I didn't seem to have a code signing issue mentioned above.

jorgechamorro commented 4 months ago

3. pyinstaller --distpath ./esptool-macos -F --icon=ci/espressif.ico --add-data="./esptool/targets/stub_flasher/*.json:/esptool/targets/stub_flasher/" esptool.py

There's a typo, /esptool/targets/stub_flasher should have had a dot . before: ./esptool/targets/stub_flasher , other than that it werks.

I've done this in my mac running osx 10.13.6, and worked fine (the file that ends into /esptool-macos works) despite it throwing some errors about code signing.

(Python3 installed with Macports)

To install esptool 4.7.0 add intelhex to the line pip install ...

ginjo commented 2 months ago

For Mojave 10.14.6

For others who land here looking to get esp32 running in Arduino IDE on Mojave, here's what worked for me to overcome the sketch compilation failures. Note that I did not try any of the solutions mentioned earlier in this thread.

Environment

nikbry commented 1 month ago

For Mojave 10.14.6

For others who land here looking to get esp32 running in Arduino IDE on Mojave, here's what worked for me to overcome the sketch compilation failures. Note that I did not try any of the solutions mentioned earlier in this thread.

* Downgraded esp32 in Boards Manager to v1.0.6.

* Previously installed esptool manually via `pip3 install esptool`, but I don't know if that has anything to do with my success.

* Previously re-linked `/usr/local/bin/python` to wherever my python3 is installed, but again, no idea if this contributed to my success.

Environment

* OSX 10.14.6

* MacBook Pro (Retina, 13-inch, Early 2015)

* Arduino IDE 1.8.19

* DOIT esp32 devkit v1 with CP2101 chip

* Silab CP2101 serial driver for Mac

* Python 3.9.12

* Esptool 4.7.0

Thanks so much it worked for me on OSX 10.14.6, just by downgrading the board library to 1.0.6 nothing else needed. Beware that v 1.0.6 may not support some of the newer ESP32 boards.