Ubuntu /usr/bin/ld: cannot find -lsasl2 在安装 monary 时出错。

4 浏览
0 Comments

Ubuntu /usr/bin/ld: cannot find -lsasl2 在安装 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万个属性来说非常慢。

0
0 Comments

问题原因:在安装monary时出现了Ubuntu /usr/bin/ld: cannot find -lsasl2的错误。

解决方法:通过使用以下命令解决了该问题:sudo apt-get install libsasl2-dev

根据相关问题的链接,我推断如果-lz对应libz-dev,那么-lsasl2应该对应libsasl2-dev

0