facebook / facebook/folly

malloc madness

Open
#838 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

abandoned gcc 7.3.0 on RHEL7.4 and moved to Ubuntu 16.04 gcc 5.4.0
got further - folly built OK
however, when I tried building some code that *uses* folly, I ran into a compilation error. It seems that the declaration of malloc from libjemalloc-dev conflicts with the one in the std lib on the system:

`In file included from /usr/local/include/folly/memory/Malloc.h:32:0,
from /usr/local/include/folly/FBString.h:60,
from /usr/local/include/folly/Demangle.h:19,
from /usr/local/include/folly/ExceptionWrapper.h:33,
from /usr/local/include/folly/Try.h:18,
from /usr/local/include/folly/futures/Future.h:31,
from /home/whacuser/clipper/src/libclipper/src/query_processor.cpp:16:
/usr/include/jemalloc/jemalloc.h:137:46: error: declaration of ‘void* malloc(size_t)’ has a different exception specifier
JEMALLOC_EXPORT void *je_malloc(size_t size) JEMALLOC_ATTR(malloc);
^
In file included from /usr/include/c++/5/cstdlib:72:0,
from /usr/include/c++/5/ext/string_conversions.h:41,
from /usr/include/c++/5/bits/basic_string.h:5249,
from /usr/include/c++/5/string:52,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/iomanip:40,
from /home/whacuser/clipper/src/libclipper/src/query_processor.cpp:3:
/usr/include/stdlib.h:466:14: error: from previous declaration ‘void* malloc(size_t) throw ()’
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;`

Q is there a trick or magic preprocessor flag that will resolve this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.