简体   繁体   English

提升架构 arm64 的未定义符号

[英]Boost undefined symbol for architecture arm64

I'm trying to build a project that contains code with boost 1.65.1 required.我正在尝试构建一个项目,其中包含需要 boost 1.65.1 的代码。 I'm on a Mac OS M1 chipset (arm64)我使用的是 Mac OS M1 芯片组 (arm64)

I downloaded boost using homebrew brew install boost我使用自制软件brew install boost

and the version 1.80.0 was correctly installed.并且版本 1.80.0 已正确安装。 I complice using gcc g++ (and not clang) I include the library in my cmake and all the includes are working fine and my IDE is able to find all the function references.我复杂地使用 gcc g++(而不是 clang),我在我的 cmake 中包含了这个库,所有的包含都工作正常,我的 IDE 能够找到所有的函数引用。

At some part of the code I'm using boost::this_fiber::sleep_for function,在代码的某些部分,我使用了boost::this_fiber::sleep_for函数,

and at the compilation an error is raised by the linker在编译时,链接器会引发错误

Undefined symbols for architecture arm64:
  "_boost::fibers::context::wait_until(std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long, std::ratio<1l, 1000000000l> > > const&)", referenced from:
_void boost::this_fiber::sleep_for<long long, std::ratio<1l, 1000000l> >(std::chrono::duration<long long, std::ratio<1l, 1000000l> > const&) in libTest.a
ld: symbol(s) not found for architecture arm64

in my case I find the boost package and linked all boost libraries.在我的例子中,我找到了 boost 包并链接了所有 boost 库。 I even tried by hand to add -lboost_fiber-mt or Boost::fiber and I always end up with the same error.我什至尝试手动添加-lboost_fiber-mtBoost::fiber ,但我总是遇到同样的错误。

Do you have any idea why the symbol is undefined?你知道为什么这个符号是未定义的吗? The same code works perfectly on a ubuntu x86_64.相同的代码在 ubuntu x86_64 上完美运行。

I tried include the libraries by hand in the make and symbols is always undefined.我尝试在 make 中手动包含库,但符号始终未定义。

Probably not quite the answer you're looking for unfortunately, but I've had the same experience with a brew install, but have had success building the boost libraries myself, downloading from here and following installation instructions here .不幸的是,可能不是您正在寻找的答案,但我在brew安装方面有过相同的经验,但我自己成功构建了 boost 库,从此处下载并按照此处的安装说明进行操作。 Hope this is helpful!希望这会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM