Installation and use of libiconv library under Linux cannot find -liconv

1. Download

wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz

2. Compile and install libiconv library

tar zxvf libiconv-1.16.tar.gz I manually double-click to decompress

cd libiconv-1.16

./configure --prefix=/home/lgl/Desktop/test/out

make

make install 

3. In the /home/lgl/Desktop/test/out/lib/ directory, copy the required library files libcharset.so.1 and libiconv.so.2.

cd /home/lgl/Desktop/test/out

copy

sudo cp -f libcharset.so.1 /usr/lib

sudo cp -f libiconv.so.2 /usr/lib

If the permissions are not enough, you must add sudo

Link the library under /usr/lib/libiconv.so.2 to /usr/lib/libiconv.so

ln -s /usr/lib/libiconv.so.2 /usr/lib/libiconv.so

4. Still prompt cannot find -liconv

#!/bin/sh
echo "begin"
gcc -static -o mtserver mtsocket.c current.c  ini.c dcmscomm.c public.c sqlite3.c cjson.c config.c db.c dbcd.c dcms01dev.c power.c common.c mtserver.c  -lm -liconv -lrt -ldl -lpthread
echo "cp to nfs .."
cp mtserver ../../nfs
echo "end"

 Just delete -static.

 

Guess you like

Origin blog.csdn.net/chenhao0568/article/details/105256552