cspot
cspot copied to clipboard
Ninja build fails on subcommand + Question about physical buttons
I am currently in the process of upcycling a broken Harman Karman Citation 100 speaker. The mainboard is fried but the speaker and power supply are working. I saw your project and decided to put an ESP32 in it with a DAC and extra amplifier board.
I am stuck building the firmware on my PC. I am running Debian 11, protobuf and grpcio-tools are installed in the .espressif python environment. Retried installing esp-idf from scratch, but that wasn't any help.
My logs show the following:
esptool.py v3.3-dev
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generated /home/nova/Projects/esp/cspot/targets/esp32/build/bootloader/bootloader.bin
[97/97] cd /home/nova/Projects/esp/cspot/targets/esp32/build/bootloader/esp-idf/esptool_py && /home/nova/.espressif/python_env/idf4.4_py3.9_env/bin/python /home/nova/Projects/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/nova/Projects/esp/cspot/targets/esp32/build/bootloader/bootloader.bin
Bootloader binary size 0x69b0 bytes. 0x650 bytes (6%) free.
[963/1445] Generating nanopb/generator/nanopb_generator.py, nanopb/generator/proto/nanopb.proto
FAILED: esp-idf/main/cspot/nanopb/generator/nanopb_generator.py esp-idf/main/cspot/nanopb/generator/proto/nanopb.proto
cd /home/nova/Projects/esp/cspot/targets/esp32/build/esp-idf/main/cspot && /usr/bin/cmake -E copy_directory /usr/bin /home/nova/Projects/esp/cspot/targets/esp32/build/esp-idf/main/cspot/nanopb/generator
Error copying directory from "/usr/bin" to "/home/nova/Projects/esp/cspot/targets/esp32/build/esp-idf/main/cspot/nanopb/generator".
[976/1445] Building C object esp-idf/bt/CMakeFiles/__idf_bt.dir/host/bluedroid/stack/l2cap/l2c_utils.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
I am out of ideas to get this to work, so any help would be greatly appreciated!
Question about physical buttons
I would really like to have the original control buttons of the Citation speaker working with cspot. I took apart the speaker and noticed an UART bus on the control panel, hooked this up to a USB-To-TTL converter, worked on the first try, a serial monitor shows which button is pressed and released.
Would there be a easy way to implement this in CSpot? I already took a look at some source files and my guess would be to modify the Player.h file, but maybe i am overseeing something. I am not a professional programmer, and my C skills aren't noteworthy. I know my way around PHP and Python, with some tinkering I am convinced I will get it to work.
Cheers!
i'll poke around, as i have no clue:
did you reinstall all the dependency, after you reinstalled esp-idf? which version of esp-idf are you using? do you have golang installed?
according to your second question: as it is dependend on the device i would add the button handling in "targets/esp32/main/main.cpp".
Hi, thats a very interesting project, I'd love to help out with getting it running!
Are you using esp-idf 4.4? you could probably take a look at how github actions builds it.
you can control cspot by using the spirccontroller and code the buttons in main.cpp file. However, for your project you might want to checkout feelfreelinux/euphonium, which is a audio platform that already includes cspot inside :)
Good evening!
After reinstalling esp-idf I also reinstalled the dependencies. I tried both ESP-IDF 4.4 and 4.4.1
Thank you @feelfreelinux ! I will take a look at github actions and definitely check out euphonium. I hope to get this running very soon so I can focus on the buttons.
Edit Euphonium looks very promising so I am going to give that a try. Now I tried to build the CLI version of CSpot for development purposes, also throws an error.
Can someone explain me why cmake would copy files from my /usr/bin directory or is this normal behaviour?
[ 67%] Linking CXX static library libbell.a
[ 67%] Built target bell
[ 67%] Generating nanopb/generator/nanopb_generator.py, nanopb/generator/proto/nanopb.proto
Error copying directory from "/usr/bin" to "/home/nova/esp/cspot/targets/cli/build/cspot/nanopb/generator".
make[2]: *** [cspot/CMakeFiles/cspot.dir/build.make:130: cspot/nanopb/generator/nanopb_generator.py] Error 1
make[1]: *** [CMakeFiles/Makefile2:163: cspot/CMakeFiles/cspot.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
Edit 2
Forked the repo and tried compiling using GitHub Actions, also throws an error around the same percentage
[ 67%] Generating nanopb/generator/nanopb_generator.py, nanopb/generator/proto/nanopb.proto
[ 68%] Generating nanopb/generator/proto/nanopb_pb2.py
[ 69%] Running C++ protocol buffer compiler using nanopb plugin on /home/runner/work/cspot/cspot/cspot/protobuf/authentication.proto
[libprotobuf WARNING ../../../../../src/google/protobuf/compiler/parser.cc:645] No syntax specified for the proto file: protobuf/authentication.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
Traceback (most recent call last):
File "/home/runner/work/cspot/cspot/targets/cli/build/cspot/nanopb/generator/nanopb_generator.py", line 51, in <module>
from .proto import nanopb_pb2
ImportError: attempted relative import with no known parent package
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/work/cspot/cspot/targets/cli/build/cspot/nanopb/generator/nanopb_generator.py", line 72, in <module>
import proto.nanopb_pb2 as nanopb_pb2
File "/home/runner/work/cspot/cspot/targets/cli/build/cspot/nanopb/generator/proto/nanopb_pb2.py", line 5, in <module>
from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/usr/lib/python3/dist-packages/google/protobuf/internal/__init__.py)
--nanopb_out: protoc-gen-nanopb: Plugin failed with status code 1.
make[2]: *** [cspot/CMakeFiles/cspot.dir/build.make:83: cspot/protobuf/authentication.pb.c] Error 1
make[1]: *** [CMakeFiles/Makefile2:163: cspot/CMakeFiles/cspot.dir/all] Error 2
make: *** [Makefile:[103](https://github.com/nvschilleman/cspot/runs/6184215333?check_suite_focus=true#step:11:103): all] Error 2
Error: Process completed with exit code 2.
I guess Cmake just hates me or something
ESP-IDF compiling via GitHub actions did work. Not completely sure about how to configure the ESP since menuconfig won't work this way (I think)
My guess would be write a custom workflow that pulls a sdkconfig file prior to compiling.
Flashed the binary to a ESP32 I had laying around but that ESP32 does not meet CSpots requirements. Ordered an Audio kit yesterday so I guess I have to be patient.
just an educated guess: your cmake version doesn't fit. can you upgrade/downgrade your cmake version to 3.23.0 (like github action)
why i think it's cmake: in euphonium i tried to eliminate build errors and updated "cmake_minimum_required(VERSION 2.8.9)" to "2.8.12" in euphonium/CMakeLists.txt yesterday and got the same errors.
so i think cmake kicked some old policies...
as an answer to your question: i think nanopb is genereating some headers on the fly, so it needs to copy them to the project. but i don't know exactly.
accidently i stumbled upon the Dockerfile. There is a fix(?) in line 21:
RUN sed -i 's/VERSION 3.18/VERSION 3.16/' ../CMakeLists.txt
but i don't see where this command would change anything...
I am running cmake 3.18.4, but according to APT that is the latest version. I'll look into it, thank you!
@feelfreelinux Another question regarding to the physical buttons. I am planning to run Euphonium on my speaker, does Euphonium has a universal button control class for Bluetooth and Spotify, or do I need to modify all plugins to work with the buttons of my Citation speaker?
i can see clearer now: the github action uses cmake from within the container espressif/idf:release-v4.4. it uses cmake in version 3.20.3
But i now have tested a new way to compile cspot in a safe manner using docker:
- install docker
- clone cspot in folder $HOME/cspot
- run
docker run --privileged --name cspot -v ~/cspot:/project --env IDF_CCACHE_ENABLE=0 -w /project -it espressif/idf:release-v4.4. this command opens the container in interactive mode. you can exit withexitand restart the container withdocker start -ai cspotat anytime.
the following commands have to run inside the container / interactive shell
- run
python3 -m pip install --upgrade pip setuptools wheel && pip3 install grpcio-tools - change the directory
cd targets/esp32 - run
idf.py menuconfigand make adjustments - run
idf.py buildto compile the project - make sure to attach the esp32 before run (init) / start (rerun) if you want to flash.
- flash with
idf.py -p /dev/ttyUSB0 flash(in targets/esp32 directory)
@nvschilleman did you manage to compile cspot?
Sorry for the late response, but no. Swapped to Euphonium but I dont manage to get sound out of my Audio Kit board