You are not logged in.

#1 2016-08-18 13:18:37

kgizdov
Package Maintainer (PM)
From: Edinburgh, UK
Registered: 2015-12-08
Posts: 113

[SOLVED] Trying to optimise a package with namcap

Hi,

So I am the new maintainer of the CERN ROOT package in AUR - https://aur.archlinux.org/packages/root/

I've trying to appeal to all the rules and used namcap to help me fix some errors with deps, folders and so on. Currently, the package compiles and runs fine for everyone that has posted in the comments. However, I have some outstanding issues that I need help with.

$ namcap root-6.06.06-2-x86_64.pkg.tar.xz

root W: Referenced library 'csh' is an uninstalled dependency
root W: .INSTALL file runs a command provided by hooks.
root W: Unused shared library '/usr/lib/root/libMatrix.so' by file ('usr/lib/root/libSpectrumPainter.so')
root W: Unused shared library '/usr/lib/root/libMathCore.so' by file ('usr/lib/root/libSpectrumPainter.so')
root W: Unused shared library '/usr/lib/root/libRIO.so' by file ('usr/lib/root/libSpectrumPainter.so')
root W: Unused shared library '/usr/lib/root/libThread.so' by file ('usr/lib/root/libSpectrumPainter.so')
root W: Unused shared library '/usr/lib/root/libGed.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libMLP.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libMinuit.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libTreePlayer.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libTree.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libNet.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libGraf3d.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libThread.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libMathCore.so' by file ('usr/lib/root/libTMVAGui.so')
root W: Unused shared library '/usr/lib/root/libNet.so' by file ('usr/lib/root/libSessionViewer.so')
root W: Unused shared library '/usr/lib/root/libRIO.so' by file ('usr/lib/root/libSessionViewer.so')
root W: Unused shared library '/usr/lib/root/libThread.so' by file ('usr/lib/root/libSessionViewer.so')
root W: Unused shared library '/usr/lib/root/libMatrix.so' by file ('usr/lib/root/libSessionViewer.so')
root W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/lib/root/libSessionViewer.so')
...

Firstly, I do not understand the warning about csh. I don't really want to require tcsh as a dependency as the package runs perfectly fine without it. I wonder if I there is a way to tell CMAKE to use another shell.

Secondly, I am thinking of trying to correct for the unused dependencies by issuing "LD_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,--no-allow-shlib-undefined", but I'm afraid that could break the build for some people. I was wondering if someone had a similar issue and knows of a reliable way of solving this.

Then comes the non-descriptive .INSTALL warning. Here is the file:

