(QNAP NAS)Linux – 安装pycurl(找不到libcurl.a)

我试图在我的NAS(QNAP TS-459)上安装Pycurl,并且出现错误“libcurl.a:没有这样的文件或目录”。 这里是从控制台的日志:

[admin@MYSERVER pycurl-7.19.0]# uname -mrs Linux 2.6.33.2 i686 ipkg status | grep curl Depends: zlib, openssl, libcurl, diffutils, rcs, expat Package: libcurl Package: libcurl-dev Depends: libcurl Package: py26-curl Depends: python26, libcurl (>=7.19.0), openssl Depends: libcurl, libxml2, openssl, zlib python setup.py install ldd /usr/lib/libcurl.soobjdump -Tlddobjdump -T/usr/lib/libcurl.sosodumpls /usr/lib/libcurl.soequery belongscho LD_LIBRARY_PATH$LD_LIBRARY_PATH$ls -la /usr/local/lib/libcurl*echo $LIBCURL_IPK_DIRwhich libcurllocatepython setup.py install Using curl-config (libcurl 7.24.0) running install running build running build_py running build_ext building 'pycurl' extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/opt/include -I/share/MD0_DATA/.qpkg/Python/include/python2.7 -c src/pycurl.c -o build/temp.linux-i686-2.7/src/pycurl.o gcc -pthread -shared build/temp.linux-i686-2.7/src/pycurl.o -L/opt/lib -L/home/slug/optware/ts509/staging/opt/lib -L/home/slug/optware/ts509/staging/lib -L/home/slug/optware/ts509/staging/lib -L/home/slug/optware/ts509/staging/opt/lib -L/home/slug/optware/ts509/staging/lib -L/home/slug/optware/ts509/staging/lib -lcurl -lssl -lssl -lssl -lcrypto -lrt -lz -o build/lib.linux-i686-2.7/pycurl.so -Wl,-rpath,/opt/lib -Wl,-rpath-link,/home/slug/optware/ts509/staging/opt/lib /opt/lib/libcurl.a -Wl,-rpath,/opt/lib -Wl,-rpath-link,/home/slug/optware/ts509/staging/opt/lib gcc: /opt/lib/libcurl.a: No such file or directory error: command 'gcc' failed with exit status 1 [admin@MYSERVER pycurl-7.19.0]# ls /opt/lib lib/ libexec/ [admin@MYSERVER pycurl-7.19.0]# ls /opt/lib/libcu* /opt/lib/libcurl.so /opt/lib/libcurl.so.4.2.0 /opt/lib/libcurl.so.4 [admin@MYSERVER pycurl-7.19.0]# 

任何想法如何解决问题? 谢谢!

今天我在Synology NAS上遇到同样的问题。 问题是curl-config --libscurl-config --libs curl-config --static-libs返回一些输出。 所以,pycurl试图编译静态和共享库。 但是libcurl包没有静态库。 所以,我用下面的方法解决了这个问题:

如果curl-config --built-shared返回yes则不要运行curl-config --static-libs

这是补丁:

 diff --git a/setup.py b/setup.py index 1c3831b..69bc8b8 100644 --- a/setup.py +++ b/setup.py @@ -96,9 +96,13 @@ else: include_dirs.append(e[2:]) else: extra_compile_args.append(e) - libs = split_quoted( - os.popen("'%s' --libs" % CURL_CONFIG).read()+\ - os.popen("'%s' --static-libs" % CURL_CONFIG).read()) + libs = os.popen("'%s' --libs" % CURL_CONFIG).read() + is_libcurl_shared = os.popen("'%s' --built-shared" % CURL_CONFIG).read() + is_libcurl_shared = string.strip(is_libcurl_shared) + if is_libcurl_shared != 'yes': + libs = libs + \ + os.popen("'%s' --static-libs" % CURL_CONFIG).read() + libs = split_quoted(libs) for e in libs: if e[:2] == "-l": libraries.append(e[2:]) 

适用于v7.19.0。 或者从这里取最后一个版本的setup.py