M2 icon indicating copy to clipboard operation
M2 copied to clipboard

Rogue files installed by make install

Open kmarius opened this issue 6 years ago • 4 comments

I am building macaulay2 on archlinux according to the following PKGBUILD: https://gist.github.com/kmarius/bf3c9344f90d8265a563a622507e1b2f#file-pkgbuild This boils down to

make

./configure --enable-download --prefix=/usr \
	--libexecdir='${prefix}'/lib/Macaulay2 \
	--enable-shared

make -j1

make DESTDIR="${pkgdir}" install

In the resulting package I will find most of the files correctly in /usr, but also some in /build, where M2 was compiled. Package contents: https://gist.github.com/kmarius/bf3c9344f90d8265a563a622507e1b2f#file-resulting-package

These files were make install'd to the wrong path, but I can't tell wether these files are supposed to be somewhere in usr (and --prefix was disrespected somwhere) or can be deleted.

Log of make install here: https://gist.github.com/kmarius/bf3c9344f90d8265a563a622507e1b2f#file-make-install-log

kmarius avatar Dec 17 '18 14:12 kmarius

It seems that our file M2/distributions/install/Makefile.in does refer to the make variable "DESTDIR", but I have never tested the functioning of the variable DESTDIR nor even of the make target "install".

I recommend trying this instead, as a temporary work-around:

make
./configure --enable-download --prefix="${pkgdir}" \
	--libexecdir='${prefix}'/lib/Macaulay2 \
	--enable-shared
make -j1
make install

and letting us know whether it works. I think there are no hard-wired paths in the files we build, so it ought to just work.

The reason I never use "make install" is that I either run it in place, for convenience of development, or I make package files directly, in various formats: *.dmg, *.tar.gz, *.deb, or *.rpm.

We should eventually fix the behavior of DESTDIR, whose usage is described in https://www.gnu.org/prep/standards/standards.txt .

DanGrayson avatar Dec 17 '18 14:12 DanGrayson

I have now compiled the package with

make
./configure --enable-download --prefix="${pkgdir}/usr" \
	--libexecdir='${prefix}'/lib/Macaulay2 \
	--enable-shared
make -j1
make install

Now the package only contains the folder usr. grepping recursively for ${pkgdir} results in

usr/share/info/Macaulay2/Macaulay2Doc.info:|acaulay2-git/pkg/macaulay2-git                                               |
usr/share/doc/Macaulay2/Macaulay2Doc/html/_version.html:               configure arguments =>  '--enable-download' '--prefix=/build/macaulay2-git/pkg/macaulay2-git/usr' '--libexecdir=${prefix}/lib/Macaulay2' '--enable-shared' 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt'
usr/share/doc/Macaulay2/Macaulay2Doc/example-output/_version.out:               configure arguments =>  '--enable-download' '--prefix=/build/macaulay2-git/pkg/macaulay2-git/usr' '--libexecdir=${prefix}/lib/Macaulay2' '--enable-shared' 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt' 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt'
Binary file usr/bin/M2-binary matches

Not sure if that is fine.

The finished package does not contain any of the files that were wrongly installed before:

> find . -name "*ffpack*"              
./usr/share/doc/Macaulay2/Macaulay2Doc/html/_fflas-ffpack.html                                                             
./usr/lib/Macaulay2/Macaulay2/program-licenses/fflas_ffpack
./usr/lib/Macaulay2/Macaulay2/bin/fflas-ffpack-config

(these are the same files that are found in /usr in my first attempt). Without DESTDIR I assume tthey were installed just where they were sitting in the build directory after compilation.

kmarius avatar Dec 17 '18 17:12 kmarius

Thank you for the further information.

DanGrayson avatar Jan 25 '19 21:01 DanGrayson

DESTDIR is a standard variable that should be respected by make install. For instance it is used by package builders or if you would like to use M2 with chroot.

When using CMake, ninja install and make install respect DESTDIR.

mahrud avatar Jul 06 '20 17:07 mahrud