问题
Not having well knowledge on dealing with C++ projects, I have downloaded the source code of Inkscape from its GitLab repository and made few changes (adding small feature) and tried to compile based on the instruction provided in INSTALL.md and other sources available on their website.
While it seems I have all the dependencies installed on the system, I get this result after running cmake in build folder:
------------------------------
Building Makefile for Inkscape
------------------------------
Source Dir: /home/user/myProgs/inkscape
Binary Dir: /home/user/myProgs/inkscape/build
-- Creating build files in: /home/user/myProgs/inkscape/build
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found GTest: /usr/lib/libgtest.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for modules 'harfbuzz;pangocairo;pangoft2;fontconfig;gsl;gmodule-2.0;libsoup-2.4>=2.42'
--
CMake Error at /usr/share/cmake-3.7/Modules/FindPkgConfig.cmake:415 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.7/Modules/FindPkgConfig.cmake:588 (_pkg_check_modules_internal)
CMakeScripts/DefineDependsandFlags.cmake:42 (pkg_check_modules)
CMakeLists.txt:136 (include)
-- Configuring incomplete, errors occurred!
See also "/home/user/myProgs/inkscape/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/myProgs/inkscape/build/CMakeFiles/CMakeError.log".
The relevant lines in DefineDependsandFlags.cmake:42 are:
pkg_check_modules(INKSCAPE_DEP REQUIRED
harfbuzz
pangocairo
pangoft2
fontconfig
gsl
gmodule-2.0
libsoup-2.4>=2.42)
As far as I checked, all these packages are already installed on my system.
Here is the content of CMakeError.log in which these lines might gives some clue:
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_d21be.dir/CheckFunctionExists.c.o -o cmTC_d21be -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_d21be.dir/build.make:97: recipe for target 'cmTC_d21be' failed
make[1]: *** [cmTC_d21be] Error 1
make[1]: Leaving directory '/home/user/myProgs/inkscape/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_d21be/fast' failed
make: *** [cmTC_d21be/fast] Error 2
I couldn't find any help from searching in Internet.
Any help would be appreciated.
I have tried compilation on both Kubuntu 17.04 and Ubuntu 16.04 LTS
回答1:
There are some missing dependencies you need to install in order to compile the source code. According to your cmake results:
A required package was not found
The easiest way in Ubuntu (Kubuntu tested) is to install Inkscape development packages from the ppa repository. Type the following command in terminal then hit Enter:
sudo add-apt-repository ppa:inkscape.dev/trunk
After that you need to enable source code repository. Try to uncomment deb-src
line. (Remove # from the beginning):
sudo vim /etc/apt/sources.list.d/inkscape_dev-ubuntu-trunk-zesty.list
- Note that you can use your favorite text editor instead of vim.
Now update the list of packages using sudo apt update
. Next you're ready to install the development packages:
sudo apt build-dep inkscape-trunk
Now it's all set to compile and run ;)
来源:https://stackoverflow.com/questions/46124197/error-while-compiling-inkscape-from-source-code