ubuntu安装zlib库_如何在Ubuntu中安装zlib库?

ubuntu安装zlib库

On Ubuntu (18.04), installing zlib reported unable to locate package zlib:

在Ubuntu(18.04)上,安装zlib报告无法找到软件包zlib:

$ sudoapt install zlib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package zlib

How to install zlib in Ubuntu?

如何在Ubuntu中安装zlib?



In Ubuntu, the zlib package is zlib1g.

在Ubuntu中,zlib软件包是zlib1g

$ sudo apt show zlib1g
Package: zlib1g
Version: 1:1.2.11.dfsg-0ubuntu2
Priority: required
Section: libs
Source: zlib
Origin: Ubuntu
Maintainer: Ubuntu Developers 
Original-Maintainer: Mark Brown 
Bugs:https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 173 kB
Provides: libz1
Depends: libc6 (>= 2.14)
Conflicts: zlib1 (<= 1:1.0.4-7)
Breaks: libxml2 (<< 2.7.6.dfsg-2), texlive-binaries (<< 2009-12)
Homepage: http://zlib.net/
Task: minimal
Supported: 5y
Download-Size: 56.5 kB
APT-Manual-Installed: yes
APT-Sources: http://hk.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Description: compression library - runtime
 zlib is a library implementing the deflate compression method found
 in gzip and PKZIP.  This package includes the shared library.

You may install them by

您可以通过以下方式安装它们

$ sudo apt install zlib1g

If you would install the development package:

如果要安装开发包:

$ sudo apt install zlib1g-dev


And if you would link against zlib in your program, add -lz to the gcc or g++ commands.

如果要在程序中链接到zlib,请将-lz添加到gccg++命令中。



Download Zlib by using the following command :
wget http://www.zlib.net/zlib-1.2.3.tar.gz
Extract the file from the downloaded package:
tar -xvzf zlib-1.2.3.tar.gz
Enter the directory where the package is extracted:
cd zlib-1.2.3
Now configure Zlib directory:
./configure –prefix=/usr/local/zlib
Replace "/usr/local/zlib" above with the directory path where you want to copy the files and folders. Check whether you get any error message. Compile and install Zlib. If you are root run the following:
sudo make install
Library has bee successfully installed.

使用以下命令下载Zlib:
wget http://www.zlib.net/zlib-1.2.3.tar.gz
从下载的包中提取文件:
tar -xvzf zlib-1.2.3.tar.gz
输入提取软件包的目录:
光盘zlib-1.2.3
现在配置Zlib目录:
./configure –prefix = / usr / local / zlib
将上面的“ / usr / local / zlib”替换为要在其中复制文件和文件夹的目录路径。 检查是否收到任何错误消息。 编译并安装Zlib。 如果您是root用户,请运行以下命令:
须藤使安装
库已成功安装。

翻译自: https://www.systutorials.com/how-to-install-the-zlib-library-in-ubuntu/

ubuntu安装zlib库

你可能感兴趣的:(ubuntu安装zlib库_如何在Ubuntu中安装zlib库?)