Gauche icon indicating copy to clipboard operation
Gauche copied to clipboard

gosh depends on system libgauche during installation

Open pclouds opened this issue 4 years ago • 4 comments

I did something funny today. Probably not a big deal, but could be potential issue.

I wanted a clean start because my installation accumulated so many gauche versions, so I made sure to "make" everything ok, then "rm -r ~/opt/gauche", my gauche prefix and did "make install".

"make install" failed because gosh failed to find libgauche.so. I remember that the new gosh is relinked in installation phase to add -rpath to point to the right location. That is probably the problem because the right location doe not have libgauche.so anymore. "gosh" before this final phase has -rpath pointing to the new libgauche.so in the source tree.

The potential problem here is the new "gosh" is not always compatible with the old (installed) libgauche.so. So running gosh at installation phase using the old libgauche.so could end up with weird errors.

pclouds avatar Mar 04 '20 12:03 pclouds

Ah, I see.

The premise is that we do use system's install command to install libgauche and other binaries, and use gauche-install to install the rest. By the time we use gauche-install, the fresh libgauche is already in place.

However, at some point I forgot about the dependency and runs make install in ext/ before src/, and ext/'s installation uses gauche-install. Do'h.

shirok avatar Mar 05 '20 05:03 shirok

Now I figured what happened.

The toplevel "make install" triggers the following events:

  1. run make install under lib, which uses system's install to install library files
  2. run make install under ext, which uses gauche-install (which calls gosh -ftest).
  3. run make install under src, which relinks gosh and use system's install to install binaries.

First time you run this, gosh in the second step hasn't been relinked, so it links to the libgauche in the build tree. It works no matter which version of libgauche is already installed.

However, you run make install again without triggering linking of gosh, then the second step uses gosh that's already been relinked. If you've deleted the installed libgauche, it fails.

Now, the version mismatch only occurs when you build and install different version of Gauche from a separate tree inbetween. It can occur, but I guess it's not a typical case.

I think it can be avoided to build a relinked version of gosh with a different name or in a different directory so that installation of ext always uses the version that's linked to the libgauche in a build tree.

shirok avatar Mar 05 '20 10:03 shirok

I think it can be avoided to build a relinked version of gosh with a different name or in a different directory so that installation of ext always uses the version that's linked to the libgauche in a build tree.

Yes I came up with the same conclusion. Either that or we delay relinking until the very last minute, and it will be the last file we install. But it's more fragile that way.

pclouds avatar Mar 05 '20 10:03 pclouds

BTW it does not have to be fixed. I understand I do weird stuff sometimes. It's your call to see if something should be done or this is issue should be closed. I'm fine either way.

pclouds avatar Mar 05 '20 10:03 pclouds