Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rpm: /lib64/liblzma.so.5: version `XZ_5.1.2alpha' not found (required by /lib/librpmio.so.3)

Tags:

rpm

rhel

I am stuck with this error. Not able to install any RPMs. Please help

OS is RHEL6.9 64 bit

Thanks in advance.

like image 465
Sachin Aravind Avatar asked Dec 04 '17 12:12

Sachin Aravind


2 Answers

This happens when you download and install xz from sources on a RHEL (or CentOS) 7 system. The problem is that the XZ_5.1.2alpha label is not present in the released versions of xz, but it is present in the version RedHat ships and compiles against.

A small patch to the xz sources will fix the problem:

https://github.com/easybuilders/easybuild-easyconfigs/issues/4036

The patch is small enough to copy&paste here. I have used it on xz-5.2.4 successfully.

--- src/liblzma/liblzma.map.orig    2015-09-29 12:57:36.000000000 +0200
+++ src/liblzma/liblzma.map 2017-02-22 11:10:33.432868185 +0100
@@ -95,7 +95,13 @@
    lzma_vli_size;
 };
 
-XZ_5.2 {
+XZ_5.1.2alpha {
+global:
+   lzma_stream_encoder_mt;
+   lzma_stream_encoder_mt_memusage;
+} XZ_5.0;
+
+XZ_5.2.2 {
 global:
    lzma_block_uncomp_encode;
    lzma_cputhreads;
@@ -105,4 +111,4 @@
 
 local:
    *;
-} XZ_5.0;
+} XZ_5.1.2alpha;

(update)

If you try to use this .so on CentOS 8, you will get unresolved symbols for XZ_5.2 (e.g. librpmio.so.8 wants lzma_stream_encoder_mt@XZ_5.2).

Here is a revised patch to create an liblzma.so.5 library that will work on both CentOS 7 and 8:

diff -u -r xz-5.2.5/src/liblzma/common/stream_encoder_mt.c xz-5.2.5-rhel7/src/liblzma/common/stream_encoder_mt.c
--- xz-5.2.5/src/liblzma/common/stream_encoder_mt.c 2020-03-17 07:28:50.000000000 -0700
+++ xz-5.2.5-rhel7/src/liblzma/common/stream_encoder_mt.c   2021-12-06 16:18:14.976457229 -0800
@@ -1141,3 +1141,9 @@
 
    return total_memusage + outq_memusage;
 }
+
+/* http://peeterjoot.com/2019/09/20/an-example-of-linux-glibc-symbol-versioning/ */
+__asm__(".symver lzma_stream_encoder_mt,lzma_stream_encoder_mt@XZ_5.1.2alpha");
+__asm__(".symver lzma_stream_encoder_mt,lzma_stream_encoder_mt@@XZ_5.2");
+__asm__(".symver lzma_stream_encoder_mt_memusage,lzma_stream_encoder_mt_memusage@XZ_5.1.2alpha");
+__asm__(".symver lzma_stream_encoder_mt_memusage,lzma_stream_encoder_mt_memusage@@XZ_5.2");
diff -u -r xz-5.2.5/src/liblzma/liblzma.map xz-5.2.5-rhel7/src/liblzma/liblzma.map
--- xz-5.2.5/src/liblzma/liblzma.map    2020-03-17 07:28:54.000000000 -0700
+++ xz-5.2.5-rhel7/src/liblzma/liblzma.map  2021-12-06 15:48:05.650672828 -0800
@@ -95,6 +95,12 @@
    lzma_vli_size;
 };
 
+XZ_5.1.2alpha {
+global:
+   lzma_stream_encoder_mt;
+   lzma_stream_encoder_mt_memusage;
+} XZ_5.0;
+
 XZ_5.2 {
 global:
    lzma_block_uncomp_encode;
@@ -105,4 +111,4 @@
 
 local:
    *;
-} XZ_5.0;
+} XZ_5.1.2alpha;
like image 190
Nemo Avatar answered Sep 22 '22 05:09

Nemo


I was stuck with similar problem since Nov 27, 2017 when I installed XZ Utils 5.2.3 from sources on CentOS 7.4 and copied liblzma.so.5.2.3 from /usr/local/lib/ to /lib64/.

Cause of this problem is library librpmio.so.3 which requires symbol XZ_5.1.2alpha to be defined in lzma shared library. liblzma.so.5.2.2 defines this symbol but liblzma.so.5.2.3 doesn't.

Without XZ update the most recent version of lzma library was 5.2.2 and I had symbolic link /lib64/liblzma.so.5 -> /lib64/liblzma.so.5.2.2. After copying liblzma.so.5.2.3 and some further updates the link was changed to the most recent file i.e. /lib64/liblzma.so.5 -> /lib64/liblzma.so.5.2.3. And that broke rpm and yum commands. So, solution is:

  1. Link /lib64/liblzma.so.5 back to /lib64/liblzma.so.5.2.2:

    cd /lib64
    sudo ln -s -f liblzma.so.5.2.2 liblzma.so.5
    
  2. Delete file /lib64/liblzma.so.5.2.3

Second possible cause might be environment variable LD_LIBRARY_PATH. Check if it contains unwanted paths and clear it.

like image 40
ForumsReg Avatar answered Sep 22 '22 05:09

ForumsReg