# Shared object "liblzma.so.0" not found, required by "xsltproc"



## dvl@ (Jul 29, 2013)

I have moved a jail from an 8.4 host to a 9.2 host.  I did a `portupgrade -fa` after the move.  The main problem occurs while trying to install git:


```
[dan@mysql55:/usr/ports/devel/git] $ sudo make install
===>  Installing for git-1.8.3.4
===>   git-1.8.3.4 depends on package: p5-Error>=0 - found
...
...
install -m 755 git-subtree /usr/local/libexec/git-core
xmlto -m ../../Documentation/manpage-normal.xsl  man git-subtree.xml
Shared object "liblzma.so.0" not found, required by "xsltproc"
gmake: *** [git-subtree.1] Error 1
*** [post-install] Error code 2

Stop in /basejail/usr/ports/devel/git.
*** [install] Error code 1

Stop in /basejail/usr/ports/devel/git.
```

Looking closer:


```
$ ldd /usr/local/bin/xsltproc
/usr/local/bin/xsltproc:
        libxslt.so.2 => /usr/local/lib/libxslt.so.2 (0x80081d000)
        libexslt.so.8 => /usr/local/lib/libexslt.so.8 (0x800a57000)
        libgcrypt.so.19 => /usr/local/lib/libgcrypt.so.19 (0x800c6a000)
        libgpg-error.so.0 => /usr/local/lib/libgpg-error.so.0 (0x800ee7000)
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x8010ea000)
        libxml2.so.5 => /usr/local/lib/libxml2.so.5 (0x8012f4000)
        liblzma.so.0 => not found (0)
        libz.so.6 => /lib/libz.so.6 (0x801648000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libm.so.5 => /lib/libm.so.5 (0x801b58000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
        liblzma.so.0 => not found (0)
        liblzma.so.0 => not found (0)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x8020cc000)
```

Suggestions please?


----------



## wblock@ (Jul 29, 2013)

Rebuild textproc/libxslt?  Although it should already have been rebuilt.  Looking for fake library symlinks won't hurt: http://www.wonkity.com/~wblock/fakelib/fastfakelib.


----------



## SirDice (Jul 29, 2013)

I think you need to remove archivers/xz and rebuild everything that depended on it. If I recall correctly the base now has support for LZMA compression and the port isn't needed anymore.


----------



## dvl@ (Jul 29, 2013)

For the record:


```
$ ldd -a /usr/local/bin/xsltproc
/usr/local/bin/xsltproc:
        libxslt.so.2 => /usr/local/lib/libxslt.so.2 (0x80081d000)
        libexslt.so.8 => /usr/local/lib/libexslt.so.8 (0x800a57000)
        libgcrypt.so.19 => /usr/local/lib/libgcrypt.so.19 (0x800c6a000)
        libgpg-error.so.0 => /usr/local/lib/libgpg-error.so.0 (0x800ee7000)
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x8010ea000)
        libxml2.so.5 => /usr/local/lib/libxml2.so.5 (0x8012f4000)
        liblzma.so.0 => not found (0)
        libz.so.6 => /lib/libz.so.6 (0x801648000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libm.so.5 => /lib/libm.so.5 (0x801b58000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/local/lib/libxslt.so.2:
        libxml2.so.5 => /usr/local/lib/libxml2.so.5 (0x8012f4000)
        liblzma.so.0 => not found (0)
        libz.so.6 => /lib/libz.so.6 (0x801648000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libm.so.5 => /lib/libm.so.5 (0x801b58000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/local/lib/libexslt.so.8:
        libxslt.so.2 => /usr/local/lib/libxslt.so.2 (0x80081d000)
        libxml2.so.5 => /usr/local/lib/libxml2.so.5 (0x8012f4000)
        liblzma.so.0 => not found (0)
        libz.so.6 => /lib/libz.so.6 (0x801648000)
        libm.so.5 => /lib/libm.so.5 (0x801b58000)
        libgcrypt.so.19 => /usr/local/lib/libgcrypt.so.19 (0x800c6a000)
        libgpg-error.so.0 => /usr/local/lib/libgpg-error.so.0 (0x800ee7000)
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x8010ea000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/local/lib/libgcrypt.so.19:
        libgpg-error.so.0 => /usr/local/lib/libgpg-error.so.0 (0x800ee7000)
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x8010ea000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/local/lib/libgpg-error.so.0:
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x8010ea000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/local/lib/libintl.so.9:
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/local/lib/libxml2.so.5:
        libz.so.6 => /lib/libz.so.6 (0x801648000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x8020cc000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80185c000)
        libm.so.5 => /lib/libm.so.5 (0x801b58000)
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/lib/libz.so.6:
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/local/lib/libiconv.so.3:
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/lib/libm.so.5:
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
/usr/lib/liblzma.so.5:
        libc.so.7 => /lib/libc.so.7 (0x801d79000)
```


