Closed P4uLT closed 2 years ago
Are you you sure that you used the latest version of the library? The global variables have been changed to be inline, so you should not get these linker errors
I'm using this tag : https://github.com/pschatzmann/arduino-audio-tools/releases/tag/v0.9.2 What is strange to me is why I can use it directly into .cpp file and not into a .h one ( maybe my question is a dumb one :D )
On Top of that I saw this but I didnt use any build_flags
I suggest that you use the latest main branch. I have not released this change yet...
The main branch + -DINGNORE_INLINE_VARS
as build_flags
:
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o: In function `audio_tools::sine(float)':
/workspaces/esphome-rhasspy/.build/esp32-i2s-audio-nodemcu/.piolibdeps/esp32-i2s-audio-nodemcu/audio-tools/src/AudioEffects/SoundGenerator.h:265: multiple definition of `audio_tools::sine(float)'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:/workspaces/esphome-rhasspy/.build/esp32-i2s-audio-nodemcu/.piolibdeps/esp32-i2s-audio-nodemcu/audio-tools/src/AudioEffects/SoundGenerator.h:265: first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools15MetaDataTypeStrE+0x0): multiple definition of `audio_tools::MetaDataTypeStr'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools15MetaDataTypeStrE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o: In function `audio_tools::toStr(audio_tools::MetaDataType)':
main.cpp:(.text._ZN11audio_tools5toStrENS_12MetaDataTypeE+0x0): multiple definition of `audio_tools::toStr(audio_tools::MetaDataType)'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:rhasspy_satellite.cpp:(.text._ZN11audio_tools5toStrENS_12MetaDataTypeE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.bss._ZN11audio_tools14default_configE+0x0): multiple definition of `audio_tools::default_config'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.bss._ZN11audio_tools14default_configE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools8wav_mimeE+0x0): multiple definition of `audio_tools::wav_mime'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools8wav_mimeE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools11id3_v2_tagsE+0x0): multiple definition of `audio_tools::id3_v2_tags'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools11id3_v2_tagsE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools6genresE+0x0): multiple definition of `audio_tools::genres'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools6genresE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools7methodsE+0x0): multiple definition of `audio_tools::methods'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools7methodsE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools8LOCATIONE+0x0): multiple definition of `audio_tools::LOCATION'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools8LOCATIONE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools8IDENTITYE+0x0): multiple definition of `audio_tools::IDENTITY'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools8IDENTITYE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools15ACCEPT_ENCODINGE+0x0): multiple definition of `audio_tools::ACCEPT_ENCODING'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools15ACCEPT_ENCODINGE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools6HOST_CE+0x0): multiple definition of `audio_tools::HOST_C'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools6HOST_CE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools13DEFAULT_AGENTE+0x0): multiple definition of `audio_tools::DEFAULT_AGENT'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools13DEFAULT_AGENTE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools10USER_AGENTE+0x0): multiple definition of `audio_tools::USER_AGENT'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools10USER_AGENTE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools7SUCCESSE+0x0): multiple definition of `audio_tools::SUCCESS'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools7SUCCESSE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools10ACCEPT_ALLE+0x0): multiple definition of `audio_tools::ACCEPT_ALL'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools10ACCEPT_ALLE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools6ACCEPTE+0x0): multiple definition of `audio_tools::ACCEPT'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools6ACCEPTE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools7CHUNKEDE+0x0): multiple definition of `audio_tools::CHUNKED'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools7CHUNKEDE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools17TRANSFER_ENCODINGE+0x0): multiple definition of `audio_tools::TRANSFER_ENCODING'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools17TRANSFER_ENCODINGE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools14CON_KEEP_ALIVEE+0x0): multiple definition of `audio_tools::CON_KEEP_ALIVE'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools14CON_KEEP_ALIVEE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools9CON_CLOSEE+0x0): multiple definition of `audio_tools::CON_CLOSE'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools9CON_CLOSEE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools10CONNECTIONE+0x0): multiple definition of `audio_tools::CONNECTION'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools10CONNECTIONE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools14CONTENT_LENGTHE+0x0): multiple definition of `audio_tools::CONTENT_LENGTH'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools14CONTENT_LENGTHE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools12CONTENT_TYPEE+0x0): multiple definition of `audio_tools::CONTENT_TYPE'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools12CONTENT_TYPEE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools11i2s_formatsE+0x0): multiple definition of `audio_tools::i2s_formats'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools11i2s_formatsE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.bss._ZN11audio_tools18timerCallbackArrayE+0x0): multiple definition of `audio_tools::timerCallbackArray'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.bss._ZN11audio_tools18timerCallbackArrayE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.bss._ZN11audio_tools18simpleUserCallbackE+0x0): multiple definition of `audio_tools::simpleUserCallback'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.bss._ZN11audio_tools18simpleUserCallbackE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools8mime_pcmE+0x0): multiple definition of `audio_tools::mime_pcm'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools8mime_pcmE+0x0): first defined here
.pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o:(.data._ZN11audio_tools13RxTxModeNamesE+0x0): multiple definition of `audio_tools::RxTxModeNames'
.pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:(.data._ZN11audio_tools13RxTxModeNamesE+0x0): first defined here
collect2: error: ld returned 1 exit status
*** [.pioenvs/esp32-i2s-audio-nodemcu/firmware.elf] Error 1
Seems quite the same.
They need to be inline: So your flag does not make any sense! Otherwise all needs to be in one compilation unit...
When removing the flag I have all previous variables in error like this one :
In file included from .piolibdeps/esp32-i2s-audio-nodemcu/audio-tools/src/AudioCodecs/AudioCodecs.h:3:0,
from .piolibdeps/esp32-i2s-audio-nodemcu/audio-tools/src/AudioTools.h:29,
from src/esphome/components/rhasspy_satellite/rhasspy_satellite.h:5,
from src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp:2:
.piolibdeps/esp32-i2s-audio-nodemcu/audio-tools/src/AudioCodecs/CodecWAV.h:34:24: error: 'audio_tools::wav_mime' declared as an 'inline' variable
Did you use platform = https://github.com/platformio/platform-espressif32.git You need to have at least C++17
In the latest version of esphome, the framework set it to https://github.com/platformio/platform-espressif32/tree/v3.5.0 automatically.
I will check if Its possible to upgrade it safely.
Maybe you can also force C++17 with a compiler flag
A quick update on my side :
I managed to update some versions.
platform: platformio/espressif32 @ 5.2.0
platform_packages:
- "platformio/framework-arduinoespressif32 @ 2.0.5"
I have less errors, just one standing :
Linking .pioenvs/esp32-i2s-audio-nodemcu/firmware.elf
/esphome/.temp/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/esp32-i2s-audio-nodemcu/src/main.cpp.o: in function `audio_tools::sine(float)':
/workspaces/esphome-rhasspy/.build/esp32-i2s-audio-nodemcu/.piolibdeps/esp32-i2s-audio-nodemcu/audio-tools/src/AudioEffects/SoundGenerator.h:265: multiple definition of `audio_tools::sine(float)'; .pioenvs/esp32-i2s-audio-nodemcu/src/esphome/components/rhasspy_satellite/rhasspy_satellite.cpp.o:/workspaces/esphome-rhasspy/.build/esp32-i2s-audio-nodemcu/.piolibdeps/esp32-i2s-audio-nodemcu/audio-tools/src/AudioEffects/SoundGenerator.h:265: first defined here
collect2: error: ld returned 1 exit status
I tried -std=c++17
and -std=gnu++17
without success.
One last idea ? :+1:
Can you double check if it helps to define this method as inline ? This got added lately by a pull request...
Congratz !
Linking .pioenvs/esp32-i2s-audio-nodemcu/firmware.elf
RAM: [= ] 14.6% (used 47828 bytes from 327680 bytes)
Flash: [====== ] 60.8% (used 1115465 bytes from 1835008 bytes)
Building .pioenvs/esp32-i2s-audio-nodemcu/firmware.bin
Creating esp32 image...
Successfully created esp32 image.
esp32_create_combined_bin([".pioenvs/esp32-i2s-audio-nodemcu/firmware.bin"], [".pioenvs/esp32-i2s-audio-nodemcu/firmware.elf"])
Flash params set to 0x0020
Wrote 0x121bd0 bytes to file /workspaces/esphome-rhasspy/.build/esp32-i2s-audio-nodemcu/.pioenvs/esp32-i2s-audio-nodemcu/firmware-factory.bin, ready to flash to offset 0x0
===================================================== [SUCCESS] Took 91.51 seconds =====================================================
A big thank you!
I can make a PR if you need.
Cool. I just committed a correction. I didn't like to have sine() as global method anyhow, so I moved it into the FastSineGenerator class
Hello,
First of all I would to thank you for this great project! I'm currently trying to integrate your library into a custom components into Esphome.
I created some empty component and and have some issue compiling / linking it.
To be clear I'm a quite new to C/C++ development so maybe what I try to do is wrong ;)
I'm using the latest tag : v0.9.2
My files are quite simple :
rhasspy_satellite.h
rhasspy_satellite.cpp
When I set the include into the cpp file it's working, I have other samples based on this one working too on an ESP32 with I2S.
When I set it into the .h I got the following error :
Did you already have this kind of issue ?
Thanks for your help!