首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >dyld:未找到符号:_ERR_remove_thread_state

dyld:未找到符号:_ERR_remove_thread_state
EN

Stack Overflow用户
提问于 2017-04-01 18:55:24
回答 1查看 327关注 0票数 0

我正在尝试运行通过here提供的make_torrent示例代码。

我已经编译和安装了基于here编写的libtorrent

下面是我是如何编译和链接make_torrent.cc文件的。

代码语言:javascript
复制
g++ -g -Wall make_torrent.cc -ltorrent-rasterbar -lboost_system -o make_torrent

在运行make_torrent示例代码时,我看到了以下内容

代码语言:javascript
复制
usage: make_torrent FILE [OPTIONS]

Generates a torrent file from the specified file
or directory and writes it to standard out

OPTIONS:
-m file       generate a merkle hash tree torrent.
              merkle torrents require client support
              the resulting full merkle tree is written to
              the specified file
-w url        adds a web seed to the torrent with
              the specified url
-t url        adds the specified tracker to the
              torrent. For multiple trackers, specify more
              -t options
-c comment    sets the comment to the specified string
-C creator    sets the created-by field to the specified string
-p bytes      enables padding files. Files larger
              than bytes will be piece-aligned
-s bytes      specifies a piece size for the torrent
              This has to be a multiple of 16 kiB
-l            Don't follow symlinks, instead encode them as
              links in the torrent file
-o file       specifies the output filename of the torrent file
              If this is not specified, the torrent file is
              printed to the standard out, except on windows
              where the filename defaults to a.torrent
-r file       add root certificate to the torrent, to verify
              the HTTPS tracker
-S info-hash  add a similar torrent by info-hash. The similar
              torrent is expected to share some files with this one
-L collection add a collection name to this torrent. Other torrents
              in the same collection is expected to share files
              with this one.
-M            make the torrent compatible with mutable torrents
              this means aligning large files and pad them in order
              for piece hashes to uniquely indentify a file without
              overlap
dyld: lazy symbol binding failed: Symbol not found: _ERR_remove_thread_state
  Referenced from: /usr/local/lib/libtorrent-rasterbar.9.dylib
  Expected in: flat namespace

dyld: Symbol not found: _ERR_remove_thread_state
  Referenced from: /usr/local/lib/libtorrent-rasterbar.9.dylib
  Expected in: flat namespace

我知道我必须提供相关的论据来制作torrent,但我不确定为什么libtorrent会抱怨链接器

代码语言:javascript
复制
g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

有什么线索吗?

EN

回答 1

Stack Overflow用户

发布于 2017-08-24 08:09:30

这是由于未正确链接到openssl造成的。我假设您使用的是OSX,它的默认安装路径中有一个旧版本的openssl。

我建议使用brew install openssl安装openssl。请注意,这需要您安装了自制软件。完成此操作后,执行brew info openssl并查看告诉您添加到LDFLAGSCPPFLAGS中的内容的行。在我的例子中:

代码语言:javascript
复制
For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

因此,在我的例子中,我将使用以下命令进行编译:

代码语言:javascript
复制
g++ -g -Wall -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include make_torrent.cc -ltorrent-rasterbar -lboost_system -o make_torrent

如果这不起作用,我也会确保您在编译libtorrent时包含这些标志。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43155940

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档