简体   繁体   中英

Boost undefined symbol for architecture arm64

I'm trying to build a project that contains code with boost 1.65.1 required. I'm on a Mac OS M1 chipset (arm64)

I downloaded boost using homebrew brew install boost

and the version 1.80.0 was correctly installed. 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.

At some part of the code I'm using boost::this_fiber::sleep_for function,

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. I even tried by hand to add -lboost_fiber-mt or Boost::fiber and I always end up with the same error.

Do you have any idea why the symbol is undefined? The same code works perfectly on a ubuntu x86_64.

I tried include the libraries by hand in the make and symbols is always undefined.

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 . Hope this is helpful!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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