linux - Ubuntu/usr/bin/ld : cannot find -lsasl2 while installing monary

标签 linux gcc monary

我正在尝试安装 monary ,并出现以下错误:

x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/monary/cmonary.o -L/usr/local/lib -L/usr/local/lib -lbson-1.0 -lcrypto -lssl -lsasl2 -lmongoc-1.0 -o build/lib.linux-x86_64-2.7/monary/libcmonary.so
/usr/bin/ld: cannot find -lsasl2
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

我看了usr-bin-ld-cannot-find-lz ,但仍然不知道哪个包是 lsasl2 的一部分? (这样我就可以 sudo apt-get 了)

此外,ld 不是作为目录的 /usr/bin/ 的一部分。它是一个 linux x86 可执行文件。我应该如何解决这个问题?

我使用 16.04.4 LTS xenial Ubuntu。 完整报错及执行如下图:

  Collecting monary
  Downloading https://files.pythonhosted.org/packages/35/b6/230a3ec114337e324f372106b83a88efe2043f9adda551292ff57cc1262d/Monary-0.5.0.tar.gz
Requirement already satisfied: pymongo in /usr/local/lib/python2.7/dist-packages (from monary) (3.6.1)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from monary) (1.14.1)
Installing collected packages: monary
  Running setup.py install for monary ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-nyaKSj/monary/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-7Lj0Ng/install-record.txt --single-version-externally-managed --compile:
    /tmp/pip-install-nyaKSj/monary/setup.py:90: UserWarning: WARNING: the python package pkgconfig is not installed. If you have pkg-config installed on your system, please install the python's pkgconfig, e.g. "pip install pkgconfig". Will use libmongoc=/usr/local and libbson=/usr/local instead.
      % (mongoc_src, bson_src)))
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/monary
    copying monary/monary.py -> build/lib.linux-x86_64-2.7/monary
    copying monary/ordereddict.py -> build/lib.linux-x86_64-2.7/monary
    copying monary/write_concern.py -> build/lib.linux-x86_64-2.7/monary
    copying monary/__init__.py -> build/lib.linux-x86_64-2.7/monary
    copying monary/datehelper.py -> build/lib.linux-x86_64-2.7/monary
    copying monary/monary_param.py -> build/lib.linux-x86_64-2.7/monary
    running build_ext
    building 'monary.libcmonary' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/monary
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -I/usr/include/python2.7 -c monary/cmonary.c -o build/temp.linux-x86_64-2.7/monary/cmonary.o -fPIC -O2 -DNDEBUG
    monary/cmonary.c: In function ‘monary_init_query’:
    monary/cmonary.c:910:5: warning: ‘mongoc_collection_find’ is deprecated: Use mongoc_collection_find_with_opts instead [-Wdeprecated-declarations]
         mcursor = mongoc_collection_find(collection,
         ^
    In file included from /usr/local/include/libmongoc-1.0/mongoc-client.h:28:0,
                     from /usr/local/include/libmongoc-1.0/mongoc.h:29,
                     from monary/cmonary.c:8:
    /usr/local/include/libmongoc-1.0/mongoc-collection.h:155:1: note: declared here
     mongoc_collection_find (mongoc_collection_t *collection,
     ^
    monary/cmonary.c: In function ‘monary_load_query’:
    monary/cmonary.c:1018:9: warning: variable ‘total_values’ set but not used [-Wunused-but-set-variable]
         int total_values;
             ^
    monary/cmonary.c: In function ‘monary_create_write_concern’:
    monary/cmonary.c:1100:5: warning: ‘mongoc_write_concern_set_fsync’ is deprecated [-Wdeprecated-declarations]
         mongoc_write_concern_set_fsync(write_concern, write_concern_fsync);
         ^
    In file included from /usr/local/include/libmongoc-1.0/mongoc-bulk-operation.h:25:0,
                     from /usr/local/include/libmongoc-1.0/mongoc.h:27,
                     from monary/cmonary.c:8:
    /usr/local/include/libmongoc-1.0/mongoc-write-concern.h:51:1: note: declared here
     mongoc_write_concern_set_fsync (mongoc_write_concern_t *write_concern,
     ^
    monary/cmonary.c: In function ‘monary_insert’:
    monary/cmonary.c:1398:5: warning: ‘mongoc_collection_create_bulk_operation’ is deprecated: Use mongoc_collection_create_bulk_operation_with_opts instead [-Wdeprecated-declarations]
         bulk_op = mongoc_collection_create_bulk_operation(collection, false,
         ^
    In file included from /usr/local/include/libmongoc-1.0/mongoc-client.h:28:0,
                     from /usr/local/include/libmongoc-1.0/mongoc.h:29,
                     from monary/cmonary.c:8:
    /usr/local/include/libmongoc-1.0/mongoc-collection.h:296:1: note: declared here
     mongoc_collection_create_bulk_operation (
     ^
    monary/cmonary.c:1406:5: warning: ‘mongoc_client_get_max_message_size’ is deprecated [-Wdeprecated-declarations]
         max_message_size = mongoc_client_get_max_message_size(client);
         ^
    In file included from /usr/local/include/libmongoc-1.0/mongoc.h:29:0,
                     from monary/cmonary.c:8:
    /usr/local/include/libmongoc-1.0/mongoc-client.h:212:1: note: declared here
     mongoc_client_get_max_message_size (mongoc_client_t *client)
     ^
    monary/cmonary.c:1489:13: warning: ‘mongoc_collection_create_bulk_operation’ is deprecated: Use mongoc_collection_create_bulk_operation_with_opts instead [-Wdeprecated-declarations]
                 bulk_op = mongoc_collection_create_bulk_operation(collection,
                 ^
    In file included from /usr/local/include/libmongoc-1.0/mongoc-client.h:28:0,
                     from /usr/local/include/libmongoc-1.0/mongoc.h:29,
                     from monary/cmonary.c:8:
    /usr/local/include/libmongoc-1.0/mongoc-collection.h:296:1: note: declared here
     mongoc_collection_create_bulk_operation (
     ^
    monary/cmonary.c:1374:11: warning: unused variable ‘str’ [-Wunused-variable]
         char *str;
               ^
    monary/cmonary.c:1368:25: warning: unused variable ‘citem’ [-Wunused-variable]
         monary_column_item *citem;
                             ^
    monary/cmonary.c:1430:13: warning: ‘storage’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                 bson_oid_init_from_data(&oid,
                 ^
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/monary/cmonary.o -L/usr/local/lib -L/usr/local/lib -lbson-1.0 -lcrypto -lssl -lsasl2 -lmongoc-1.0 -o build/lib.linux-x86_64-2.7/monary/libcmonary.so
    /usr/bin/ld: cannot find -lsasl2
    collect2: error: ld returned 1 exit status
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

我想安装 monary 这样我就不必使用 pd.DataFrame(list()) 这对于 30 万个属性来说非常慢。

最佳答案

通过使用解决了它:

sudo apt-get install libsasl2-dev

我从 linked question 中推断出 如果 -lz 对应于 libz-dev 那么 -lsasl2 应该对应于 libsasl2-dev

关于linux - Ubuntu/usr/bin/ld : cannot find -lsasl2 while installing monary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49940689/

相关文章:

python - 从 Python 快速查询大型 MongoDB 集合

linux - 如何删除一个文件的第一个值未出现在另一个文件中的行?

linux - 如何在 Linux 上卸载 perl

php - MySQL混表查询

linux - 如何使用 .Xdefaults 文件更改 xterm 颜色?

c++ - 如何启用 _USE_UNIX98 (Gcc/C++ v2.96)

gcc:如何不编译警告

python - 在没有 gcc 或 root 访问权限的共享主机上安装需要 gcc 的 python 模块