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

error: conflicting types for 'random' #3201

Closed
pvint opened this issue Sep 12, 2019 · 3 comments
Closed

error: conflicting types for 'random' #3201

pvint opened this issue Sep 12, 2019 · 3 comments

Comments

@pvint
Copy link
Contributor

pvint commented Sep 12, 2019

When compiling as an ESP-IDF component I get the following error:

/usr/local/src/blink/components/arduino/cores/esp32/Arduino.h:121:6: error: conflicting types for 'random'
 long random(long, long);
      ^~~~~~
In file included from /usr/local/src/blink/components/arduino/cores/esp32/esp32-hal.h:30,
                 from /usr/local/src/blink/components/arduino/cores/esp32/wiring_shift.c:20:
/usr/local/src/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/sys-include/stdlib.h:267:6: note: previous declaration of 'random' was here
 long random (void);
      ^~~~~~

Hardware:

Board: VintLabs PWM Devkit
Core Installation version: 1.0.3 (master, commit bab3a70)
IDE name: IDF component
Flash Frequency: ?40Mhz?
PSRAM enabled: ?no? ?yes?
Upload Speed: ?115200?
Computer OS: Gentoo Linux

Description:

I had this problem occur on my primary development PC recently (it had worked in the past before updates). Today I did a fresh install of esp-idf (master branch, commit a7e8d87d3e5ccc9e5ffcd701a1bac587ba4f43ea) and the toolchain, then copied examples/blink and installed arduino-esp32 as a component in components/arduino.
Without even adding #include "Arduino.h" to the code, make menuconfig && make results in this error.

I suspect the issue is actually related to using compiler version 8.2.0 , and I will look into how to change to a previous version to test.

Regards
Paul

@lbernstone
Copy link
Contributor

lbernstone commented Sep 12, 2019

arduino-esp32 is currently built against esp-idf 3.2 (and toolchain 5.2.0). Any newer version will give you errors in the compile.

@pvint
Copy link
Contributor Author

pvint commented Sep 12, 2019

Thanks - I suspected it was something just that simple. I have tested with idf 3.2, however I haven't yet figured out how to install a specific version of the toolchain. I'm sure it's right there in the docs but I have overlooked it.

Thanks again.
Paul

@pvint pvint closed this as completed Sep 12, 2019
@pvint
Copy link
Contributor Author

pvint commented Sep 12, 2019

Resolved by getting correct version of toolchain using git checkout esp32-2019r1_ctng-1.23.x and using v3.2.2 of esp-idf:

git checkout release/v3.2
git submodule update --init --recursive

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