Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compile and install Mapnik Mapnik under CentOS7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to compile and install Mapnik Mapnik under CentOS7, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Summary of problems encountered in InstallationTroubleshooting compilation and installation

Git clone https://github.com/mapnik/mapnik.git

Install the necessary dependencies

Yum install boost-devel postgresql-devel proj-devel proj-epsg

Expand the required dependencies

Yum install sqlite-devel libpng-devel libtiff-devel libjpeg-devel libicu-devel

When compiling, the official requirement is at least 5GB (for gaming +) memory. For users with small memory (I only had 2G at that time), they may exit abnormally due to insufficient memory, if the following occurs:

Internal compiler error: Killed (program cc1plus)

We can temporarily increase disk swap space to solve this problem.

Sudo dd if=/dev/zero of=/swapfile bs=64M count=16 sudo mkswap / swapfile sudo swapon / swapfile

Then, after the compilation is complete, after returning to the previous state,

Sudo swapoff / swapfile sudo rm / swapfile

Start compilation

. / configure make make install

There will be errors such as:

Compile the harfbuzz and refer to the following changes

Harfbuzz not found

$brew install harfbuzz...$. / configure...Checking for C++ library harfbuzz... NoCould not find required header or shared library for harfbuzz...Exiting... The following required dependencies were not found:-harfbuzz (HarfBuzz text shaping library | configure with HB_LIBS & HB_INCLUDES)

Solution: HB_LIBS and HB_INCLUDES are directories, not cflags/ldflags, and HB_INCLUDES needs not to include the "harfbuzz" directory itself. If pkg-config says:

$pkg-config-libs-cflags harfbuzz-I/usr/local/Cellar/harfbuzz/0.9.35_1/include/harfbuzz-L/usr/local/Cellar/harfbuzz/0.9.35_1/lib-lharfbuzz

What you actually need is modifies the configuration file to specify HB_LIBS,HB_INCLUDES directly

$. / configure HB_LIBS=/usr/local/Cellar/harfbuzz/0.9.35_1/lib HB_INCLUDES=/usr/local/Cellar/harfbuzz/0.9.35_1/include

Simple test

Python import mapnik

If a similar error occurs

ImportError: libmapnik.so.3.0: cannot open shared object file: No such file or directory

You need to manually add the location of the so

Vim / etc/ld.so.conf.d/mapnik-x86_64.conf

Add one line: / usr/local/lib

Then save the exit and execute at the same time

Ldconfig

If there is no problem, you can try to render demo, which will generate some picture demo files with different qualities and formats.

Python demo/python/rundemo.py above is all the contents of the article "how to compile and install Mapnik Mapnik under CentOS7". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report