----------



## dvl@ (Jul 29, 2013)

SirDice said:
			
		

> I think you need to remove archivers/xz and rebuild everything that depended on it. If I recall correctly the base now has support for LZMA compression and the port isn't needed anymore.



There is no xz installed at present. That's not to say it wasn't installed earlier.  I recall removing that from somewhere, and it might have been here.


----------



## dvl@ (Jul 29, 2013)

wblock@ said:
			
		

> Rebuild textproc/libxslt?  Although it should already have been rebuilt.  Looking for fake library symlinks won't hurt: http://www.wonkity.com/~wblock/fakelib/fastfakelib.



I have rebuilt textproc/libxslt a few times.

I ran that script:


```
reading package contents
checking /usr/local/lib
checking /lib
checking /usr/local/lib/compat/pkg
```


----------



## wblock@ (Jul 29, 2013)

The script might need /usr/lib added, but I'm not sure if a symlink would be the problem.  Although I don't know how else a port would build if a library really is missing.  Assuming you have a locate(1) database built, does it find liblzma.so.0 anywhere?


----------



## kpa (Jul 29, 2013)

FreeBSD 9.2 has liblzma.so.5 not liblzma.so.0. The problem is probably in one or more of the dependencies of textproc/libxslt that is still depending on the 8.4 version of the liblzma library and needs to be rebuilt before textproc/libxslt can be rebuilt properly.


----------



## wblock@ (Jul 29, 2013)

But all the ports have been rebuilt...


----------



## kpa (Jul 29, 2013)

Is the portupgrade command guaranteed to rebuild everything? I don't use it myself so I don't really know what it can do. 

It's very tricky to rebuild everything correctly in one go unless you use a package builder like ports-mgmt/poudriere, that's why even ports-mgmt/portmaster has a rather involved procedure for rebuilding everything.


----------



## wblock@ (Jul 29, 2013)

With -af, yes, it rebuilds everything.  Unless it croaks after it rebuilds Ruby or BDB, which is not a problem with ports-mgmt/portmaster.


----------



## dvl@ (Jul 29, 2013)

wblock@ said:
			
		

> The script might need /usr/lib added, but I'm not sure if a symlink would be the problem.  Although I don't know how else a port would build if a library really is missing.  Assuming you have a locate(1) database built, does it find liblzma.so.0 anywhere?



It does not find it.


----------



## kpa (Jul 29, 2013)

Well it must have missed something. I would just grep(1) for the binary/library that is still depending on the old library and see what package the files belong to:

`grep -lr liblzma.so.0  /usr/local/bin /usr/local/sbin /usr/local/lib /usr/local/libexec`

Edit: Repeat for /bin, /sbin, /usr/bin, /usr/sbin, /usr/lib and /usr/libexec in case it's some weird dependency in the base system that has not been updated properly.


----------



## dvl@ (Jul 29, 2013)

```
$ grep -lr liblzma.so.0 /usr/local/bin /usr/local/sbin /usr/local/lib /usr/local/libexec
/usr/local/bin/xsltproc
/usr/local/bin/lzma
/usr/local/bin/lzcat
/usr/local/bin/unxz
/usr/local/bin/xzcat
/usr/local/bin/unlzma
/usr/local/lib/libexslt.so
/usr/local/lib/libxslt.so.2
/usr/local/lib/libexslt.so.8
/usr/local/lib/liblzma.so
/usr/local/lib/libxslt.so
```


----------



## dvl@ (Jul 29, 2013)

Following on from that, in reverse order of the output:


