J M Smith
J M Smith

Reputation: 35

make command not working in Windows WSL Ubuntu

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

Upvotes: 2

Views: 14709

Answers (1)

VonC
VonC

Reputation: 1328342

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.

Upvotes: 1

Related Questions