Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build LocustDB on Mac OS X #114

Closed
zhzy0077 opened this issue Jan 2, 2019 · 4 comments
Closed

Unable to build LocustDB on Mac OS X #114

zhzy0077 opened this issue Jan 2, 2019 · 4 comments

Comments

@zhzy0077
Copy link
Contributor

zhzy0077 commented Jan 2, 2019

After the recently update on rust-toolchain at 28c5cc9.
Mac OS X will trigger a link error on building even after installed jemalloc brew install jemalloc.

The detail log is attached.

Undefined symbols for architecture x86_64:
            "_je_malloc_usable_size", referenced from:
                heapsize::heap_size_of_impl::h06f9a1e9b25e97c0 in libheapsize-aba9b641adeff33b.rlib(heapsize-aba9b641adeff33b.heapsize.6qnojmfe-cgu.4.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have done some investigations:

  1. After Nov. 2018, rust nightly removed built-in jemalloc allocator https://internals.rust-lang.org/t/jemalloc-was-just-removed-from-the-standard-library/8759
  2. The heapsize crate heavily relies on jemalloc. And it will fail to link w/o jemalloc. Undefined symbol _je_malloc_usable_size on macOS without jemalloc servo/heapsize#80 . This issue has been marked as wontfix.
  3. There is a similar issue on parity-ethereum, je_malloc_usable_size not found openethereum/parity-ethereum#9167 which is still open.

I still have no idea about how to fix this stuff.

@cswinter
Copy link
Owner

cswinter commented Jan 2, 2019

We could try switching the allocator back to jemalloc as per: https://doc.rust-lang.org/1.9.0/book/custom-allocators.html

@cswinter
Copy link
Owner

cswinter commented Jan 6, 2019

I had a go at it and it doesn't seem to be super easy to make this work, might be better to just remove the Heapsize dependency entirely. The only use of it right now is to get (approximate) size of data stored in memory, which is dominated by the DataSection structs in Column. Just estimating their memory usage with Vec::capacity() * std::mem::size_of should work well enough. It wouldn't account for allocator overhead, but it was never quite clear to me what exactly the heapsize crate did in that regard anyway.

@zhzy0077
Copy link
Contributor Author

zhzy0077 commented Jan 7, 2019

Yep, I have tried many days but eventually failed. heapsize has hard-coded link name on Mac OS X(https://github.com/servo/heapsize/blob/master/src/lib.rs#L44). After the removal of jemalloc, It's difficult to make this function available for rust to be linked.
In the future, if we want to have fine-grained control of memory, we can benefit from https://github.com/servo/servo/tree/master/components/malloc_size_of which is currently used by Servo.

@zhzy0077
Copy link
Contributor Author

zhzy0077 commented Jan 7, 2019

I have create a pr for this. Please have a look. #115

@cswinter cswinter closed this as completed Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants