Undefined symbols _mallctl on mac os
- Dominant language
- C++
- Stars
- 30.5k
- Forks
- 5.9k
- PR merge metrics
- No merged PRs in 30d
Description
Hey! I'm trying to build folly on mac os. I did:
```
git clone https://github.com/facebook/folly.git
cd folly
./build.sh
```
I'm getting linker errors:
```
[1/2] Linking CXX executable folly/logging/example/logging_example
FAILED: folly/logging/example/logging_example
...
Undefined symbols for architecture x86_64:
"_mallctl", referenced from:
folly::usingJEMalloc() in libfolly.a(ExceptionString.cpp.o)
folly::usingJEMalloc() in libfolly.a(Singleton.cpp.o)
folly::usingJEMalloc() in libfolly.a(Demangle.cpp.o)
folly::usingJEMalloc() in libfolly.a(ThreadLocalDetail.cpp.o)
folly::detail::MemoryIdler::flushLocalMallocCaches() in libfolly.a(MemoryIdler.cpp.o)
folly::usingJEMalloc() in libfolly.a(MemoryIdler.cpp.o)
folly::usingJEMalloc() in libfolly.a(File.cpp.o)
...
"_mallctlbymib", referenced from:
folly::detail::MemoryIdler::flushLocalMallocCaches() in libfolly.a(MemoryIdler.cpp.o)
"_mallctlnametomib", referenced from:
folly::detail::MemoryIdler::flushLocalMallocCaches() in libfolly.a(MemoryIdler.cpp.o)
"_mallocx", referenced from:
folly::threadlocal_detail::StaticMetaBase::reallocate(folly::threadlocal_detail::ThreadEntry*, unsigned int, unsigned long&) in libfolly.a(ThreadLocalDetail.cpp.o)
"_nallocx", referenced from:
folly::fbstring_core::initMedium(char const*, unsigned long) in libfolly.a(ExceptionString.cpp.o)
folly::fbstring_core::initLarge(char const*, unsigned long) in libfolly.a(ExceptionString.cpp.o)
folly::fbstring_core::reserveSmall(unsigned long, bool) in libfolly.a(ExceptionString.cpp.o)
folly::fbstring_core::reserveMedium(unsigned long) in libfolly.a(ExceptionString.cpp.o)
folly::fbstring_core::reserveLarge(unsigned long) in libfolly.a(ExceptionString.cpp.o)
folly::fbstring_core::unshare(unsigned long) in libfolly.a(ExceptionString.cpp.o)
folly::fbstring_core::reserveSmall(unsigned long, bool) in libfolly.a(Singleton.cpp.o)
...
"_xallocx", referenced from:
folly::threadlocal_detail::StaticMetaBase::reallocate(folly::threadlocal_detail::ThreadEntry*, unsigned int, unsigned long&) in libfolly.a(ThreadLocalDetail.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
```
I'm on the commit `2c7411feca1af7fde6a67eb7d4afbe917b542ee2`, this is current master, also tag `v2021.08.23.00`.
I know I can just do `brew install folly` but I couldn't downgrade folly through brew(any tips on that maybe?). I need to try different builds of folly for some other library.
I tried checking out following tags(got the same result):
- v2021.08.23.00
- v2021.08.02.00
- v2021.07.20.01
os: mac os big sur 11.5.2.
If you want any more versions, please, let me know.
Thanks in advance!
Contributor guide
Research direction
Start by reproducing the failure with ./build.sh at commit 2c7411feca1af7fde6a67eb7d4afbe917b542ee2, then inspect the build configuration and linker flags for the missing _mallctl, _mallctlbymib, _mallocx, _nallocx, and _xallocx symbols. Done means the listed folly logging example links successfully on macOS Big Sur.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, macos
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100