2

I am trying to build a project in Ubuntu in a WSL instance. The command I'm using is from a chirpstack-simulator project: docker-compose run --rm chirpstack-simulator make clean build. For some reason make refuses to work correctly, or at all.

I keep getting an error: "make: *** No rule to make target 'clean'. Stop."

Here is the Makefile code:

VERSION := $(shell git describe --always |sed -e "s/^v//")

build:
    @echo "Compiling source"
    @mkdir -p build
    go build $(GO_EXTRA_BUILD_ARGS) -ldflags "-s -w -X main.version=$(VERSION)" -o build/chirpstack-simulator cmd/chirpstack-simulator/main.go

clean:
    @echo "Cleaning up workspace"
    @rm -rf build
    @rm -rf dist
    @rm -rf docs/public

The docker-compose.yml code:

services:
  chirpstack-simulator:
    build:
      context: .
      dockerfile: Dockerfile-devel
    command: make
    volumes:
      - ./:/chirpstack-simulator

And the Docker-devel file:

FROM golang:1.13-alpine

ENV PROJECT_PATH=/chirpstack-simulator
ENV PATH=$PATH:$PROJECT_PATH/build
ENV CGO_ENABLED=0
ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix TDM-GCC-64"

RUN apk add --no-cache ca-certificates tzdata make git bash

RUN mkdir -p $PROJECT_PATH
COPY . $PROJECT_PATH
WORKDIR $PROJECT_PATH

As you can see, both build and clean are defined. Has anyone encountered this issue before?

Edit: This is the full project I am trying to build https://github.com/brocaar/chirpstack-simulator

And further details: I have tried doing sudo apt-get remove make sudo apt-get install make then sudo apt-get install --reinstall build-essentials It is still giving the error.

Version of Ubuntu is 16.04 LTS if it helps narrow things down

5
  • Is your makefile called Makefile (or makefile) (not something like Makefile.mak or whatever)? When you run make is your working directory the one containing the makefile? Maybe add an ls and/or pwd as a command to run, to see the contents of the directory and what directory you're in. Commented Sep 14, 2020 at 14:36
  • @MadScientist Hi, the makefile is named 'Makefile'. And how would I add those commands? I am quite new to Linux/Ubuntu and Docker as a whole. I tried adding them to the 'command': section of the docker-compose.yml like "command: ls pwd make" and they were ignored. I also tried adding them to the original command to run the build "ls | pwd | docker-compose run --rm chirpstack-simulator make clean build"
    – J M Smith
    Commented Sep 14, 2020 at 15:16
  • I don't know much about how that yaml format works; you'd have to ask a docker person. Probably you need to adjust the question tags to include docker. But, you definitely can't use something like ls pwd make. You need to at least put semicolons between them: ls; pwd; make (not pipe symbols). Or possibly that won't work and you should just replace make with ls, just to see what output you get, then put back make when you figure it out. Commented Sep 14, 2020 at 15:41
  • docker-compose run doesn't take arguments. Are you doing make clean build on a new line? Also, not sure I understand why you really need Compose here Commented Sep 14, 2020 at 16:27
  • I am just following the commands in the README, honestly. My first experience of Go/Docker was only two days ago, and this isn't my usual type of work in general, so apologies but I don't have enough knowledge of what could necessarily replace any given command here.
    – J M Smith
    Commented Sep 15, 2020 at 7:58

1 Answer 1

1

I would at the very least replace the make command by ls -larth, just to make sure the docker-compose run ls -alrth does display a Makefile in its execution context.

If it does not, then any make command would fail with the error message you mention.

3
  • Appreciate the help. Unfortunately when I try this I get an error stating "ERROR: No such service: ls". This is making me think it is a general problem with WSL, or I suppose more likely, there might have been something basic I may have inadvertently not downloaded
    – J M Smith
    Commented Sep 23, 2020 at 13:39
  • @JMurphySmith Strange. Is it similar to serverfault.com/a/1007812/783?
    – VonC
    Commented Sep 23, 2020 at 13:46
  • It doesn't seem so. I never installed docker with snap. The command I used was sudo apt-get install docker-compose from first setup and continued from there to meet the problem mentioned in the question
    – J M Smith
    Commented Sep 23, 2020 at 14:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.