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

cp: cannot stat './firmware/src/libs/firmata/arduino/*.{h,cpp}': No such file or directory #246

Closed
peteruithoven opened this issue Jun 1, 2021 · 7 comments · Fixed by #250

Comments

@peteruithoven
Copy link
Contributor

I'm running into an issue when running make build-firmata:

rm -rf ./firmware/build/node_pixel_firmata
Creating firmata build files
mkdir ./firmware/build/node_pixel_firmata
cp ./firmware/src/libs/firmata/arduino/*.{h,cpp} ./firmware/build/node_pixel_firmata/
cp: cannot stat './firmware/src/libs/firmata/arduino/*.{h,cpp}': No such file or directory
Makefile:102: recipe for target 'build-firmata' failed
make: *** [build-firmata] Error 1

I made sure to install the arduino submodule using git submodule update --init --recursive.

Running ll on the files it's trying to copy they are found just fine:

$ ll ./firmware/src/libs/firmata/arduino/*.{h,cpp}                                    
-rw-rw-r-- 1 peteruithoven peteruithoven  49K jun  1 21:06 ./firmware/src/libs/firmata/arduino/Boards.h
-rw-rw-r-- 1 peteruithoven peteruithoven 5,6K jun  1 21:06 ./firmware/src/libs/firmata/arduino/FirmataConstants.h
-rw-rw-r-- 1 peteruithoven peteruithoven  19K jun  1 21:06 ./firmware/src/libs/firmata/arduino/Firmata.cpp
-rw-rw-r-- 1 peteruithoven peteruithoven 8,5K jun  1 21:06 ./firmware/src/libs/firmata/arduino/FirmataDefines.h
-rw-rw-r-- 1 peteruithoven peteruithoven 8,0K jun  1 21:06 ./firmware/src/libs/firmata/arduino/Firmata.h
-rw-rw-r-- 1 peteruithoven peteruithoven  16K jun  1 21:06 ./firmware/src/libs/firmata/arduino/FirmataMarshaller.cpp
-rw-rw-r-- 1 peteruithoven peteruithoven 2,4K jun  1 21:06 ./firmware/src/libs/firmata/arduino/FirmataMarshaller.h
-rw-rw-r-- 1 peteruithoven peteruithoven  17K jun  1 21:06 ./firmware/src/libs/firmata/arduino/FirmataParser.cpp
-rw-rw-r-- 1 peteruithoven peteruithoven 4,2K jun  1 21:06 ./firmware/src/libs/firmata/arduino/FirmataParser.h

I'm using zsh on elementary OS 5.1.7 Hera which is built on Ubuntu 18.04.4 LTS.

I feel like I'm missing something stupid.

I noticed I can actually run the line manually:

cp ./firmware/src/libs/firmata/arduino/*.{h,cpp} ./firmware/build/node_pixel_firmata/
@ajfisher
Copy link
Owner

ajfisher commented Jun 8, 2021 via email

@peteruithoven
Copy link
Contributor Author

Good idea. I now have a very simple example. Note the comments for when it doesn't work.

FIRMWARE_DIR = ./firmware
BUILD_DIR = $(FIRMWARE_DIR)/build
SRC_DIR = $(FIRMWARE_DIR)/src
LIBS_DIR = $(SRC_DIR)/libs

# make the Firmata build process to copy the files to the right place
FIRMATA_DEST_DIR = $(BUILD_DIR)/node_pixel_firmata
# FIRMATA_FILES = $(LIBS_DIR)/firmata/arduino/*.{h,cpp} # < Doesn't work
# FIRMATA_FILES = $(LIBS_DIR)/firmata/arduino/Boards.h # Works
FIRMATA_FILES = $(LIBS_DIR)/firmata/arduino/Firmata.cpp # Works
# FIRMATA_FILES = $(LIBS_DIR)/firmata/arduino/* # works (with cp -r)

build-firmata:
	cp $(FIRMATA_FILES) $(FIRMATA_DEST_DIR)/

@peteruithoven
Copy link
Contributor Author

Even simpler:
Does not work:

build-firmata:
	cp ./firmware/src/libs/firmata/arduino/*.{h,cpp} ./firmware/build/node_pixel_firmata/ 

Works:

build-firmata:
	cp ./firmware/src/libs/firmata/arduino/Firmata.cpp ./firmware/build/node_pixel_firmata/	

@peteruithoven
Copy link
Contributor Author

I was afraid it was maybe the shell that was executing the Makefile.

After reading:
https://www.gnu.org/software/make/manual/make.html#Choosing-the-Shell-1

This actually seems to help:

SHELL = /usr/bin/zsh

build-firmata:
	cp ./firmware/src/libs/firmata/arduino/*.{h,cpp} ./firmware/build/node_pixel_firmata/

This also works:

SHELL = /bin/bash

build-firmata:
	cp ./firmware/src/libs/firmata/arduino/*.{h,cpp} ./firmware/build/node_pixel_firmata/

@peteruithoven
Copy link
Contributor Author

I think the {h,cpp} bit just isn't supported by the shell that's executing makefiles on my system.

Crude alternative that also works:

build-firmata:
	cp ./firmware/src/libs/firmata/arduino/*.h ./firmware/build/node_pixel_firmata/
	cp ./firmware/src/libs/firmata/arduino/*.cpp ./firmware/build/node_pixel_firmata/

@peteruithoven
Copy link
Contributor Author

@ajfisher
Copy link
Owner

ajfisher commented Jun 9, 2021 via email

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

Successfully merging a pull request may close this issue.

2 participants