GeorgicaFaraFrica
GeorgicaFaraFrica

Reputation: 87

Why do I need `sudo` to `make all`?

I am using hzeller's LED Library and this is one of the make file that I found:

CXXFLAGS=-Wall -O3 -g -Wextra -Wno-unused-parameter
OBJECTS=MP_Display.o
BINARIES=MP_Display

# RGB_LIB_DISTRIBUTION, this is where the library is checked out.
RGB_LIB_DISTRIBUTION=rpi-rgb-led-matrix
RGB_INCDIR=$(RGB_LIB_DISTRIBUTION)/include
RGB_LIBDIR=$(RGB_LIB_DISTRIBUTION)/lib
RGB_LIBRARY_NAME=rgbmatrix
RGB_LIBRARY=$(RGB_LIBDIR)/lib$(RGB_LIBRARY_NAME).a
LDFLAGS+=-L$(RGB_LIBDIR) -l$(RGB_LIBRARY_NAME) -lrt -lm -lpthread -lcurl

all : $(BINARIES)

$(RGB_LIBRARY): FORCE
    $(MAKE) -C $(RGB_LIBDIR)

Metrici_MP_Display: Metrici_MP_Display.o  $(RGB_LIBRARY)
    $(CXX) $(CXXFLAGS) Metrici_MP_Display.o -o $@ $(LDFLAGS) $(MAGICK_LDFLAGS)

%.o : %.cc
    $(CXX) -I$(RGB_INCDIR) $(CXXFLAGS) -c -o $@ $<

Metrici_MP_Display.o : Metrici_MP_Display.cc
    $(CXX) -I$(RGB_INCDIR) $(CXXFLAGS) $(MAGICK_CXXFLAGS) -c -o $@ $<

clean:
    rm -f $(OBJECTS) $(BINARIES) $(OPTIONAL_OBJECTS) $(OPTIONAL_BINARIES)

FORCE:
.PHONY: FORCE

Why do I need to use sudo make all instead of make all to compile the code ?

I would like the resulting files to NOT be owned by root.

Upvotes: 0

Views: 98

Answers (1)

Victor Sergienko
Victor Sergienko

Reputation: 13475

Probably because you have run it as sudo make ... once, and it has created some files and directories that belong to root. Now you can neither overwrite nor delete them without sudo.

Run sudo chown --recursive <your user>.<your group> * in your project directory.

Upvotes: 1

Related Questions