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

Unable to build homepoint on MacOS #13

Closed
rhannink opened this issue Jun 13, 2019 · 27 comments
Closed

Unable to build homepoint on MacOS #13

rhannink opened this issue Jun 13, 2019 · 27 comments

Comments

@rhannink
Copy link

rhannink commented Jun 13, 2019

Hallo,

Thanks for your Great work, I want to complice the code for my M5Stack, but I am unable to complice the code. I installeer all the tools according to the manualen, but when I run:

cmake -DM5STACK=ON ../

I het the error:

-bash: cmake: command not found

I checked my installation of the tools and all the paths seems to be ok. The file CMakeLists.txt has something to do with it, but it is not being used it seems.

Also running:

idf.py menuconfig

Gives the error:

'cmake' must be available on the PATH to use idf.py

My ~/.bash_profile looks like:

export PATH=$HOME/esp/xtensa-esp32-elf/bin:$PATH export IDF_PATH=~/esp/esp-idf export PATH="$IDF_PATH/tools:$PATH"

Gr. Remco

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Hey,
looks like you don't have cmake installed.

The easiest way to go about this on MacOS is to install Homebrew and then run brew install cmake.

Let me know if that works for you :)

@rhannink
Copy link
Author

rhannink commented Jun 13, 2019

Thanks for your fast respons, instelling cake did the trick, But now I run into a new compiling error:

-- Compiling for M5Stack CMake Error at main/CMakeLists.txt:118 (spiffs_create_partition_image): Unknown CMake command "spiffs_create_partition_image".

And complice output logfile shows:

`Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /Users/remco/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Build flags:
Id flags:

The output was:
1
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find crt1-sim.o: No such file or directory
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find _vectors.o: No such file or directory
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lsim
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhandlers-sim
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhal
collect2: error: ld returned 1 exit status

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /Users/remco/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
Build flags:
Id flags:

The output was:
1
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find crt1-sim.o: No such file or directory
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find _vectors.o: No such file or directory
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lsim
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhandlers-sim
/Users/remco/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhal
collect2: error: ld returned 1 exit status`

I have cmake version 3.14.5 installed.

Gr. Remco

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. points towards something gone wrong in your PATHs.

Here are mine as a reference (from zsh.rc):

export IDF_PATH="~/Documents/Development/esp-idf"
export PATH=$PATH:~/Documents/Development/xtensa-esp32-elf/bin

I assume you followed the instructions of running

cd build
cmake -DM5STACK=ON ../

?

@rhannink
Copy link
Author

Yep,

My .bash_profile contains:

export PATH=~/esp/xtensa-esp32-elf/bin:$PATH
export IDF_PATH=~/esp/esp-idf
export PATH="$IDF_PATH/tools:$PATH"

And I did

cd ~/home/esp/homepoint/build
cmake -DM5STACK=ON ../

Gr. Remco

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Does this error appear when you run make or cmake ?

If so, can you do rm -rf * in build, do a fresh cmake configuration and paste me the output?

@rhannink
Copy link
Author

It appears when I run cmake.

When I do:

MacbookPro:bin remco$ which ld
I get:

/usr/bin/ld

So there is another build environment. Might that be a Problem?

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Yeah, could be. I'd put the $PATH variable before the IDF Path in your bash.rc, because OSX will use the first ld it can find.

Edit: I'm getting the same output on my machine.

@rhannink
Copy link
Author

Putting $PATh in first makes no different....

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Which ESP-IDF version are you using?

@rhannink
Copy link
Author

3.2

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Ahhh, I see. I just tried that and had the same error as yours.
The issue is that HomePoint relies on CMake which is pretty new with ESP-IDF. I recommend you checkout the master of esp-idf through github and use that.
That definitely works on my end (although they recently introduced a new warning about using an old GCC version). That situation is not ideal, but thanks for pointing it out.

Let me know if that works on your end?

@rhannink
Copy link
Author

rhannink commented Jun 13, 2019

Thanks,

Now its working with the master branch of esp-idd. Only the last step:

make -j 8 flash

Gives a lot of errors, but that is probably because it tries to flash the image to the M5stack ? It is not connected and I havent defined a serial port anywhere. Should I run menuconfig for that?

Gr. Remco

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Try building without flash at the end

@rhannink
Copy link
Author

rhannink commented Jun 13, 2019

Hmm,

Still no sucess,

make -j 8 flash
and
make -j 8

Both give a lot (thousands) of these waring below. And 2 errors:

