I am trying to run debuild command to work with debian with my project However, when I run debuild command I get such error:
hoseopjeong@hoseopjeong-VirtualBox:~/Documents/HoseopJeong_debian_lab9/debianlaboration9-0.0$ debuild
dpkg-buildpackage -rfakeroot -D -us -uc
dpkg-buildpackage: source package debianlaboration9
dpkg-buildpackage: source version 0.0-1
dpkg-buildpackage: source distribution UNRELEASED
dpkg-buildpackage: source changed by Ho Seop Jeong <my email>
dpkg-source --before-build debianlaboration9-0.0
dpkg-buildpackage: host architecture i386
fakeroot debian/rules clean
dh clean
dh_testdir
dh_auto_clean
make -j1 distclean
make[1]: Entering directory '/home/hoseopjeong/Documents/HoseopJeong_debian_lab9/debianlaboration9-0.0'
rm -f electrotest
make[1]: Leaving directory '/home/hoseopjeong/Documents/HoseopJeong_debian_lab9/debianlaboration9-0.0'
dh_clean
rm -f debian/debhelper-build-stamp
rm -f debian/debianlaboration9.substvars
rm -f debian/debianlaboration9.*.debhelper
rm -rf debian/debianlaboration9/
rm: cannot remove 'debian/debianlaboration9/usr/electrotest_standalone': Permission denied
dh_clean: rm -rf debian/debianlaboration9/ returned exit code 1
debian/rules:9: recipe for target 'clean' failed
make: *** [clean] Error 25
dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2
debuild: fatal error at line 1376:
dpkg-buildpackage -rfakeroot -D -us -uc failed
this is how my makefile look like:
prefix = /usr/local
all: electrotest
electrotest: ./src/electrotest_standalone.c
gcc -o electrotest_standalone ./src/electrotest_standalone.c -lm
install:electrotest
install -D electrotest_standalone \
$(DESTDIR)$(prefix)/bin/electrotest_standalone
clean:
-rm -f electrotest
distclean:clean
uninstall:
-rm -f $(DESTDIR)$(prefix)/bin/electrotest_standalone
PHONY: all install clean distclean uninstall
this is my debian rules file
#!/usr/bin/make -f
# You must remove unused comment lines for the released package.
export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@
#override_dh_auto_install:
# dh_auto_install -- prefix=/usr
#override_dh_install:
# dh_install --list-missing -X.pyc -X.pyo
override_dh_auto_install:
dh_auto_install -- prefix=/usr
So as you see errors generated in terminal, If I understand right, debuild somehow tries to run clean that is defined in makefile to remove elecrotest which is created inside debian folder. However the folder is a folder with a limited privilege and clean shows permission denied error.
I have checked this post How to prevent debuild from performing a clean? and one of the answers are saying
override_dh_clean:
but I was not sure is that a right way to go because I thought it can make problems with build. Is changing privilege of folder generated by debian with chmod a the only way to go? or is there any smart idea that can solve this problem? I am not looking for workarounds.. need some solution to this
As A.B mentioned in comment, I did ls -ld debian/debianlaboration9/usr/ and got this result
drwxr-xr-x 2 root root 4096 jun 14 03:19