You are not logged in.
I was recently trying to get an extended version of the High Order Calculator, http://nadav.harel.org.il/homepage/hoc/ to compile. It compiles just fine, however at first I got this error:
/bin/install -c -s hoc /usr/bin
/bin/install: cannot create regular file `/usr/bin/hoc': Permission denied
make: *** [install] Error 1
Aborting...
After changing "DESTDIR=$pkgdir" to "prefix=$pkgdir/usr", (as per a thread somewhere on these forums) the error message changed to
/bin/install -c -s hoc /home/archie/Development/aur/hoc/pkg/usr/bin
/bin/install: cannot create regular file `/home/archie/Development/aur/hoc/pkg/usr/bin': No such file or directory
This now looked like a misbehaving Makefile, so I took a look at it. The problem was somewhat easy to spot; however, it was of course an autoconf-generated Makefile, so it had to be fixed with sed.
The Makefile in question:
###############################################################################
# @(#)HOC 9.2 makefile, 1.13 Sun Aug 12 23:27:08 IDT 2007
###############################################################################
prefix = /usr
exec_prefix = ${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
CC=gcc
YACC=bison -y
INSTALL=/bin/install -c
INSTALL_PROGRAM=${INSTALL}
DEFS=-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DRETSIGTYPE=void -Dpointer_sized_int=long -DHAVE_LGAMMA=1 -DHAVE_MATHERR=1 -DHAVE_SIGLONGJMP=1 -DLIBPREFIX="\"$(libdir)/hoc/lib\""
CFLAGS=-march=i686 -mtune=generic -O2 -pipe
LDFLAGS=-Wl,--hash-style=gnu -Wl,--as-needed
LIBS=-lm
LIBOBJS=
YFLAGS = -d
OBJS = hoc.o code.o init.o math.o symbol.o memory.o version.o $(LIBOBJS)
all: hoc
hoc: $(OBJS)
$(CC) $(CFLAGS) $(LD_FLAGS) -o hoc $(OBJS) $(LIBS)
install: hoc
$(INSTALL_PROGRAM) -s hoc $(bindir)
# ##### This is the (2nd) problem: it tries to actually create the /usr/bin directory
# ##### because ${bindir} == ${exec_prefix}/bin aka ${prefix}/bin aka pkg/usr/bin
uninstall:
rm -i $(bindir)/hoc
...
Unfortunately, I couldn't get sed to work properly. It seemed (through a "less ./Makefile" inserted after the sed command, which WAS after ./configure was called) as though it would not match the portion of the troubled line that came after the INSTALL_PROGRAM variable.
Here is the PKGBUILD:
# Maintainer: Your Name <address at domain dot com>
pkgname=hoc
pkgver=9.2
pkgrel=1
pkgdesc="An extended version of the Kernighan & Pike High Order Calculator"
arch=('i686' 'x86_64')
url="http://nadav.harel.org.il/homepage/hoc/"
license=('BSD')
depends=()
makedepends=('bison')
optdepends=()
options=()
install=
source=(http://nadav.harel.org.il/homepage/$pkgname/$pkgname-$pkgver.tgz)
noextract=()
md5sums=('3d11ba6f6731502b6c7efa8078573adc')
build() {
cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr || return 1
sed -e 's/-s hoc.*$/-t $(bindir) hoc/' ./Makefile
less ./Makefile # make sure sed worked right
make || return 1
make prefix=$pkgdir/usr install || return 1
}
Thanks in advance to anyone who can help me fix it.
Last edited by Bushman (2010-08-18 01:20:49)
Offline
prefix or DESTDIR ar not used at all into that Makefile. You will need to patch it.
Give what you have. To someone, it may be better than you dare to think.
Offline
prefix or DESTDIR ar not used at all into that Makefile. You will need to patch it.
prefix = /usr exec_prefix = ${prefix} bindir=${exec_prefix}/bin
<SNIP>
install: hoc $(INSTALL_PROGRAM) -s hoc $(bindir)
Unless you are referring to me not including the entire Makefile (the rest of which was the "clean" and "gcclint" phony targets and the targets for the actual compilation which succeeds), I do not understand what you mean by "prefix or DESTDIR are not used at all into that Makefile". Disregarding that, patching has been stated by the Wiki to be overkill for changing just one or two lines.
Last edited by Bushman (2010-08-17 22:39:29)
Offline
i'm saying that you should add something like that in install
$(INSTALL_PROGRAM) -D -s hoc $(DESTDIR)$(bindir)/hoc
and use make DESTDIR=$pkgdir install
Give what you have. To someone, it may be better than you dare to think.
Offline
wonder wrote:prefix or DESTDIR ar not used at all into that Makefile. You will need to patch it.
autoconf, in generating the Makefile, wrote:prefix = /usr exec_prefix = ${prefix} bindir=${exec_prefix}/bin
<SNIP>
install: hoc $(INSTALL_PROGRAM) -s hoc $(bindir)
Unless you are referring to me not including the entire Makefile (the rest of which was the "clean" and "gcclint" phony targets and the targets for the actual compilation which succeeds), I do not understand what you mean by "prefix or DESTDIR are not used at all into that Makefile". Disregarding that, patching has been stated by the Wiki to be overkill for changing just one or two lines.
By convention, Makefiles are supposed to honor the DESTDIR variable, which is a base directory for installing to. It's particularly helpful in this scenario when you're not really installing to the system, but creating a package. I believe you'll see the following in /usr/share/pacman/PKGBUILD.proto:
make DESTDIR="$pkgdir/" install
Whether or not patching to add one or two lines is overkill is irrelevant. For all intents and purposes, you're dealing with a broken Makefile. You can just add the following (adjusting where necessary)...
sed 's/$(INSTALL_PROGRAM) -s hoc $(bindir)/$(INSTALL_PROGRAM) -s hoc $(DESTDIR)$(bindir)/' "$srcdir/$pkgname-$pkgver/Makefile"
to your own PKGBUILD to fix it.
Last edited by falconindy (2010-08-17 23:20:13)
Offline
@falconindy: I get this error message when using that sed command:
sed: -e expression #1, char 85: unknown option to `s'
Aborting...
@wonder: I can't manually edit the Makefile because it's automatically generated by the ./configure script
Offline
@falconindy: I get this error message when using that sed command:
sed: -e expression #1, char 85: unknown option to `s' Aborting...
@wonder: I can't manually edit the Makefile because it's automatically generated by the ./configure script
Oh, silly me. Use a different separator in sed, e.g.
sed 's#$(INSTALL_PROGRAM) -s hoc $(bindir)#$(INSTALL_PROGRAM) -s hoc $(DESTDIR)$(bindir)#' "$srcdir/$pkgname-$pkgver/Makefile"
Offline
It doesn't put out an error message, but it still doesn't match. It still has the same problem in that it's parsing the parentheses. Even after I escaped the parentheses and the dollar signs (and used all the permutations of that and the '--posix' option), it still failed to match at all.
Offline
Offline
you could use :
install -d $pkgdir/usr/bin
make prefix=$pkgdir/usr install
Last edited by Snowman (2010-08-18 01:19:05)
Offline
I added that install command before make install and it now works! Thank you all very much!
Offline