post_install() {
  update-desktop-database >/dev/null

  update-mime-database /usr/share/mime >/dev/null

  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

post_upgrade() {
  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

pre_remove() {
  # leave for pre 5.30.03-3
  if [[ $(vercmp $1 5.30.03-3) == -1 ]]; then
    cat etc/ld.so.conf | grep -v '/usr/lib/root' >/tmp/.pacroot
    mv /tmp/.pacroot etc/ld.so.conf
    chmod 644 etc/ld.so.conf
    sbin/ldconfig -r .
  fi
}

post_remove() {
  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
}

How do I go about addressing this warning. I'm not even sure to which command this is referring.

Thanks.

Last edited by kgizdov (2016-08-19 16:51:19)

Offline

#2 2016-08-18 13:32:09

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: [SOLVED] Trying to optimise a package with namcap

There is likely a script that's calling csh specifically. Grep through $pkgdir, see what you find.

Everything in that install file is wrong. Everything in the post_* functions are already taken care of by hooks, they just be removed. The pre_remove is different, why is it doing this?

Offline

#3 2016-08-18 13:53:42

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] Trying to optimise a package with namcap

I'm not sure if what is done in pre_remove is needed, advisable, etc, but at very least the code to implement it is all wrong.

A useless use of cat, piped to grep, sent to a temp file only to be moved back in place and chmodded is complete nonsense.  Assuming this should be done at all, the following will do it:

sed -i '/\/usr\/lib\/root/d' /etc/ld.so.conf
ldconfig

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2016-08-18 13:55:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: [SOLVED] Trying to optimise a package with namcap

And ldconfig isn't necessary, pacman will take care of that.

Offline

#5 2016-08-18 14:03:14

kgizdov
Package Maintainer (PM)
From: Edinburgh, UK
Registered: 2015-12-08
Posts: 113

Re: [SOLVED] Trying to optimise a package with namcap

Scimmia wrote:

There is likely a script that's calling csh specifically. Grep through $pkgdir, see what you find.

Everything in that install file is wrong. Everything in the post_* functions are already taken care of by hooks, they just be removed. The pre_remove is different, why is it doing this?

To be honest, I'm not sure. I can relate it to the last install command in PKGBUILD - package(). The files seems to be moved to /etc/ld.so.conf.d/root.conf for some reason. I inherited this PKGBUILD as is. It seems to be quite old as it is talking about version 5.30. I'm thinking this is to make ROOT have it's own pkg-config files, but I can't be sure. If that even makes sense.

Last edited by kgizdov (2016-08-18 14:06:59)

Offline

#6 2016-08-18 14:08:31

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: [SOLVED] Trying to optimise a package with namcap

ld.so.conf is the linker config, it tells the linker where to look for dynamic libraries. The correct way to use it is what it does now, drop a file in ld.so.conf.d/ which will then get included into ld.so.conf. I'm assuming an old version used to put it directly into ld.so.conf, and this is just removing that. If it's really old, removing that function should be fine. If you want to support updating from really old packages, it should be simplified at the very least.

Offline

#7 2016-08-18 14:15:40

kgizdov
Package Maintainer (PM)
From: Edinburgh, UK
Registered: 2015-12-08
Posts: 113

Re: [SOLVED] Trying to optimise a package with namcap

Scimmia wrote:

ld.so.conf is the linker config, it tells the linker where to look for dynamic libraries. The correct way to use it is what it does now, drop a file in ld.so.conf.d/ which will then get included into ld.so.conf. I'm assuming an old version used to put it directly into ld.so.conf, and this is just removing that. If it's really old, removing that function should be fine. If you want to support updating from really old packages, it should be simplified at the very least.

So then you would have me change root.install to read:

pre_remove() {
  # leave for pre 5.30.03-3
  if [[ $(vercmp $1 5.30.03-3) == -1 ]]; then
    sed -i '/\/usr\/lib\/root/d' /etc/ld.so.conf
    ldconfig
  fi
}

To make sure old versions can upgrade. But thinking about this, I adopted ROOT5 as well, where this command also exists. Should I not just remove the whole file and make sure the ld.so.conf is moved to the appropriate folder?

Offline

#8 2016-08-18 14:29:05

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: [SOLVED] Trying to optimise a package with namcap

As I said, you can remove ldconfig as well.

I don't know just when it switched to using a separate file. If it's been a couple of years, I'd say go ahead and remove the whole file. If people haven't updated in that time, it becomes their problem.

Offline

#9 2016-08-19 12:22:37

kgizdov
Package Maintainer (PM)
From: Edinburgh, UK
Registered: 2015-12-08
Posts: 113

Re: [SOLVED] Trying to optimise a package with namcap

EDIT: Nevermind, it seems that namcap does not resolve .so deps that are built by the package itself.

OK, followed the suggestions and had some good results. However, I have a new problem. I added the LDFLAGS from /etc/makepkg.conf

set (CMAKE_SHARED_LINKER_FLAGS "-pthread -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,--no-undefined -Wl,--no-allow-shlib-undefined" CACHE STRING "" FORCE)

to the package to try and mitigate the unused shared library warnings and now I get these:

root W: Referenced library 'libThread.so' is an uninstalled dependency
root W: Referenced library 'libGed.so' is an uninstalled dependency
root W: Referenced library 'libMinuit.so' is an uninstalled dependency
root W: Referenced library 'libASImage.so' is an uninstalled dependency
root W: Referenced library 'libPhysics.so' is an uninstalled dependency
root W: Referenced library 'libXMLIO.so' is an uninstalled dependency
root W: Referenced library 'libGui.so' is an uninstalled dependency
root W: Referenced library 'libTMVA.so' is an uninstalled dependency
root W: Referenced library 'libRooFitCore.so' is an uninstalled dependency
root W: Referenced library 'libEG.so' is an uninstalled dependency
root W: Referenced library 'libRooStats.so' is an uninstalled dependency
root W: Referenced library 'libMatrix.so' is an uninstalled dependency
root W: Referenced library 'libGX11.so' is an uninstalled dependency
root W: Referenced library 'libMathCore.so' is an uninstalled dependency
root W: Referenced library 'libHist.so' is an uninstalled dependency
root W: Referenced library 'libCore.so' is an uninstalled dependency
root W: Referenced library 'libMathMore.so' is an uninstalled dependency
root W: Referenced library 'libGraf3d.so' is an uninstalled dependency
root W: Referenced library 'libGpad.so' is an uninstalled dependency
root W: Referenced library 'libRootAuth.so' is an uninstalled dependency
root W: Referenced library 'libTree.so' is an uninstalled dependency
root W: Referenced library 'libRint.so' is an uninstalled dependency
root W: Referenced library 'libTreePlayer.so' is an uninstalled dependency
root W: Referenced library 'libNew.so' is an uninstalled dependency
root W: Referenced library 'libRIO.so' is an uninstalled dependency
root W: Referenced library 'libGraf.so' is an uninstalled dependency
root W: Referenced library 'libMLP.so' is an uninstalled dependency
root W: Referenced library 'libHistFactory.so' is an uninstalled dependency
root W: Referenced library 'libXMLParser.so' is an uninstalled dependency
root W: Referenced library 'libRGL.so' is an uninstalled dependency
root W: Referenced library 'libFoam.so' is an uninstalled dependency
root W: Referenced library 'libNet.so' is an uninstalled dependency
root W: Referenced library 'libRooFit.so' is an uninstalled dependency
root W: Referenced library 'libProofPlayer.so' is an uninstalled dependency
root W: Referenced library 'libTreeViewer.so' is an uninstalled dependency
root W: Referenced library 'libGeom.so' is an uninstalled dependency
root W: Referenced library 'libProof.so' is an uninstalled dependency

All of which are required dependencies and are included in the build. This wasn't the case with the flags being only:

set (CMAKE_SHARED_LINKER_FLAGS "-pthread -Wl,--no-undefined -Wl,--no-allow-shlib-undefined" CACHE STRING "" FORCE)

Any ideas why?

Last edited by kgizdov (2016-08-19 16:00:32)

Offline

Board footer

Powered by FluxBB