libiconv 1.16 unable to remove

Driesp

Verified User
Joined
Mar 12, 2007
Messages
165
Location
Belgium
Hi

I wanted to update PHP8 but was unable because of the old library libiconv 1.16.

There are more threads to find on this forum, but none are very clear on how to proceed without downtime.
I want to delete libiconv 1.16 and move over to the system provided libiconv library 2.28
I am running rocky 8.

I have systems running with Libiconv 1.16 installed with custombuild, and some systems running without it, using the system provided libiconv library 2.28.

I have managed to compile PHP8x by renaming the header and binary file of libiconv by doing so:
mv /usr/local/include/iconv.h /usr/local/include/iconv.h-
mv /usr/local/bin/iconv /usr/local/bin/iconv-
./build imagemagick
./build php
./build exim
./build dovecot
./build httpd
./build proftpd

Everything seems to work,
but I notice PHP is still using the old libiconv library even it is compiled with version 2.28.
Code:
[custombuild]# lsof /usr/local/lib/libiconv.so.2.6.1
COMMAND      PID       USER  FD   TYPE DEVICE SIZE/OFF   NODE NAME
rngd         962     daemon mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm82 408755       root mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm81 408780       root mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm80 408804       root mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm74 408829       root mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm81 414498    webapps mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
proftpd   427468        ftp mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm81 427998    webapps mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm81 429639    webapps mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
named     432413      named mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm80 433203       lyra mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm80 433315     berton mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm80 433317     berton mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm74 433392   chinboek mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm82 433395       viet mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm82 433399       viet mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm82 433402    webapps mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm80 433404     cdlweb mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm74 433405 yonahkrank mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm74 433407 yonahkrank mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1
php-fpm80 433409   storanza mem    REG  202,3  1740680 998164 /usr/local/lib/libiconv.so.2.6.1

Even the system provided packages rngd and named are using the old libiconv library.
If I remove the library /usr/local/lib/libiconv.so.2.6.1, many things break, I am unable to do so.

Can anyone point me in the right direction on how to remove /usr/local/lib/libiconv.so.2.6.1 without breaking my system?

Kind regards
Dries
 
I tried this as well:

Code:
[custombuild]# mv /usr/local/lib/libiconv.la /root
[custombuild]# mv /usr/local/lib/libiconv.so.2.6.1 /root
[custombuild]# ldconfig -v | grep libi
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: Path `/usr/lib' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: Path `/usr/lib64' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: Can't stat /usr/libx32: No such file or directory
ldconfig: Cannot stat /usr/local/lib/libcurl.so: No such file or directory
        libisc-export.so.1107 -> libisc-export.so.1107.0.7
        libisccfg-export.so.163 -> libisccfg-export.so.163.0.8
        libirs-export.so.161 -> libirs-export.so.161.0.1
ldconfig: Cannot stat /usr/local/lib/libiconv.so.2: No such file or directory
ldconfig: Cannot stat /usr/local/lib/libiconv.so: No such file or directory
ldconfig: Cannot stat /lib/libidn.so: No such file or directory
ldconfig: Cannot stat /lib/libiconv.so.2: No such file or directory
ldconfig: Cannot stat /lib/libltdl.so: No such file or directory
        libipset.so.13 -> libipset.so.13.1.0
        libisl.so.15 -> libisl.so.15.1.1
        libisl.so.13 -> libisl.so.13.1.0
        libicuuc.so.60 -> libicuuc.so.60.3
        libicutu.so.60 -> libicutu.so.60.3
        libicutest.so.60 -> libicutest.so.60.3
        libicuio.so.60 -> libicuio.so.60.3
        libicui18n.so.60 -> libicui18n.so.60.3
        libicudata.so.60 -> libicudata.so.60.3
        libisccc.so.161 -> libisccc.so.161.0.1
        libisccfg.so.163 -> libisccfg.so.163.0.8
        libimaevm.so.2 -> libimaevm.so.2.0.0
        libirs.so.161 -> libirs.so.161.0.1
        libibverbs.so.1 -> libibverbs.so.1.14.44.0
        libini_config.so.5 -> libini_config.so.5.2.1
        libisc.so.1107 -> libisc.so.1107.0.7
        libiptc.so.0 -> libiptc.so.0.0.0
        libip6tc.so.2 -> libip6tc.so.2.0.0
        libip6tc.so.0 -> libip6tc.so.0.1.0
        libip4tc.so.2 -> libip4tc.so.2.0.0
        libip4tc.so.0 -> libip4tc.so.0.1.0
        libidn2.so.0 -> libidn2.so.0.3.6
[custombuild]# yum update
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: libiconv.so.2: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/yum", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 29, in <module>
    import libdnf.transaction
  File "/usr/lib64/python3.6/site-packages/libdnf/__init__.py", line 8, in <module>
    from . import error
  File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 17, in <module>
    _error = swig_import_helper()
  File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 16, in swig_import_helper
    return importlib.import_module('_error')
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_error'
 
You probably have old libraries and headers in /usr/local that the compiler is finding and linking to.

Rename your /usr/local/lib and /usr/local/include to something else and then try recompiling

mv /usr/local/lib /usr/local/lib.old
mv /usr/local/include /usr/local/include.old


Then try rebuilding PHP.
 
Please don't do what sparek proposes, I am sure it will break your system.

Still I don't know how to remove the old libiconv libraries.
I am thinking maybe it is not possible because I am getting no reaction on this.

Kr
Dries
 
Hi @Driesp, we are working on a solution to allow old systems gracefully migrate away from the custom packages in /usr/local.

For iconv the best way forward would be to remove only iconv header files. However keep dynamic library `libiconv.so` for the time being. This prevents new software from finding and using custom iconv, but allowing old apps linked against it to continue using it.

In alpha relase channel we have updated PHP compilation code stop stop trying to find and use iconv and icu from /usr/local. This would allow you to rebuild PHP using system libraries.

You can test it out with:

Code:
rm -f /usr/local/include/{libcharset.h,localcharset.h,iconv.h}
da config-set update_channel alpha
da update
da build php
da build exim
 
Back
Top