Hi folks,
I would like to install "tesla-control", a command provided by car manufacturer Tesla to control car features over BLE (bluetooth low energy), on the wireless access point installed in my garage. Of course I have a matching USB BLE adapter which is recognized by OpenWrt.
I have managed to compile tesla-control on the device itself by adding an USB stick and configuring extroot (and swap), but to be honest, it took ages to compile. Since I'm often compiling customized OpenWrt images for my devices, I thought it would be a good idea to add a Makefile for it so that I can crosscompile it every time I compile a customized image for that device.
I'm far away from being a developer, so I took a Makefile from another program which is also written in Go and adapted it. As you can imagine, it ran into an error which I'm unable to resolve. So I'm kindly asking for help: Does anybody know why the build process terminates? What's wrong or missing in my Makefile?
The tarball from github named "vehicle-command" produces several binaries, I'm only interested in "tesla-control".
Here is the Makefile I saved in openwrt/feeds/packages/net/tesla-control/Makefile
:
include $(TOPDIR)/rules.mk
PKG_NAME:=tesla-control
PKG_VERSION:=0.3.3
PKG_RELEASE:=1
PKG_SOURCE:=-$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/teslamotors/vehicle-command/tar.gz/refs/tags/v$(PKG_VERSION)?
PKG_HASH:=a581fc5283b67ec5d92eeb64fcc0e0f166ac124e4caff739cb5a07b99cf3a91c
PKG_BUILD_DIR:=$(BUILD_DIR)/vehicle-command-$(PKG_VERSION)
PKG_MAINTAINER:=Sven <sven@REDACTED>
PKG_LICENSE:=MIT
PKG_BUILD_DEPENDS:=golang/host
include $(INCLUDE_DIR)/package.mk
include ../../lang/golang/golang-package.mk
define Package/tesla-control
SECTION:=net
CATEGORY:=Network
TITLE:=Tesla Control
URL:=https://github.com/teslamotors/vehicle-command
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/tesla-control/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tesla-control $(1)/usr/bin
endef
define Package/tesla-control/description
tesla-control
endef
$(eval $(call GoBinPackage,tesla-control))
$(eval $(call BuildPackage,tesla-control))
When trying to compile, I get:
CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -msoft-float -fmacro-prefix-map=/home/build
d/openwrt/build_dir/target-mips_24kc_musl/vehicle-command-0.3.3=vehicle-command-0.3.3 -mips16 -minterlink-mips16 -Wformat -Werror=format-securit
y -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/buildd/openwrt/staging_dir/toolchain-mips_24kc_gcc-13.3.0_musl/usr/incl
ude -I/home/buildd/openwrt/staging_dir/toolchain-mips_24kc_gcc-13.3.0_musl/include -I/home/buildd/openwrt/staging_dir/toolchain-mips_24kc_gcc-13
.3.0_musl/include/fortify " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -msoft-float
-fmacro-prefix-map=/home/buildd/openwrt/build_dir/target-mips_24kc_musl/vehicle-command-0.3.3=vehicle-command-0.3.3 -mips16 -minterlink-mips16 -
Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -mips16 -minterlink-mips16 -I/home/buildd/openwrt
/staging_dir/toolchain-mips_24kc_gcc-13.3.0_musl/usr/include -I/home/buildd/openwrt/staging_dir/toolchain-mips_24kc_gcc-13.3.0_musl/include -I/h
ome/buildd/openwrt/staging_dir/toolchain-mips_24kc_gcc-13.3.0_musl/include/fortify " LDFLAGS="-L/home/buildd/openwrt/staging_dir/toolchain-mips_
24kc_gcc-13.3.0_musl/usr/lib -L/home/buildd/openwrt/staging_dir/toolchain-mips_24kc_gcc-13.3.0_musl/lib -fuse-ld=bfd -znow -zrelro " make -j1 -C
/home/buildd/openwrt/build_dir/target-mips_24kc_musl/vehicle-command-0.3.3/. AR="mips-openwrt-linux-musl-gcc-ar" AS="mips-openwrt-linux-musl-gc
c -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -msoft-float -fmacro-prefix-map=/home/buildd/o
penwrt/build_dir/target-mips_24kc_musl/vehicle-command-0.3.3=vehicle-command-0.3.3 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY
_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD="mips-openwrt-linux-musl-ld.bfd" NM="mips-openwrt-linux-musl-gcc-nm" CC="mips-openwrt-linux-musl-gcc" GCC=
"mips-openwrt-linux-musl-gcc" CXX="mips-openwrt-linux-musl-g++" RANLIB="mips-openwrt-linux-musl-gcc-ranlib" STRIP=mips-openwrt-linux-musl-strip
OBJCOPY=mips-openwrt-linux-musl-objcopy OBJDUMP=mips-openwrt-linux-musl-objdump SIZE=mips-openwrt-linux-musl-size CROSS="mips-openwrt-linux-musl
-" ARCH="mips" ;
make[4]: Entering directory '/home/buildd/openwrt/build_dir/target-mips_24kc_musl/vehicle-command-0.3.3'
if TAG=$(git describe --tags --abbrev=0); then echo "${TAG}" | sed 's/v//' > pkg/account/version.txt; fi
fatal: not a git repository (or any of the parent directories): .git
go install ./cmd/...
# runtime/cgo
mips-openwrt-linux-musl-gcc: error: unrecognized command-line option '-m64'
make[4]: *** [Makefile:30: install] Error 1
make[4]: Leaving directory '/home/buildd/openwrt/build_dir/target-mips_24kc_musl/vehicle-command-0.3.3'
make[3]: *** [Makefile:58: /home/buildd/openwrt/build_dir/target-mips_24kc_musl/vehicle-command-0.3.3/.built] Error 2
make[3]: Leaving directory '/home/buildd/openwrt/feeds/packages/net/tesla-control'
time: package/feeds/packages/tesla-control/compile#0.93#0.47#0.43
ERROR: package/feeds/packages/tesla-control failed to build.
make[2]: *** [package/Makefile:179: package/feeds/packages/tesla-control/compile] Error 1
make[2]: Leaving directory '/home/buildd/openwrt'
make[1]: *** [package/Makefile:173: /home/buildd/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/buildd/openwrt'
make: *** [/home/buildd/openwrt/include/toplevel.mk:233: world] Error 2
I see that the problem is the -m64
, but I have no clue on what I have to change. Of course I already googled a lot.
Any help is much appreciated!
Thanks,
Sven