如何在Linux Mint上正确编译Synergy?

时间:2018-04-21 15:20:34

标签: compiler-errors cmake linuxmint

我已尝试按照documentation中详述的说明操作。但是,每次我使用Make时,都会收到此错误:

CMake Warning at cmake/Version.cmake:27 (message):
  Synergy version wasn't set.  Set to 2.0.0
Call Stack (most recent call first):
  CMakeLists.txt:48 (include)


-- Full Synergy version string is '2.0.0-snapshot.b1-1cf3baed'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sszebrat/synergy-core/build
[  2%] Built target common
[ 13%] Built target arch
[ 22%] Built target base
[ 24%] Built target shared
[ 27%] Built target io
[ 30%] Built target mt
[ 36%] Built target net
[ 46%] Built target server
[ 54%] Built target platform
[ 55%] Built target client
[ 79%] Built target core
[ 80%] Built target synergy-core
[ 81%] Built target synergyc
[ 82%] Built target synergys
[ 83%] Built target gmock
[ 84%] Built target gtest
[ 85%] Linking CXX executable ../../../bin/integtests
../../lib/arch/libarch.a(ArchInternetUnix.cpp.o): In function `CurlFacade::CurlFacade()':
ArchInternetUnix.cpp:(.text+0x191): undefined reference to `curl_global_init'
ArchInternetUnix.cpp:(.text+0x212): undefined reference to `curl_easy_init'
../../lib/arch/libarch.a(ArchInternetUnix.cpp.o): In function `CurlFacade::~CurlFacade()':
ArchInternetUnix.cpp:(.text+0x34b): undefined reference to `curl_easy_cleanup'
ArchInternetUnix.cpp:(.text+0x350): undefined reference to `curl_global_cleanup'
../../lib/arch/libarch.a(ArchInternetUnix.cpp.o): In function `CurlFacade::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
ArchInternetUnix.cpp:(.text+0x3b4): undefined reference to `curl_easy_setopt'
ArchInternetUnix.cpp:(.text+0x3d7): undefined reference to `curl_easy_setopt'
ArchInternetUnix.cpp:(.text+0x47a): undefined reference to `curl_easy_setopt'
ArchInternetUnix.cpp:(.text+0x4bb): undefined reference to `curl_easy_setopt'
ArchInternetUnix.cpp:(.text+0x4cd): undefined reference to `curl_easy_perform'
ArchInternetUnix.cpp:(.text+0x4ed): undefined reference to `curl_easy_strerror'
../../lib/arch/libarch.a(ArchInternetUnix.cpp.o): In function `CurlFacade::urlEncode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
ArchInternetUnix.cpp:(.text+0x69a): undefined reference to `curl_easy_escape'
ArchInternetUnix.cpp:(.text+0x753): undefined reference to `curl_free'
collect2: error: ld returned 1 exit status
src/test/integtests/CMakeFiles/integtests.dir/build.make:299: recipe for target 'bin/integtests' failed
make[2]: *** [bin/integtests] Error 1
CMakeFiles/Makefile2:1089: recipe for target 'src/test/integtests/CMakeFiles/integtests.dir/all' failed
make[1]: *** [src/test/integtests/CMakeFiles/integtests.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

我尝试通过将此行添加到Cmakelists.txt来修复它:

link_libraries(libcurl)

但这只会导致不同的错误:

[  2%] Built target common
[ 13%] Built target arch
[ 22%] Built target base
[ 24%] Built target shared
[ 27%] Built target io
[ 30%] Built target mt
[ 36%] Built target net
[ 46%] Built target server
[ 54%] Built target platform
[ 55%] Built target client
[ 79%] Built target core
[ 80%] Linking CXX executable ../../../bin/synergy-core
/usr/bin/ld: cannot find -llibcurl
collect2: error: ld returned 1 exit status
src/cmd/core/CMakeFiles/synergy-core.dir/build.make:115: recipe for target 'bin/synergy-core' failed
make[2]: *** [bin/synergy-core] Error 1
CMakeFiles/Makefile2:802: recipe for target 'src/cmd/core/CMakeFiles/synergy-core.dir/all' failed
make[1]: *** [src/cmd/core/CMakeFiles/synergy-core.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

有没有人知道如何修复此错误并编译协同效应?

1 个答案:

答案 0 :(得分:0)

你缺少libcurl库,尝试用​​apt-get install libcurl4-gnutls-dev安装它然后你应该能够编译项目

/usr/bin/ld: cannot find -llibcurl

CMake无法在您的系统上找到该库。 Linux下的库通常安装在系统下,而不是安装在像windows这样的项目中。