```
[dan@mysql51:~] $ pkg_info -W /usr/local/lib/libxslt.so
/usr/local/lib/libxslt.so was installed by package libxslt-1.1.28_1
[dan@mysql51:~] $ pkg_info -W /usr/local/lib/liblzma.so
[dan@mysql51:~] $ pkg_info -W /usr/local/lib/libexslt.so.8
/usr/local/lib/libexslt.so.8 was installed by package libxslt-1.1.28_1
[dan@mysql51:~] $ pkg_info -W /usr/local/lib/libxslt.so.2
/usr/local/lib/libxslt.so.2 was installed by package libxslt-1.1.28_1
[dan@mysql51:~] $ pkg_info -W /usr/local/lib/libexslt.so
/usr/local/lib/libexslt.so was installed by package libxslt-1.1.28_1
[dan@mysql51:~] $ pkg_info -W /usr/local/bin/unlzma
[dan@mysql51:~] $ pkg_info -W /usr/local/bin/xzcat
[dan@mysql51:~] $ pkg_info -W /usr/local/bin/unxz
[dan@mysql51:~] $ pkg_info -W /usr/local/bin/lzcat
[dan@mysql51:~] $ pkg_info -W /usr/local/bin/lzma
[dan@mysql51:~] $ pkg_info -W /usr/local/bin/xsltproc
/usr/local/bin/xsltproc was installed by package libxslt-1.1.28_1
[dan@mysql51:~] $
```


----------



## wblock@ (Jul 29, 2013)

Wait, you just said it didn't find it, but there it is!  Use `pkg_info -W /usr/local/lib/liblzma.so` to see where that file came from.  I'll bet it's an orphan that got copied over but should not have been.


----------



## wblock@ (Jul 29, 2013)

Simulpost... Yes, it looks like usr/local/lib/liblzma.so should not be there.  It's not part of a package.


----------



## dvl@ (Jul 29, 2013)

I said it didn't find `liblzma.so.0`


```
$ locate liblzma.so.0
$ locate liblzma.so
/usr/local/lib/liblzma.so
$
```


----------



## dvl@ (Jul 29, 2013)

wblock@ said:
			
		

> Simulpost... Yes, it looks like usr/local/lib/liblzma.so should not be there.  It's not part of a package.



Agreed, but I think there are a number of such entries in there.


----------



## dvl@ (Jul 29, 2013)

wblock@ said:
			
		

> The script might need /usr/lib added, but I'm not sure if a symlink would be the problem.



I just added that, and ran it again:


```
$ ./fastfakelib
reading package contents
checking /usr/local/lib
checking /lib
checking /usr/local/lib/compat/pkg
checking /usr/lib
```


----------



## kpa (Jul 29, 2013)

Delete the /usr/local/lib/liblzma.so file and the related soft links. Your ports should build fine after that.


----------



## dvl@ (Jul 29, 2013)

kpa said:
			
		

> Delete the /usr/local/lib/liblzma.so file and the related soft links. Your ports should build fine after that.



FYI, I removed these items from /usr/local/lib:


```
liblzma.so
lzcat
lzma
unlzma
unxz
xzcat
```

Then I deleted libxslt and xmlto, then rebuilt git, which was successful.

FYI, I have another jail with the same problem.  I'm about to try fix it too.


----------



## wblock@ (Jul 29, 2013)

I think this will work: `find -s /usr/local/lib -depth 1 -prune -name "*.so" -exec pkg_info -W {} \; | grep -Hv package`.


----------



## dvl@ (Jul 29, 2013)

I just fixed the other jail using the same method.


----------



## dvl@ (Jul 29, 2013)

wblock@ said:
			
		

> I think this will work: `find -s /usr/local/lib -depth 1 -prune -name "*.so" -exec pkg_info -W {} \; | grep -Hv package`.



Sorry, I'd already fixed both broken jails before I saw this.

I tested the script by creating a file in /usr/local/lib but the script still didn't output anything.


----------



## wblock@ (Jul 29, 2013)

Doh.  Well, this sort of works: `find /usr/local/lib -depth 1 -prune -name "libFLAC*" -print -exec pkg_info -W {} \;`

Have to look for entries that have a filename that is not followed by saying what package it was from.


----------



## dvl@ (Oct 29, 2013)

FWIW, I encountered this problem again today, searched for it, and found this.


----------