/Users/remco/esp/esp-idf/components/wpa_supplicant/src/crypto/sha1.c:135:(.text.sha1_prf+0xa): dangerous relocation: call8: call target out of range: strlen
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/crypto/sha1.c:158:(.text.sha1_prf+0x73): dangerous relocation: call8: call target out of range: memcpy
esp-idf/wpa_supplicant/libwpa_supplicant.a(fast_aes-unwrap.c.obj): In function `fast_aes_unwrap':
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-unwrap.c:37:(.text.fast_aes_unwrap+0xa): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-unwrap.c:39:(.text.fast_aes_unwrap+0x16): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-unwrap.c:58:(.text.fast_aes_unwrap+0x61): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-unwrap.c:60:(.text.fast_aes_unwrap+0x76): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-unwrap.c:65:(.text.fast_aes_unwrap+0x93): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-unwrap.c:66:(.text.fast_aes_unwrap+0x9e): dangerous relocation: call8: call target out of range: memcpy
esp-idf/wpa_supplicant/libwpa_supplicant.a(fast_aes-wrap.c.obj): In function `fast_aes_wrap':
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-wrap.c:42:(.text.fast_aes_wrap+0xa): dangerous relocation: call8: call target out of range: memset
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-wrap.c:43:(.text.fast_aes_wrap+0x16): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-wrap.c:62:(.text.fast_aes_wrap+0x42): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-wrap.c:63:(.text.fast_aes_wrap+0x4d): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-wrap.c:68:(.text.fast_aes_wrap+0x65): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_aes-wrap.c:70:(.text.fast_aes_wrap+0x7b): dangerous relocation: call8: call target out of range: memcpy
esp-idf/wpa_supplicant/libwpa_supplicant.a(fast_sha256-internal.c.obj): In function `fast_sha256_vector':
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_sha256-internal.c:36:(.text.fast_sha256_vector+0xd): dangerous relocation: call8: call target out of range: mbedtls_sha256_starts_ret
esp-idf/wpa_supplicant/libwpa_supplicant.a(fast_sha256.c.obj): In function `fast_hmac_sha256_vector':
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_sha256.c:112:(.text.fast_hmac_sha256_vector+0x3a): dangerous relocation: call8: call target out of range: memset
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_sha256.c:112:(.text.fast_hmac_sha256_vector+0x45): dangerous relocation: call8: call target out of range: memcpy
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_sha256.c:112:(.text.fast_hmac_sha256_vector+0xa2): dangerous relocation: call8: call target out of range: memset
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_sha256.c:112:(.text.fast_hmac_sha256_vector+0xad): dangerous relocation: call8: call target out of range: memcpy
esp-idf/wpa_supplicant/libwpa_supplicant.a(fast_sha256.c.obj): In function `fast_sha256_prf':
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_sha256.c:143:(.text.fast_sha256_prf+0x11): dangerous relocation: call8: call target out of range: strlen
/Users/remco/esp/esp-idf/components/wpa_supplicant/src/fast_crypto/fast_sha256.c:160:(.text.fast_sha256_prf+0x85): dangerous relocation: call8: call target out of range: memcpy
esp-idf/mbedtls/mbedtls/library/libmbedtls.a(esp_hardware.c.obj): In function `mbedtls_hardware_poll':
/Users/remco/esp/esp-idf/components/mbedtls/port/esp_hardware.c:21:(.text.mbedtls_hardware_poll+0x7): dangerous relocation: call8: call target out of range: esp_fill_random
collect2: error: ld returned 1 exit status
make[2]: *** [homepoint.elf] Error 1
make[1]: *** [CMakeFiles/homepoint.elf.dir/all] Error 2
make: *** [all] Error 2

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

What toolchain version are you using?

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

1.22.0-80-g6c4433a-5.2.0 is the version on CI and my computers

@rhannink
Copy link
Author

rhannink commented Jun 13, 2019

How can I check?

According to the online Manual I downloaded:

https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-macos.tar.gz

edit:

I Think I found it:

xtensa-esp32-elf-cc (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 5.2.0

So thats the Same as you use.

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Correct, the 8.2.0 is still in the unstable manual and did not work last time I checked, the correct one is specified here:
https://docs.espressif.com/projects/esp-idf/en/stable/get-started/macos-setup.html

@rhannink
Copy link
Author

Did a new Install of the toolchain version 5.2.0 but Problem remains.....

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

I still believe there is something off in the toolchain, cause none of the errors mentions Homepoint specifically, but they appear while compiling the ESP-IDF SDK.

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Running xtensa-esp32-elf-gcc -v on command line will tell you which version is in use

@rhannink
Copy link
Author

gcc version 5.2.0 (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a)

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

I assume you deleted the build directory and reconfigured?

@rhannink
Copy link
Author

What do you mean by reconfigured?

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Running cmake again

@rhannink
Copy link
Author

rhannink commented Jun 13, 2019

Yeah,
After cleaning and rebuilding it works:

[100%] Built target __idf_build_target
[100%] Built target homepoint.elf
[100%] Built target gen_project_binary
[100%] Built target app
Scanning dependencies of target flash
Note: esptool.py will search for a serial port. To specify a port, set the ESPPORT environment variable.
Note: Using default baud rate 460800. To modify, set ESPBAUD environment variable.
esptool.py --chip esp32 -b 460800 write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x8000 partition_table/partition-table.bin 0x10000 homepoint.bin 0x1000 bootloader/bootloader.bin 0x310000 spiffs.bin
esptool.py v2.7-dev
Found 3 serial ports
Serial port /dev/cu.SOC

Sorry for all your effort, my mistake, I lack Some real software engineering skills ;-)

Maybe you can add the part of the masterbranch of esp-idf and the correct version off the toolchain to your README.md

@sieren
Copy link
Owner

sieren commented Jun 13, 2019

Awesome! Glad you got it working 👏

And yeah, I already had that in mind while we were discussing this :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants